Skip to content

Incorrect timing calculation in can_mcux_flexcan #31014

@GrixaYrev

Description

@GrixaYrev

Describe the bug

Fields propSeg, phaseSeg1 and phaseSeg2 are given to FLEXCAN HAL without conversion (i.e. like register value), but this fields are used in timing calculation like interval value. Interval value is equal register value increased by one.
Incorrect bus speed and large number of errors are in result.

To Reproduce
Speed of FlexCAN 250k and greater (When speed is 125k, deviation is not critical).

Expected behavior
Real bus speed is equal expected bus speed.

Impact
Showstopper

Environment:

Variant of solution
Fields propSeg, phaseSeg1, phaseSeg2, rJumpwidth and preDivider should decreased by one before giveing to FLEXCAN HAL in lines 140..144 and 171..174 of file drivers\can\can_mcux_flexcan.c. Also temporary struct is needed in function mcux_flexcan_set_timing(), because data->timing should have interval value rather than register value.

Metadata

Metadata

Labels

area: CANbugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions