Hi all!
I have configured my Colibri Evaluation Board V3.2B to work with FLEXCAN.
Following this and this , configured the kernel CAN system as:
root@colibri-imx6:~# zcat /proc/config.gz | grep CAN
CONFIG_CAN=y
CONFIG_CAN_RAW=y
CONFIG_CAN_BCM=y
# CONFIG_CAN_GW is not set
# CAN Device Drivers
CONFIG_CAN_VCAN=y
CONFIG_CAN_DEV=y
CONFIG_CAN_CALC_BITTIMING=y
# CONFIG_CAN_LEDS is not set
CONFIG_CAN_FLEXCAN=y
# CAN SPI interfaces
# CONFIG_CAN_MCP251X is not set
CONFIG_CAN_DEBUG_DEVICES=y
These are the kernel messages relate to ca at sysem startup:
root@colibri-imx6:~# dmesg | grep can
[ 0.257640] i2c i2c-1: can't use DMA, using PIO instead.
[ 0.258671] i2c i2c-2: can't use DMA, using PIO instead.
[ 1.401490] vcan: Virtual CAN interface driver
[ 1.414090] 2090000.flexcan supply xceiver not found, using dummy regulator
[ 1.424136] flexcan 2090000.flexcan: gpr /soc/aips-bus@02000000/iomuxc-gpr@020e0000 req_gpr 0x34 req_bit 28 ack_gpr 0x10 ack_bit 17
[ 1.424226] flexcan 2090000.flexcan: device registered (reg_base=a09dc000, irq=35)
[ 2.375638] snvs-secvio 20cc000.caam-snvs: can't get snvs clock
[ 2.430579] can: controller area network core (rev 20120528 abi 9)
[ 2.452718] can: raw protocol (rev 20120528)
[ 2.458505] can: broadcast manager protocol (rev 20161123 t)
Others stuff:
root@colibri-imx6:~#uname -a
Linux colibri-imx6 4.9.87-rt62+g3bb6e32 #9 SMP PREEMPT RT Thu Jul 11 11:26:57 CEST 2019 armv7l GNU/Linux
root@colibri-imx6:~# ls -l /sys/class/net/can0/device
lrwxrwxrwx 1 root root 0 Jul 11 09:37 /sys/class/net/can0/device -> ../../../2090000.flexcan
I set up the can0 with the command:
# ip link set can0 up type can bitrate 125000 berr-reporting on
[ 3490.157019] IPv6: ADDRCONF(NETDEV_UP): can0: link is not ready
[ 3490.164984] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
the ip details are:
root@colibri-imx6:~# ip -details link show can0
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0
can <BERR-REPORTING> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 125000 sample-point 0.875
tq 500 prop-seg 6 phase-seg1 7 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 gso_max_size 65536 gso_max_segs 65535
and the dmesg messages related are:
[ 4177.654054] flexcan 2090000.flexcan can0: writing ctrl=0x0e312055
[ 4177.654087] flexcan 2090000.flexcan can0: flexcan_set_bittiming: mcr=0x5980000f ctrl=0x0e312055
[ 4177.654112] flexcan 2090000.flexcan can0: flexcan_chip_start: writing mcr=0x7de20209
[ 4177.654133] flexcan 2090000.flexcan can0: flexcan_chip_start: writing ctrl=0x0e312055
[ 4177.654211] flexcan 2090000.flexcan can0: flexcan_chip_start: reading mcr=0x64e20209 ctrl=0x0e31ec55
[ 4177.663267] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
Well, if I do:
root@colibri-imx6:~# cansend can0 -i 0x1F 0x11 0x22 0x33 0x44 0x55 0x55 0x77 0x88
interface = can0, family = 29, type = 3, proto = 1
and the dmesg message are:
[ 4275.460024] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.460186] flexcan 2090000.flexcan can0: New error state: 2
[ 4275.460222] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.460351] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.460528] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.460733] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.460944] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.461163] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.461367] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.461568] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.461810] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.461998] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.462207] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.462429] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.462629] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.462833] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.463029] flexcan 2090000.flexcan can0: BIT0_ERR irq
[ 4275.463240] flexcan 2090000.flexcan can0: New error state: 3
[ 4275.463264] flexcan 2090000.flexcan can0: bus-off
[ 4275.463323] flexcan 2090000.flexcan can0: BIT0_ERR irq
root@colibri-imx6:~#
With the oscilloscope on SODIMM55, I see the TX level going down and high,
but nothing appear in the output of “candump can0”.
Relaunching the previous command, nothing appears on oscilloscope, and noting else in the dmesg output.
Someone have some idea?
Thank you.
F.