Hello,
I use the sleep function and it seems that it blocks the other threads while sleeping. Has someone got the same problem? I use sleep in the main thread with RPL_UDP example.
Regards,
Hello,
I use the sleep function and it seems that it blocks the other threads while sleeping. Has someone got the same problem? I use sleep in the main thread with RPL_UDP example.
Regards,
Hi,
there is no such function in RIOT.
You are probably want to use hwtimer_wait().
I assume you are using native, so you are calling your Linux sleep function, which will indeed stop the whole RIOT process in your Linux system.
Best Christian
Hi!
>I use the sleep function and it seems that it blocks the other threads >while sleeping. Has someone got the same problem? >I use sleep in the main thread with RPL_UDP example.
there is no such function in RIOT.
sleep() from POSIX is a wrapper around vtimer_sleep(). Usually, this will let only the calling thread sleep (technically, it's MUTEX_BLOCKED). If this is not the case, it looks like a bug with vtimer or hwtimer on the particular platform. Can you test tests/vtimer_* and tests/hwtimer_* to verify that timers on your platform (SAMR21, I assume?) are working.
Cheers, Oleg
I tried the examples: vtimer_msg_diff:
kernel_init(): jumping into first task… This is thread 3
Sending timer msg 0…
Initializing “T1”.
now=00:8441 -> every 0.100000s: T1 diff=ld
Sending timer msg 1…
Initializing “T2”.
now=00:17643 -> every 0.200000s: T2 diff=ld
Sending timer msg 2…
Initializing “T3”.
now=00:26872 -> every 0.300000s: T3 diff=ld
Sending timer msg 3…
Initializing “T4”.
now=00:36134 -> every 0.500000s: T4 diff=ld
Sending timer msg 4…
Initializing “T5”.
now=00:45406 -> every 0.700000s: T5 diff=ld
Sending timer msg 5…
Initializing “T6”.
now=00:54691 -> every 1.100000s: T6 diff=ld
now=00:115305 -> every 0.100000s: T1 diff=ld
now=00:220643 -> every 0.100000s: T1 diff=ld
WARNING: timer difference ldus exceeds MAXDIFF(21036)!
now=00:231478 -> every 0.200000s: T2 diff=ld
WARNING: timer difference ldus exceeds MAXDIFF(21036)!
now=00:331448 -> every 0.100000s: T1 diff=ld
WARNING: timer difference ldus exceeds MAXDIFF(21036)!
now=00:342198 -> every 0.300000s: T3 diff=ld
WARNING: timer difference ldus exceeds MAXDIFF(21036)!
now=00:442229 -> every 0.200000s: T2 diff=ld
WARNING: timer difference ldus exceeds MAXDIFF(21036)!
-> This seems to have a problem or is that normal?
vtimer_msg:
kernel_init(): jumping into first task… This is thread 3
sending 1st msg
now=0:7625 -> every 2.0s: Hello World
timer_thread: set timer successfully
sending 2nd msg
now=0:16728 -> every 5.0s: This is a Test
timer_thread: set timer successfully
This is thread 4
sec=1 min=0 hour=0
now=2:11923 -> every 2.0s: Hello World
timer_thread: set timer successfully
sec=2 min=0 hour=0
sec=3 min=0 hour=0
now=4:16357 -> every 2.0s: Hello World
timer_thread: set timer successfully
sec=4 min=0 hour=0
now=5:21434 -> every 5.0s: This is a Test
timer_thread: set timer successfully
sec=5 min=0 hour=0
now=6:20797 -> every 2.0s: Hello World
timer_thread: set timer successfully
sec=6 min=0 hour=0
sec=7 min=0 hour=0
now=8:25234 -> every 2.0s: Hello World
timer_thread: set timer successfully
sec=8 min=0 hour=0
sec=9 min=0 hour=0
now=10:26160 -> every 5.0s: This is a Test
timer_thread: set timer successfully
now=10:34230 -> every 2.0s: Hello World
timer_thread: set timer successfully
sec=10 min=0 hour=0
-> This seems to work properly.
I will try the other ones later.
Cheers,