Setting up can interface for FD using bitrate tseg etc

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
noorulj@gmail.com
Posts: 2
Joined: Mon 26. Aug 2019, 13:33

Setting up can interface for FD using bitrate tseg etc

Post by noorulj@gmail.com » Mon 26. Aug 2019, 13:42

I am trying to send and receive can frames
OS : Ubuntu 16.04
using socketcan or canutils

to set up the can interface
i am using the command
ip link can0 set type can bitrate 500000 dbitrate 2000000 fd on
ip link can0 set can0 up

I have verified the sending and receiving from windows using pcan example gui application comes from pcan-basic package. The parameters i pass to the gui is
can_fd_init_str = "f_clock_mhz=20, nom_brp=5, nom_tseg1=5, nom_tseg2=2, nom_sjw=1, data_brp=2, data_tseg1=3, data_tseg2=1, data_sjw=1"

It works.

In ip link , i dont see the option to set the same params it has other params as prop_seg etc.
How to set the above params in the way ip link expects.

When i set the
ip link can0 set type can bitrate 500000 dbitrate 2000000 fd on
the params computed are as below

9: can0: <NOARP,UP,LOWER_UP> mtu 72 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
can <FD> state ERROR-ACTIVE restart-ms 0
bitrate 500000 sample-point 0.750
tq 12 prop-seg 59 phase-seg1 60 phase-seg2 40 sjw 1
pcan: tseg1 1..256 tseg2 1..128 sjw 1..128 brp 1..1024 brp-inc 1
dbitrate 2000000 dsample-point 0.800
dtq 12 dprop-seg 15 dphase-seg1 16 dphase-seg2 8 dsjw 1
pcan: dtseg1 1..32 dtseg2 1..16 dsjw 1..16 dbrp 1..1024 dbrp-inc 1
clock 80000000

I think as the params are not matching the communication is not happenning... Sending frames are working, only receiving is not working.

In windows also i have seen the similar issue of not receiving when there was mismatch in the confiugration...

So i need to know how to set up the
can_fd_init_str = "f_clock_mhz=20, nom_brp=5, nom_tseg1=5, nom_tseg2=2, nom_sjw=1, data_brp=2, data_tseg1=3, data_tseg2=1, data_sjw=1"
this configuration in the way
ip link cmd expects.

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: Setting up can interface for FD using bitrate tseg etc

Post by M.Maidhof » Wed 28. Aug 2019, 09:20

Hi,

please have a look on the SocketCAN documenation on that link:

https://www.kernel.org/doc/Documentatio ... ng/can.txt

regards

Michael

Post Reply