AnsweredAssumed Answered

MX53 FlexCAN bitrate is incorrect?

Question asked by Frank Chen on Oct 25, 2013
Latest reply on Oct 27, 2013 by Frank Chen

The flexcan can send/receive data successfully between two MX53 baords (On one board running "cansend" and on the other running "candump"). I set the bitrate through flexcan attributes interface (for eg., "echo 125000 > /sys/devices/platform/FlexCAN.0/bitrate").

 

However MX53 board can not communicate with other CAN devices (for eg., MX6 flexcan). I checked the waveform of MX53 flexcan by an oscilloscope and found the actual bitrate is incorrect. It is about 2.5 time of the expected values.

 

I reviewed the clock settings of CAN and debugged the driver. By "cat /proc/cpu/clocks" I can see the can_clk-0 is 24MHz, and its parent lp_apm-0 is 24MHz too. They should be all correct.

When I set the bitrate (by "echo ..."), for eg, set to 500KHz, the driver calculated the timing values and got the following results:

brp = 2, phase_seg1 = 4, phase_seg2 = 4, prop_seg = 4

So the bitrate is (24MHz / ((brp + 1) * (phase_seg1 + phase_seg2 + prop_seg + 4))) = 24MHz / (3 * 16) = 500KHz

 

So everything looks right, but why the bitrate waveform on the oscilloscope is incorrect?

 

The BSP I used is MX53 Android R10.3.

 

If anybody has similar issue, please advise. Thanks.

Outcomes