AnsweredAssumed Answered

CAN-Communication with LS1021A REV. 1.0 and TWR-IND-IO

Question asked by Jonathan Weinert on Jun 5, 2017
Latest reply on Jun 7, 2017 by Jonathan Weinert

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 BobadeLS1021A Rev2: CAN communication not working using TWR-IND-IO 

The SDK I use is the sdk1.8-yocto-preinstalled VM. 

I did these things:

  1. Sourced the fsl-arm-poky.sh-script with "-m ls1021atwr"
  2. edited in fsl-arm-networking the u-boot-settings to sdcard
  3. added can-utils to IMAGE_INSTALL
  4. ran bitbake fsl-image-minimal
  5. activated kernel-options with bitbake linux-ls1 -c menuconfig
    1. CAN bus subsystem support
    2. Raw CAN Protocol (raw access with CAN-ID filtering)
    3. Platform CAN drivers with Netlink support
    4. CAN bit-timing calculation
    5. Support for NXP FlexCAN based chips
  6.  device-tree in path ls1021a.dtsi:
    • this file contains these lines:
      • can0: can@2a70000 {
        compatible = "fsl,ls1021a-flexcan";
        reg = <0x0 0x2a70000 0x0 0x1000>;
        interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
        clocks = <&platform_clk 1>;
        clock-frequency = <150000000>;
        clock-names = "per";
        little-endian;
        status = "disabled";
        };
    • i added in the ls1021a-twr.dts:
      • &can0 {
        status = "okay";
        };
      • &can1 {
        status = "okay";
        };
  7. Recompiled the kernel that the changes are included.
  8. flashed u-boot to sd-card
  9. extracted rootfs on to the ext2-partition
  10. booted u-boot with hwconfig = "can"

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.

Outcomes