Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: can: flexcan: Fix incorrect timing. Fix for #31014 #31015

Merged

Conversation

alexanderwachter
Copy link
Member

The timing values need to be subtracted by one.
Fixes #31014

@alexanderwachter alexanderwachter added bug The issue is a bug, or the PR is fixing a bug area: CAN labels Dec 27, 2020
@alexanderwachter
Copy link
Member Author

ping @GrixaYrev

The timing values need to be subtracted by one.

Signed-off-by: Alexander Wachter <[email protected]>
@MaureenHelm MaureenHelm added this to the v2.5.0 milestone Jan 5, 2021
@MaureenHelm
Copy link
Member

@henrikbrixandersen will you please have a look?

@henrikbrixandersen
Copy link
Member

When using a bitrate of 125000 set in DTS, I get the following warning: "[00:00:00.000,000] can_mcux_flexcan: Bitrate error: 200". What is a user expected to do?

@GrixaYrev
Copy link
Contributor

GrixaYrev commented Jan 11, 2021

When using a bitrate of 125000 set in DTS, I get the following warning: "[00:00:00.000,000] can_mcux_flexcan: Bitrate error: 200". What is a user expected to do?

User should set correct values of prop-seg, phase-seg1 and phase-seg2 in DTS.
See http://bittiming.can-wiki.info

@alexanderwachter
Copy link
Member Author

Or just let the algorithm select the timing based on the sample point. The message is telling you that there is in bitrate error of 200 with the given timing.

@henrikbrixandersen
Copy link
Member

Or just let the algorithm select the timing based on the sample point. The message is telling you that there is in bitrate error of 200 with the given timing.

This is with the default timing for the twr_ke18 board in Zephyr.

@alexanderwachter
Copy link
Member Author

Maybe we could add a shell command that prints timing values. A user can then write them to the device tree to not calculate them online

@alexanderwachter
Copy link
Member Author

@henrikbrixandersen we should switch to using the algorithm in device tree. Some of the actual timing in the device tree are just wrong, because they are copied along different boards. They may fit, but sometimes the clock rate changes and then the timing gets wrong (that happened on as stm32 board already)

@MaureenHelm MaureenHelm merged commit d7a5b9f into zephyrproject-rtos:master Jan 12, 2021
@alexanderwachter alexanderwachter deleted the can_fix_flexcan_timing branch January 30, 2021 09:54
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 platform: NXP NXP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect timing calculation in can_mcux_flexcan
6 participants