embot::hw::can -> fixed ID filters for the FDCAN case #287
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 the CAN ID filtering for the case of FDCAN peripherals and affects boards such as
pmc
,amcbldc
andamc
.Before this change, for the above boards the ID filtering was not effective and the boards received every CAN frame, the so called
pass-all
behavior. Now, the HW filters of the FDCAN peripheral select the CAN frames by their IDs.The selection allows only messages for:
In this way the CPU of each board processes only what it needs.
The previous
pass-all
behavior is not wrong per se, but in some cases of excessive traffic it caused reception problems which prevent the drive to work correctly.It is the case of the new wrist in iCub, where we have three
amcbldc
boards. In here if we don't use filtering, each board receives almost in at the same time up to 5 CAN frames, when only one is relevant to the board.Problem is that the RX FIFO0 buffer which is used to accumulate the frames before the IRQ Handler can get them can host only three messages.
In this PR I fixed the above case by:
The changes were tested on a
pmc
board for what is related to correct ID filtering and on astrain2
board to verify that there are no side effects on older boards and finally on theamcbldc
boards of the wrist.NOTE: the
amc
board must be able to receive every frame and this behavior is satisfied. That happens because it calls onlyembot::hw::can::init()
which by default enables thepass-all
mechanism. The filter is activated only byembot::hw::can::setfilters()
which theamc
must not call.