Page 1 of 1

Adapter settings verification

Posted: Mon 13. May 2019, 10:19
by A. Cristea
Hi,

I'm trying to find out if my adapter settings are correct because i have sometimes errors when sending messages. I use the PCAN-miniPCIe (IPEH-003049) on Ubuntu 16.04 with socketcan.

in /etc/network/interfaces it is set up like:

Code: Select all

auto can0
  iface can0 inet manual
  pre-up /sbin/ip link set can0 type can bitrate 250000 restart-ms 75
  up /sbin/ifconfig can0 up
  down /sbin/ifconfig can0 down
Resulting to this:

Code: Select all

$ ip -details link show can0
4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 75 
	  bitrate 250000 sample-point 0.875 
	  tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
	  sja1000: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
	  clock 8000000
How can i verify that SAMPLE_POINT, TQ, PROP-SEG, PHASE-SEG1, ... are set correctly for my adapter?

Thanks,
Best regards

Re: Adapter settings verification

Posted: Mon 13. May 2019, 10:35
by M.Maidhof
Hi,

best solution will be to set the bitrate parameters to the exact values of your CAN bus system, to which you connect the device.

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

Section 6.5.1 on how to set the parameters.

regards

Michael

Re: Adapter settings verification

Posted: Mon 13. May 2019, 12:16
by A. Cristea
Hi,

so if I set up as I did, there is no need to care about the used chip (sja1000?) and the used oscillator frequency inside the adapter?

br

Re: Adapter settings verification

Posted: Mon 13. May 2019, 13:57
by M.Maidhof
Hi,

oscillator frequency will only be relevant for PCAN-FD hardware, but not for SJA1000 based CAN hardware (oscillator frequency fixed on 8Mhz). But you still have to take care for samplepoint, sjw etc. with SJA1000 based CAN hardware.

In your setup you use a sp of 87,5%, try to use a sp of 75% instead.

regards

Michael