Re: [riot-devel] UDP datagram sending

2016-06-10 Thread Peter Kietzmann

Hi Mateusz,

nice! I was just about to start looking into it. For the next time I 
recommend to work in branches. (i) It is the "RIOT-way" and (ii) it 
makes reviewing your changes a lot easier.


Cheers
Peter

Am 10.06.2016 um 11:17 schrieb Mateusz Kubaszek:

Problem solved,

It was caused by netreg registering. The msg queue initialization is
performed inside the thread, so if it has lower priority or the
scheduler is not called after thread creation the gnrc_netreg_register()
fails.

The solution was to register this thread after message queue
initialization. So after i placed the gnrc_netreg_register() inside the
thread function all works fine.

Many thanks :)
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


--
Peter Kietzmann

Hamburg University of Applied Sciences
Dept. Informatik, Internet Technologies Group
Berliner Tor 7, 20099 Hamburg, Germany
Fon: +49-40-42875-8426
Web: http://www.haw-hamburg.de/inet
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


[riot-devel] UDP datagram sending

2016-06-10 Thread Mateusz Kubaszek

Hi Peter,
Thank you for your reply.

Hi Mateusz,

hard to figure out from afar. Do you have your code available on github?


https://github.com/mathirkub/RIOT/blob/master/sys/udp_test/udp_test.c#L267-L269



Regarding 1): I don't know how this should be related to you memory 
violation issue.


Regarding 2): AFAIK your thread will have the priority that you give 
on initialization, no matter from where  it is created.


Best
Peter 
I have tested the same scenario (thread creation with higher priority 
and with THREAD_CREATE_WOUT_YIELD) in /test/xtimer_msg project. All 
worked fine. So this could be a specific problem with my project or it 
could be connected with another threads running in this specific program.


It is not caused by insufficient stack size.
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


Re: [riot-devel] UDP datagram sending

2016-06-08 Thread Peter Kietzmann

Hi Mateusz,

hard to figure out from afar. Do you have your code available on github?

Regarding 1): I don't know how this should be related to you memory 
violation issue.


Regarding 2): AFAIK your thread will have the priority that you give on 
initialization, no matter from where  it is created.


Best
Peter

Am 07.06.2016 um 11:26 schrieb Mateusz Kubaszek:

Hi,

 > can you elaborate on how it "doesn't work"?

After the message is sent, the reading thread doesn't receive it. I have
been watching what is going on in "gnrc_netapi_dispatch" function. The
destination pid is correct and there wasn't a problem with message
sending. Destination PID is 6 which is the udp thread (I put there a
printf statement indicating any incoming message).

I finally resolved the problem yesterday's night. I was certain about
it, but now I repeated a couple of tests and I don't know why it is
working properly... The UDP thread's priority equals 5, the same
priority has my sending thread. After I lowered my thread's priority to
be lesser than udp's (lets say 6) all began to work properly. Today I
retried the test and all seems to work no matter what my thread priority
is. So maybe there was another bug in my code. Sorry to bother you.

But I have two more things that puzzles me. Why the program is aborting
as a result of memory access violation after my thread has been:
1) Initialized with flag THREAD_CREATE_WOUT_YIELD
2) Has lower or the same priority as main thread from which it was created.

The platform I am running my program on is native (Linux).
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


--
Peter Kietzmann

Hamburg University of Applied Sciences
Dept. Informatik, Internet Technologies Group
Berliner Tor 7, 20099 Hamburg, Germany
Fon: +49-40-42875-8426
Web: http://www.haw-hamburg.de/inet
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


[riot-devel] UDP datagram sending

2016-06-07 Thread Mateusz Kubaszek

Hi,

> can you elaborate on how it "doesn't work"?

After the message is sent, the reading thread doesn't receive it. I have 
been watching what is going on in "gnrc_netapi_dispatch" function. The 
destination pid is correct and there wasn't a problem with message 
sending. Destination PID is 6 which is the udp thread (I put there a 
printf statement indicating any incoming message).


I finally resolved the problem yesterday's night. I was certain about 
it, but now I repeated a couple of tests and I don't know why it is 
working properly... The UDP thread's priority equals 5, the same 
priority has my sending thread. After I lowered my thread's priority to 
be lesser than udp's (lets say 6) all began to work properly. Today I
retried the test and all seems to work no matter what my thread priority 
is. So maybe there was another bug in my code. Sorry to bother you.


But I have two more things that puzzles me. Why the program is aborting 
as a result of memory access violation after my thread has been:

1) Initialized with flag THREAD_CREATE_WOUT_YIELD
2) Has lower or the same priority as main thread from which it was created.

The platform I am running my program on is native (Linux).
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


[riot-devel] UDP datagram sending

2016-06-06 Thread Mateusz Kubaszek

Hi :)

I am writing an UDP module for sending and receiving datagrams with 
ACKs. It is based on udp and pktdump example. I have a certain problem 
with datagram sending from my custom thread. Using shell module the 
datagrams are prepared as pktsnip and then sent by calling 
"gnrc_netapi_dispatch_send(GNRC_NETTYPE_UDP, GNRC_NETREG_DEMUX_CTX_ALL, 
ip);". The thread number is 2 which indicates the main thread. Up to 
this point everything seems to work fine. When I'm doing the same thing 
using my custom thread it doesn't work. Why is it so?


Best regards,
Mateusz Kubaszek
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel