linux-can / can-utils

Linux-CAN / SocketCAN user space applications
2.31k stars 698 forks source link

CAN FD, data phase bitrate is equal to arbitration phase (RPI4 + MCP2518FD) #520

Closed JuraszekL closed 2 months ago

JuraszekL commented 2 months ago

Hello team! I am testing the FD driver for the first time, and i am a bit confused about the results. To make the thing simple:

image

As You can see, max. bit width is 2us, and that gives 1/0,000002s = 500000b/s, which is fine for arbitration phase, but not for the data phase. Ignore the fact that Saleae doesn't recognize the data fields properly - the CAN FD analyzer is not implemented yet.

The MCP2518FD CAN controller is compliant with ISO 11898-1:2015.

Am i missing something? Please let me know what i'm doing wrong.

BR. Łukasz

hartkopp commented 2 months ago

Everything is fine in your setup.

The BRS (bit rate setting) bit is part of every CAN FD frame.

In your example $ cansend can0 123##0112233445566778899101011111111223344556677899665544343 The BRS bit is not set. The struct canfd_frame.flags (directly behind the two ##'s) is zero.

Try $ cansend can0 123##5112233445566778899101011111111223344556677899665544343

That should make it.

Btw. fd-non-iso off is obsolete, as this setting is off by default.

JuraszekL commented 2 months ago

There couldn't be a better example of how to use the BRS bit than my issue. Thank You so much!

hartkopp commented 2 months ago

Thanks!