Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes false reporting of execution time overflow emitted by object
EOMtheEMSrunner
that we have observed when the system is highly stressed.The reason of the false reporting was due to a race condition inside the RTOS function
osal_system_abstime_get()
which may return non-increasing time between two consecutive calls, thus generating negative delta time.In doing so, I have also added support to a proper monitoring of min, max, average duration of the
RX
,DO
, andTX
phases of the runner. Now this feature is disabled. Ideally, it could be useful to let the xml file that specifies the durationRX
,DO
, andTX
phases also specify whether or not to activate this monitoring and the frequency of its reporting.Some more about the RTOS improvement.
In$us$ (but also the $ns$ are available). We achieve that by adding two contributions. The tick time of the RTOS that is typically at 1 $ms$ granularity and is incremented by the $ms$ so delta times can be wring by +1000 or -1000 $us$ .
osal
, we measure system time in units ofSysTick_Handler()
gives the coarse resolution. The content of theSTCUR
register that counts down from its reload value to zero gives the fine resolution.The combination of coarse and fine values are done inside the
SVC_Handler()
that has a higher priority than theSysTick_Handler()
. In rare cases it may happen that theSVC_Handler()
is called to get the system time but in the meantime theSTCUR
register goes to zero and set theSysTick_Handler()
pending. In this case it is correct to add +1 to the tick count. Failure to do that results in a system time that can be wrong of 1This PR fixed that.
Mergeability
I have tested the new feature on a dedicated setup with a nasty test harness and partly on
iRonCub
robot running at 1kHz reporting rate, so I believe that we can safely merge.Associated PRs
We also have new binaries for
ems
,mc4plus
,mc2plus
,amc
: