How does one set FlexCAN in 2.0B mode?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How does one set FlexCAN in 2.0B mode?

384件の閲覧回数
scottmitchell
Contributor I

I’ve come across a problem with the FlexCAN ports on the i.MX8X. In Linux, we bring up the CAN ports thusly;

 

ip link set can0 type can bitrate 1000000 dbitrate 1000000 fd on

ip link set can0 up

 

…even though we really want the port to operate in CAN 2.0B (non FD) mode. Examining the link with;

ip -details link show can0

...yields;

2: can0: <NOARP,ECHO> mtu 72 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10

    link/can  promiscuity 0

    can <FD> state STOPPED (berr-counter tx 0 rx 0) restart-ms 0

          bitrate 1000000 sample-point 0.750

          tq 25 prop-seg 14 phase-seg1 15 phase-seg2 10 sjw 1

          flexcan: tseg1 2..64 tseg2 1..32 sjw 1..32 brp 1..1024 brp-inc 1

          dbitrate 1000000 dsample-point 0.750

          dtq 50 dprop-seg 7 dphase-seg1 7 dphase-seg2 5 dsjw 1

          flexcan: dtseg1 1..39 dtseg2 1..8 dsjw 1..8 dbrp 1..1024 dbrp-inc 1

          clock 40000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535

 

This seems to confirm that the port is in fact in CAN FD mode which we don’t want. But I am not able to set it with CAN FD turned off (fd off). If I do, I get;

RTNETLINK answers: Operation not supported

 

In fact I can listen in on non-FD traffic on that port, but as soon as I attempt to transmit, it brings down the bus and the FlexCAN will eventually go bus off. This makes sense since the other devices on the bus are not FD capable.

 

Is there a way to get the port operating in non-FD (2.0B) mode?

Thanks.

0 件の賞賛
返信
4 返答(返信)

30件の閲覧回数
scottmitchell
Contributor I

I have modified the device tree file to add the disable-fd-mode option to the CAN port as Igor suggested, and this has solved the issue.

Scott

0 件の賞賛
返信

30件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Scott

seems you are right, there is no way to get the port operating in non-FD (2.0B) mode.

One can try workarounds described in below paper

https://www.can-cia.org/fileadmin/resources/documents/proceedings/2013_monroe.pdf 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

30件の閲覧回数
scottmitchell
Contributor I

Hi Igor,

Thank you for the response and the reference.

In this case, I am trying to use the FlexCAN with only CAN 2.0B nodes, which it seems like it should be able to do. From what I've read of the FlexCAN controller, it is capable of operating in either mode but from the Linux side, I'm not able to configure it for only 2.0B mode as that mode is not supported.

From what I've been able to gather from Google, setting both the arbitration and data phase bitrates the same should accomplish this, but in my case it does not.

Thanks again,

Scott

0 件の賞賛
返信

30件の閲覧回数
scottmitchell
Contributor I

Hi Igor,

I think that's what I'm going to need to do as nothing else seems to work.

Thanks for your help.

Scott

0 件の賞賛
返信