Hey,
I'm trying to get the can-interface working on the LS1021A-TWR REV1.0 with TWR-IND-IO with J13,14 bridged. Unfortunately it's not working.
The problem is similiar like this question of shrikant_bobade@mentor.com: LS1021A Rev2: CAN communication not working using TWR-IND-IO
The SDK I use is the sdk1.8-yocto-preinstalled VM.
I did these things:
The uboot-log is:
U-Boot 2015.01+ls1+g6ba8eed (Jun 02 2017 - 19:14:34)
CPU: Freescale LayerScape UnknownE, Version: 1.0, (0x87081310)
Clock Configuration:
CPU0(ARMV7):1000 MHz,
Bus:300 MHz, DDR:800 MHz (1600 MT/s data rate),
Reset Configuration Word (RCW):
00000000: 0608000a 00000000 00000000 00000000
00000010: 20000000 00407900 60040a00 21046000
00000020: 00000000 00000000 00000000 00038000
00000030: 00080000 881b7340 00000000 00000000
with these variables:
baudrate=115200
bootargs=root=/dev/ram0 rw console=ttyS0,115200
bootcmd=setenv bootargs root=/dev/mmcblk0p2 rw rootdelay=0 console=$consoledev,$baudrate;mmcinfo;ext2load mmc 0:2 $loadaddr /boot/$bootfile;ext2load mmc 0:2 $fdtaddr /boot/$fdtfile;bootm $loadaddr - $fdtaddr
bootdelay=3
bootfile=uImage.bin
consoledev=ttyS0
ethact=eTSEC1
ethaddr=00:04:9F:03:5C:1B
ethprime=eTSEC1
fdt_high=0xcfffffff
fdtaddr=8f000000
fdtfile=uImage.dtb
hwconfig=can
initrd_high=0xcfffffff
ipaddr=192.168.1.3
loadaddr=82000000
scsidevs=0
serverip=192.168.1.2
stderr=serial
stdin=serial
stdout=serial
After the boot I get: dmesg | grep can
[ 11.120958] flexcan 2a70000.can: Looking up xceiver-supply from device tree
[ 11.120974] flexcan 2a70000.can: Looking up xceiver-supply property in node /soc/can@2a70000 failed
[ 11.121003] flexcan 2a70000.can (unregistered net_device): Legacy mode (non-RX FIFO) supported
[ 11.128877] flexcan 2a70000.can: device registered (reg_base=c0836000, irq=158)
[ 11.135005] flexcan 2a80000.can: Looking up xceiver-supply from device tree
[ 11.135019] flexcan 2a80000.can: Looking up xceiver-supply property in node /soc/can@2a80000 failed
[ 11.135042] flexcan 2a80000.can (unregistered net_device): Legacy mode (non-RX FIFO) supported
[ 11.142838] flexcan 2a80000.can: device registered (reg_base=c0838000, irq=159)
[ 12.195962] can: controller area network core (rev 20120528 abi 9)
[ 12.204077] can: raw protocol (rev 20120528)
and ifconfig -a gives me:
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
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:158
can1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
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:159
eth0 Link encap:Ethernet HWaddr 00:04:9F:03:5C:1B
UP BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth1 Link encap:Ethernet HWaddr 00:00:00:00:00:00
BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth2 Link encap:Ethernet HWaddr 00:00:00:00:00:00
BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 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:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
I made the Internal LoopBack test (SoC Level loopback) and this worked.
Then I tried the External LoopBack test (Single Board) and this didn't work.
For that i bridged the CAN0 to CAN1 with jumper-cables like in the picture.
The outputs are:
root@ls1021atwr:~# ip link set can0 up type can bitrate 125000
flexcan 2a70000.can can0: writing ctrl=0x4a312005
root@ls1021atwr:~# ip link set can1 up type can bitrate 125000
flexcan 2a80000.can can1: writing ctrl=0x4a312005
root@ls1021atwr:~# candump can0 -n 1 &
[1] 622
root@ls1021atwr:~# cansend can1 5A1#123412341234
flexcan 2a80000.can can1: XMIT done
dmesg gives me:
[ 1026.445135] flexcan 2a70000.can can0: writing ctrl=0x4a312005
[ 1041.034854] flexcan 2a80000.can can1: writing ctrl=0x4a312005
[ 1055.224920] flexcan 2a80000.can can1: XMIT done
ifconfig gives me:
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:158
can1 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:159
It would be great, if someone could help me with this. I need this for my bachelore-thesis in order to get to the main topic.
Best regards,
Jonathan W.
After some digging into the device-tree i activated can2 and can3.
And now i got the can-bus working. There should be a hint somewhere that you need 2a90000.can and 2aa0000.can for the TWR-IND-IO with the LS1021A REV1.0.
Now I have a new problem:
I can send a frame to the computer, but I can't receive frames from the computer.
Maybe the reason is this line: [ 11.135042] flexcan 2a90000.can (unregistered net_device): Legacy mode (non-RX FIFO) supported
I would be nice if someone could help me with this problem.
Thank you.
Jonathan W.
Test your setting using the Section 7.7 of NXP SDK 2.0-1703 documentation:
http://www.nxp.com/assets/documents/data/en/supporting-information/QORIQ-SDK-2.0-IC-REV0.pdf
Use this Section for FlexCAN testing on the LS1021A-TWR REV1.0 board.
Have a great day,
Pavel Chubakov
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello,
thank you for your fast response.
I have already followed these instructions and as i wrote it didn't work.
Only one thing is different:
The instruction says:
root@ls1021aqds:~# cat /proc/interrupts
CPU0 CPU1
118: 3889 0 GIC 118 serial
120: 126 0 GIC 120 2180000.i2c
Linux Kernel Drivers
FlexCAN
QorIQ SDK V2.0-1703 Documentation, Rev. 0, Mar 2017
NXP Semiconductors 1093
125: 0 0 GIC 125 xhci-hcd:usb1
126: 1521 0 GIC 126 mmc0
129: 0 0 GIC 129 2110000.dspi
135: 2 0 GIC 135 1710000.jr
136: 0 0 GIC 136 1720000.jr
137: 0 0 GIC 137 1730000.jr
138: 0 0 GIC 138 1740000.jr
150: 5371 0 GIC 150 Freescale ftm timer
158: 1 0 GIC 158 can0
167: 0 0 GIC 167 eDMA
189: 21 0 GIC 189 eth2_g0_tx
190: 4 0 GIC 190 eth2_g0_rx
191: 0 0 GIC 191 eth2_g0_er
201: 0 0 GIC 201 ds3232
IPI0: 0 0 CPU wakeup interrupts
IPI1: 0 5359 Timer broadcast interrupts
IPI2: 3158 3718 Rescheduling interrupts
IPI3: 0 0 Function call interrupts
IPI4: 3 3 Single function call interrupts
IPI5: 0 0 CPU stop interrupts
Err: 0
But in my case before ip link set can0 up type can bitrate 125000 loopback on there isn't any canx:
root@ls1021atwr:~# cat /proc/interrupts
CPU0 CPU1
29: 0 0 GIC 29 arch_timer
30: 575 940 GIC 30 arch_timer
107: 0 0 GIC 107 fsl-ifc
118: 159 0 GIC 118 serial
120: 0 0 GIC 120 2180000.i2c
121: 0 0 GIC 121 2190000.i2c
122: 0 0 GIC 122 21a0000.i2c
125: 57 0 GIC 125 xhci-hcd:usb1
126: 1012 0 GIC 126 mmc0
133: 0 0 GIC 133 ahci
135: 2 0 GIC 135 1710000.jr
136: 0 0 GIC 136 1720000.jr
137: 0 0 GIC 137 1730000.jr
138: 0 0 GIC 138 1740000.jr
167: 0 0 GIC 167 eDMA
204: 0 0 GIC 204 fsl-dcu-fb
211: 0 0 GIC 211 ls-pcie-msi
212: 0 0 GIC 212 ls-pcie-msi
IPI0: 0 1 CPU wakeup interrupts
IPI1: 0 0 Timer broadcast interrupts
IPI2: 678 705 Rescheduling interrupts
IPI3: 0 0 Function call interrupts
IPI4: 4 3 Single function call interrupts
IPI5: 0 0 CPU stop interrupts
Err: 0
Only when I initialise the can-interface I get the entries:
root@ls1021atwr:~# cat /proc/interrupts
CPU0 CPU1
29: 0 0 GIC 29 arch_timer
30: 1618 3491 GIC 30 arch_timer
107: 0 0 GIC 107 fsl-ifc
118: 497 0 GIC 118 serial
120: 0 0 GIC 120 2180000.i2c
121: 0 0 GIC 121 2190000.i2c
122: 0 0 GIC 122 21a0000.i2c
125: 57 0 GIC 125 xhci-hcd:usb1
126: 1148 0 GIC 126 mmc0
133: 0 0 GIC 133 ahci
135: 2 0 GIC 135 1710000.jr
136: 0 0 GIC 136 1720000.jr
137: 0 0 GIC 137 1730000.jr
138: 0 0 GIC 138 1740000.jr
158: 0 0 GIC 158 can0
159: 0 0 GIC 159 can1
167: 0 0 GIC 167 eDMA
204: 0 0 GIC 204 fsl-dcu-fb
211: 0 0 GIC 211 ls-pcie-msi
212: 0 0 GIC 212 ls-pcie-msi
IPI0: 0 1 CPU wakeup interrupts
IPI1: 0 0 Timer broadcast interrupts
IPI2: 698 720 Rescheduling interrupts
IPI3: 0 0 Function call interrupts
IPI4: 4 3 Single function call interrupts
IPI5: 0 0 CPU stop interrupts
Err: 0
Does it behave in the right way?
In addtition if I send many times the can-frame, I get this failure:
write: No buffer space available
Maybe there is a hardware problem?
Thanks,
Jonathan W.