Question regarding the test-timing code #16
-
Hi Jeff, In your tick-timing task vTttOsTask, you have a loop waiting for the tickCount to change:
I understand that in order to exit the loop, you must get interrupted, by the tick ISR, between the two calls to xTaskGetTickCount(). However this can happen either before the tickHookSnaphot is copied or after. In the first case you get the new RTC timestamp of the tick and in the second you get the old timestamp. You might even get the interrupt in the middle of copying the structure. Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @efthym - That loop might look like it is waiting for the tickCount to change, but really it's the opposite. The loop only iterates again if the tick count changes. So in reality, the loop almost never iterates. It is capturing two items that can change asynchronously (the tick-hook RTC snapshot and the OS tick count) and then verifying afterward that neither one changed during/after the capturing. Thus the two items can be considered coherent (or correlated correctly to eachother). Does that help? |
Beta Was this translation helpful? Give feedback.
-
@efthym The Compare-ST-Example branch might be helpful if you are evaluating ST's code for LPTIM FreeRTOS tick. Take a look. |
Beta Was this translation helpful? Give feedback.
Hi @efthym -
That loop might look like it is waiting for the tickCount to change, but really it's the opposite. The loop only iterates again if the tick count changes. So in reality, the loop almost never iterates. It is capturing two items that can change asynchronously (the tick-hook RTC snapshot and the OS tick count) and then verifying afterward that neither one changed during/after the capturing. Thus the two items can be considered coherent (or correlated correctly to eachother). Does that help?