i.MX6 FlexCAN linux 3.0.35-4.1.0 yocto

cancel
Showing results for 
Search instead for 
Did you mean: 

i.MX6 FlexCAN linux 3.0.35-4.1.0 yocto

Jump to solution
5,994 Views
timl
Contributor II

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)

          Interrupt:143

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 */

MX6Q_PAD_GPIO_7__CAN1_TXCAN,

MX6Q_PAD_GPIO_8__CAN1_RXCAN,

//...

};

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,

   

};

imx6q_add_flexcan1(&mx6q_etsjq7_flexcan1_pdata);

Labels (3)
0 Kudos
1 Solution
1,257 Views
timl
Contributor II

Hi,

Problem solved.

To build my kernel I followed this DOC

but I made a mistake because I have to init flexcan0 and not flexcan1.

View solution in original post

0 Kudos
6 Replies
1,257 Views
tangyuan
Contributor III

HI:

   timl,Can you give me some advise here:https://community.nxp.com/thread/437311 

0 Kudos
1,257 Views
tangyuan
Contributor III

HI

   timl,I've come across this problem.Can you give me some advise.

0 Kudos
1,258 Views
timl
Contributor II

Hi,

Problem solved.

To build my kernel I followed this DOC

but I made a mistake because I have to init flexcan0 and not flexcan1.

0 Kudos
686 Views
adamhuang
Contributor III

Access Denied
You don't have permission to access "http://www.nxp.com=ns-404=docs=DOC-94887" on this server.
Reference #18.ae0ae07a.1627451656.2c36f3f0

0 Kudos
687 Views
adamhuang
Contributor III

Access Denied
You don't have permission to access "http://www.nxp.com\/ns-404\/docs\/DOC-94887" on this server.
Reference #18.ae0ae07a.1627451656.2c36f3f0

0 Kudos
1,257 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

Have you checked this? I believe it can be very useful to realize the needed changes.

https://community.freescale.com/message/302837#302837

Regards,

Alejandro

0 Kudos