Hello
How can I know how many ticks the os_mbx_wait function slept before the message has been received? So when the return code is OS_R_MBX, how can I calculate the wait period?
Regards
What is your reason for needing to know?
I normally always design in an uptime counter in my applications, so I know how long since last reboot. It might be a two-level construct with one 32-bit counter keeping track of seconds and another keeping time in maybe 10ms resolution. Or I may peek at a running timer to get us or better resolution.
With a two-level construct, you have to be a bit careful so you don't get a turn-over of the fast value in between sampling the two values.
I need this information for my own timers implementation. I wait for messages using 'os_mbx_wait' and I need to know how long the wait took in order to calculate the timer expiration. If there is no other option I will add an uptime counter as you suggested.
How do you implement your uptime counter? I mean where do you increment it? I tried to use os_tmr_create/os_tmr_call but this is just a one shot timer not a periodic one, and I cannot call the os_tmr_create function from os_tmr_call to reactivate it I tried also to use my SysTick_Handler which calls the SysTick_Handler exported by RTX but the execution stop into a hardware-fault
Have you read this? (and following pages....) Common timeslice is 10ms ... but changeable. http://www.keil.com/support/man/docs/rlarm/rlarm_ar_timer_tick.htm
.
And You can use (like Per said) an own timer with interrupt beside RTX.
Finally I have used TIM1.
Thanks