Skip to content

Conversation

@ThadHouse
Copy link
Contributor

@ThadHouse ThadHouse commented Sep 28, 2022

Currently, if you send an FD frame with the mcan driver, but FD mode was not enabled, the hardware will only send the first 8 bytes of the frame, but still with a DLC of FD length. This results in some very weird behavior on the bus, dependning on what other devices are doing. Add a check to ensure an FD send only occurs with FD enabled.

Fixes: #50776

Signed-off-by: Thad House [email protected]

@henrikbrixandersen
Copy link
Member

Yeah. We need to fix this in pretty much every driver.

Currently, if you send an FD frame with the mcan driver, but FD
mode was not enabled, the hardware will only send the first 8 bytes
of the frame, but still with a DLC of FD length. This results in
some very weird behavior on the bus, dependning on what other devices
are doing. Add a check to ensure an FD send only occurs with FD enabled.

Signed-off-by: Thad House <[email protected]>
Copy link
Member

@alexanderwachter alexanderwachter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tanks for the fix!

@henrikbrixandersen
Copy link
Member

@ThadHouse Can I ask you to open a bug report for this one as well? Thanks.

@ThadHouse
Copy link
Contributor Author

@ThadHouse Can I ask you to open a bug report for this one as well? Thanks.

Done. #50776

@henrikbrixandersen henrikbrixandersen added bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug labels Sep 28, 2022
@mmahadevan108
Copy link
Contributor

@henrikbrixandersen, is this needed for 3.2 release?

Copy link
Member

@henrikbrixandersen henrikbrixandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to look further into this as it breaks some of our non CAN-FD test cases/applications (the ones that neglect to set .fd = 0; .brs = 0 since they pre-date CAN-FD support in Zephyr.

@henrikbrixandersen
Copy link
Member

I need to look further into this as it breaks some of our non CAN-FD test cases/applications (the ones that neglect to set .fd = 0; .brs = 0 since they pre-date CAN-FD support in Zephyr.

Alternate proposal in #51361.

@henrikbrixandersen
Copy link
Member

@ThadHouse Thank you for submitting this. However, an alternate solution to this issue was merged in #51361, so I am closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: CAN bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CAN Drivers allow sending FD frames without device being set to FD mode

6 participants