Skip to content

Conversation

henrikbrixandersen
Copy link
Member

@henrikbrixandersen henrikbrixandersen commented Jul 18, 2022

Backport c17c7e4..097cb04 from #47903

Fixes: #47955, #47204, #47902, #47904

@henrikbrixandersen henrikbrixandersen self-assigned this Jul 18, 2022
@github-actions github-actions bot added area: Tests Issues related to a particular existing or missing test platform: NXP NXP labels Jul 18, 2022
@henrikbrixandersen henrikbrixandersen linked an issue Jul 18, 2022 that may be closed by this pull request
@henrikbrixandersen henrikbrixandersen force-pushed the backport-47903-to-v2.7-branch branch from 1f91259 to 5fc4382 Compare July 18, 2022 14:38
The Bosch M_CAN IP does not support RX filtering of the RTR bit, so the
driver handles this bit in software.

If a recevied frame matches a filter with RTR enabled, the RTR bit of
the frame must match that of the filter in order to be passed to the RX
callback function. If the RTR bits do not match the frame must be
dropped.

Improve the readability of the the logic for determining if a frame
should be dropped and add a missing FIFO acknowledge write for dropped
frames.

Fixes: zephyrproject-rtos#47204

Signed-off-by: Henrik Brix Andersen <[email protected]>
When installing a RX filter, the driver uses "filter->rtr &
filter->rtr_mask" for setting the filter mask. It should just be using
filter->rtr_mask, otherwise filters for non-RTR frames will match RTR
frames as well.

When transmitting a RTR frame, the hardware automatically switches the
mailbox used for TX to RX in order to receive the reply. This, however,
does not match the Zephyr CAN driver model, where mailboxes are
dedicated to either RX or TX. Attempting to reuse the TX mailbox (which
was automatically switched to an RX mailbox by the hardware) fails on
the first call, after which the mailbox is reset and can be reused for
TX. To overcome this, the driver must abort the RX mailbox operation
when the hardware performs the TX to RX switch.

Fixes: zephyrproject-rtos#47902

Signed-off-by: Henrik Brix Andersen <[email protected]>
Check the frame ID type and RTR bit when comparing loopback CAN frames
against installed RX filters.

Fixes: zephyrproject-rtos#47904

Signed-off-by: Henrik Brix Andersen <[email protected]>
Add test for CAN RX filtering of RTR frames.

Signed-off-by: Henrik Brix Andersen <[email protected]>
@henrikbrixandersen henrikbrixandersen force-pushed the backport-47903-to-v2.7-branch branch from 5fc4382 to 15787b7 Compare July 18, 2022 20:44
@henrikbrixandersen henrikbrixandersen marked this pull request as ready for review July 18, 2022 21:01
@cfriedt cfriedt merged commit 567fda5 into zephyrproject-rtos:v2.7-branch Jul 19, 2022
@henrikbrixandersen henrikbrixandersen deleted the backport-47903-to-v2.7-branch branch July 20, 2022 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: CAN area: Tests Issues related to a particular existing or missing test platform: NXP NXP
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[backport v2.7-branch] backport of #47903 failed
5 participants