Dear developers and users, Today i discovered a very strange behaviour of scheduler. When i perform hwtimer_wait(x) function, where x - time to wait, if x < critical_value then the function is finished correctly, but if x>critical_value, then the function never wakes up. The critical_value varies and depends on time of excectuion of sched_set_status function. I have the following output from scheduler when the function doesn`t wakes up: thread_wakeup: Trying to wakeup PID 1… status = 4875(or = 64) thread_wakeup: Thread is not sleeping! I tried to catch the function, which change the pid_status value, but nothing came out. Let me know, if you have any ideas, thank you.
Hello Aleksandr,
as the name says hwtimer is hardware dependent - can you tell us which MCU you are using?
If you are programming for the STM Cortex-M3/M4 - only 16-Bit Timer are implemented for hwtimer. 32-Bit Timer are very rare and may be used for more important tasks than waiting for longer periods. E.g. one 32-Bit Timer is temporarily used for hwtimer_now(). The longest period you can wait with a 16-Bit Timer are 54-56 seconds as far as I remember the implementation. For longer periods use the RTC alerts.
Best regards, Marco Ziegert
Currently i am testing RIOT on chronos and stm32f4discovery boards. Thank you for your comments. Finally i found the problem - i compile the code with DEBUG parameter, this leads to printf lines inside thread_wakeup function, and that caused my problem. Now, when i removed all printf code from this functions all works fine. Also some printf inside scheduler causes the same effect.