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.
In short
This PR cleans up the
amc
application and improves the reporting of timing overflow of theDO
phase plus reduces the duration of theTX
phase of theRUN
state.In more details
Cleanup
The cleanup is about the following.
amc
.#warning
pragmas which were added during development to remind about possible checks or minor things left over. Now theamc
compiles with zero warnings.The execution timing overflow is always enabled
The
DO
phase now always reports with a diagnostics message when its duration is higher than the requested budget. The advantage is that now we don't lose warnings anymore.Optimization of execution time of the
TX
phase ofRUN
stateThe request of the transmission of the CAN frames now starts at the end of the
DO
phase and not at the start of theTX
phase.The advantage is that we gain some execution time because the TX phase does not need to wait much for the CAN transmission to be over and terminates in a shorter time.
See next figure to see the timing details of the RUN state so far and now.
Figure. SO FAR: The case of CAN transmission request done in the
tTX
thread.The
tTX
thread requests a CAN transmission and let the HW work. But the HW finds a busy channel because the attached CAN boards send 6 full length CAN frames every cycle. So the transmission will likely start some time after. Then it takes about 100 us to exit the CAN peripheral. So thetTX
thread will likely be locked (see threadtIDLE
executing) and wait for the end of CAN transmission. As a result we have a typical duration of thetTX
thread of 200 us.So far, we have placed the start of TX of CAN in the correct thread but we don't use in an efficient way the HW because we force the CPU to wait for the CAN HW peripheral to finish its job.
The following figure instead shows the if we anticipate the TX request of the CAN frames then we avoid that the highest priority thread
tTX
is locked to waste CPU time.Figure. NOW: The case of early CAN transmission request done in the
tDO
thread.In this case
tTX
thread is not blocked to wait for the end of CAN transmission. There is no execution of thetIDLE
thread. As a result we have a much better duration of thetTX
thread of about 100us.Mergeability
I did tests on the
lego setup
and also on thewrist
and all works fine. Also, there is no cgange in behavior for teh other ETH boards such asems
,mc4plus
,mc2plus
, so we can safely merge.Associated PRs
There is an associated PR for the new binary of the
amc
: