CAN communication with 500kbps bitrate

I have the sample Qt app which receives and transmit CAN messages and I am using CAN simulator for Tx and Rx CAN messages.
The following command used to set the bitrate 250kbps.

  • ip link set up can1 type can bitrate 250000 restart-ms 100
  • ip link set can1 up

The sample App works perfectly fine for 250 kbps but for 500kbps am getting an error stating “bus-off” in CAN simulator.
( ip link set up can1 type can bitrate 500000 restart-ms 100)

Am I missing any steps ? should I need to configure anything to hardware or Qt App to have CAN communication with 500kbps bitrate?

More details of CAN config:

ip -details link show can1                                                    
3: can1:  mtu 16 qdisc pfifo_fast state UNKNOWN mode DE0
    link/can  promiscuity 0                                                     
    can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 100              
          bitrate 250000 sample-point 0.866                                     
          tq 266 prop-seg 6 phase-seg1 6 phase-seg2 2 sjw 1                     
          flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1         
          clock 30000000numtxqueues 1 numrxqueues 1

hi @mohi

Could you provide output of the command cat /etc/issue?

I tried to set up a speed of 500kbps and this is working fine. This is what I get:

3: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
link/can  promiscuity 0 
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 100 
      bitrate 500000 sample-point 0.866 
      tq 133 prop-seg 6 phase-seg1 6 phase-seg2 2 sjw 1
      flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
      flexcan: dtseg1 1..39 dtseg2 1..8 dsjw 1..8 dbrp 1..1024 dbrp-inc 1
      clock 30000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535  

I am using CAN simulator for Tx and Rx CAN messages.

Are you using a CAN Transceiver? If yes, could you provide a datasheet of the transceiver?

Best regards,
Jaski

hi @jaski.tx

1). The CAN config details after setting up CAN speed to 500kps is as follows:
 # ip -details link show can1  
3: can1:  mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 100 
          bitrate 500000 sample-point 0.866 
          tq 133 prop-seg 6 phase-seg1 6 phase-seg2 2 sjw 1
          flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
          clock 30000000numtxqueues 1 numrxqueues 1 

2). The CAN config details after trying to Tx/Rx CAN messages.
# ip -details link show can1  

3: can1:  mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0
    can state ERROR-WARNING (berr-counter tx 0 rx 131) restart-ms 100
          bitrate 500000 sample-point 0.866
          tq 133 prop-seg 6 phase-seg1 6 phase-seg2 2 sjw 1
          flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
          clock 30000000numtxqueues 1 numrxqueues 1 

Are you using a CAN Transceiver? If yes, could you provide a datasheet of the transceiver?

I’m using Pcan view, the datasheet/user manual can be found here:

Here , the main issue is with obtaining sample-point above 0.866, for which we need to change the clock from 30000000 to 40000000. Could you please let us know how to change this?

The output of command cat /etc/issue is :

# cat /etc/issue
welcome to buildroot
#

other than this am not able to see any text/info

Hi mohi,
Thanks for your Input.

Here , the main issue is with obtaining sample-point above 0.866, for which we need to change the clock from 30000000 to 40000000. Could you please let us know how to change this?

Which clock are you talking about?
Could you use install one of the Toradex Images with Qt included and check if you still see the issue there?

Best regards,
Jaski

In CAN config details

# ip -details link show can1  
 3: can1:  mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
     link/can  promiscuity 0
     can state ERROR-WARNING (berr-counter tx 0 rx 131) restart-ms 100
           bitrate 500000 sample-point 0.866
           tq 133 prop-seg 6 phase-seg1 6 phase-seg2 2 sjw 1
           flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
           clock 30000000numtxqueues 1 numrxqueues 1 

It show the clock value
"clock 30000000numtxqueues 1 numrxqueues 1 "

How to change this value to 40000000 ??

hi @mohi

Why would you like to change this? Are you having any issues regarding the CAN communication?

Best regards,
Jaski

I need to change this clock value to have the sample-point more than 0.866.
with current configuration CAN communication is not happening.

hi @mohi

Sorry for the late reply. Please have a look here.

Best regards,
Jaski