Re: Question on CAN FD Driver for mcp251xfd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 20.11.20 19:57, Jin Park wrote:
Hello Oliver,

It works!

Great!

Yes, a CAN FD controller is unhappy if only parts of the needed configuration is applied ;-)

https://elixir.bootlin.com/linux/latest/source/drivers/net/can/dev.c#L897

Have fun!

Oliver

1) I set it 1Mbps for arbitration phase and 4Mbps for data phase as bit rate switching like below.
ip link set can0 up type can bitrate 1000000 sample-point 0.75 dbitrate 4000000 dsample-point 0.8 fd on

2) Send CAN FD data
cansend can0 123##1122334455667788991011121314151617181920

3) I got the data through CAN bus.
ID=291,Type=F,Length=32,Data=11223344556677889910111213141516171819202122232425

It solved!

Many Thanks,
Jin

-----Original Message-----
From: Oliver Hartkopp <socketcan@xxxxxxxxxxxx>
Sent: Friday, November 20, 2020 10:34 AM
To: Jin Park <jpark@xxxxxxxxxxxxxxxxx>; Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>; manivannan.sadhasivam@xxxxxxxxxx
Cc: linux-can@xxxxxxxxxxxxxxx
Subject: Re: Question on CAN FD Driver for mcp251xfd

EXTERNAL EMAIL - Use caution when responding, clicking, and/or downloading attachments.





On 20.11.20 18:14, Jin Park wrote:
Hello Marc,

Here are my answers.
VAR-SOM-MX8M-Nano board drives MCP2517FD/MCP2518FD (CAN FD controller) and TCAN332G (CAN FD Transceiver) for CAN FD communication.

1) Which commands have you tried?
2) What are the error messages?
Please see below a), b), c), and d).

       a) Based on Bit Rate Switching feature in CAN FD, the bit rate at data phase and arbitration phase (or nominal phase) can be set in CAN FD protocol.
So, I tried below.
- command
ip link set can0 type can dbitrate 1000000

- error message
RTNETLINK answers: Operation not supported



You need to apply both bitrates at the same time, e.g.

$ ip link set can0 up type can bitrate 500000 sample-point 0.75 dbitrate
4000000 dsample-point 0.8 fd on

See at:

https://www.kernel.org/doc/Documentation/networking/can.txt

Regards,
Oliver


       b) To turn on FD mode, I tried below.
- command
ip link set can0 type can fd on

- error message
RTNETLINK answers: Operation not supported



       c) To send CAN FD message, I tried below. Th
- command
cansend can0 123##1

- error message
CAN interface is not CAN FD capable - sorry.

- help text for cansend
      <can_id>#{R|data}          for CAN 2.0 frames
      <can_id>##<flags>{data}    for CAN FD frames

<can_id> can have 3 (SFF) or 8 (EFF) hex chars {data} has 0..8 (0..64
CAN FD) ASCII hex-values (optionally separated by '.') <flags> a
single ASCII Hex value (0 .. F) which defines canfd_frame.flags

e.g. 5A1#11.2233.44556677.88 / 123#DEADBEEF / 5AA# / 123##1 / 213##311
       1F334455#1122334455667788 / 123#R for remote transmission request.





       d) TCAN332G (CAN FD Transceiver) can support 5Mbps at data phase in CAN FD mode.
Current supported maximum bitrate in the driver is now 1Mbps at nominal rate.
(FYI, bit rate in data phase at CAN FD protocol is up to 8Mbps)
          Where: BITRATE  := { 1..1000000 }
                    SAMPLE-POINT  := { 0.000..0.999 }
                    TQ            := { NUMBER }
                    PROP-SEG      := { 1..8 }
                    PHASE-SEG1    := { 1..8 }
                    PHASE-SEG2    := { 1..8 }
                    SJW           := { 1..4 }
                    RESTART-MS    := { 0 | NUMBER }



3) What doesn't work exactly?

I would like to send and receive messages in CAN FD with Bit Rate Switching (Arbitration phase: 1Mbps, Data phase: 5Mbps).
So far, CAN FD mode doesn't turn on with above commands.

Thanks,
Jin


-----Original Message-----
From: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
Sent: Thursday, November 19, 2020 11:11 PM
To: Jin Park <jpark@xxxxxxxxxxxxxxxxx>;
manivannan.sadhasivam@xxxxxxxxxx
Subject: Re: Question on CAN FD Driver for mcp251xfd

Hello Jin Park,

please use the linux-can mailing list (linux-can@xxxxxxxxxxxxxxx) for community question. There are other people interested in these question, please add list on Cc.

On 11/20/20 4:03 AM, Jin Park wrote:
I am using MCP251XFD SPI-CAN Network Driver with VAR-SOM-MX8M-NANO
board now and would like to ask whether it can support CAN FD features as well.

Yes it does support CAN-FD.

I tried to command with CAN FD features in terminal and it didn’t
work with CAN FD commands.

Which commands have you tried?
What are the error messages?
What doesn't work exactly?

Is there any plan to release CAN FD Linux Driver in the future, if
you have worked on CAN FD?

It should be working.

Marc




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux