AnsweredAssumed Answered

i.MX6 FlexCAN linux 3.0.35-4.1.0 yocto

Question asked by timl on Nov 28, 2014
Latest reply on Oct 26, 2016 by tang yuan

Hi all,

I have a custom i.MX6 board and I want to use the CAN port.

I have a TJA1042 transceiver in normal mode (Standby wired to LOW not a GPIO control) [TJA1042 has 8 pins : CANH CANL TX(goes on TX i.mx6) RX(goes on RX i.mx6) VCC GND STB SPLIT/VIO]

I built an image with the can utils. I tested the can-bus with a can receiver and a can sender. My sender and receiver are tested, the receiver display what the sender "says".

When I activate the canbus on my board I got that :


root@imx6qsabresd:~# dmesg | grep CAN
vcan: Virtual CAN interface driver
CAN device driver interface
root@imx6qsabresd:~# dmesg | grep can
vcan: Virtual CAN interface driver
flexcan netdevice driver
flexcan imx6q-flexcan.1: device registered (reg_base=c09b8000, irq=143)
can: controller area network core (rev 20090105 abi 8)
can: raw protocol (rev 20090105)
can: broadcast manager protocol (rev 20090105 t)

//First method
root@imx6qsabresd:~# canconfig can0 bitrate 500000
can0 bitrate: 500000, sample-point: 0.866
root@imx6qsabresd:~# ifconfig can0 up
flexcan imx6q-flexcan.1: writing ctrl=0x03292005

//Second method
root@imx6qsabresd:~# ip link set can0 up type can bitrate 500000
flexcan imx6q-flexcan.1: writing ctrl=0x03292005
root@imx6qsabresd:~# ifconfig can0 up

root@imx6qsabresd:~# ifconfig
can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          UP RUNNING NOARP  MTU:16  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)


When I try to send a can message I got this

root@imx6qsabresd:~# cansend can0 500#1E.10.10
interface = can0, family = 29, type = 3, proto = 1

But nothing happen on the bus (receiver doesn't have any message and there is no activity on the oscilloscope on CANL/CANH or on TX line to transceiver)

When I repeat cansend about 12 times I finally got an error

root@imx6qsabresd:~# cansend can0 500#1E.10.10
interface = can0, family = 29, type = 3, proto = 1
write: No buffer space available


When I try to read a can message I got no activity whereas I see signal with oscilloscope on CANL CANH and RX line

root@imx6qsabresd:~# candump can0
interface = can0, family = 29, type = 3, proto = 1


I modifiy the kernel3.0.35-4.1.0/arch/arm/mach-mx6/board_myboard.c modifcations are inspired from sabrelite and sabreauto boards

static iomux_v3_cfg_t mx6q_etsjq7_pads[] = {
// ...
/* CAN1 */

static void mx6q_etsjq7_flexcan1_switch(int enable)

static const struct flexcan_platform_data
    mx6q_etsjq7_flexcan1_pdata __initconst = {
    .transceiver_switch = mx6q_etsjq7_flexcan1_switch,