This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/DRA756: dra756 custom board: The DCAN device does not work properly

Part Number: DRA756

Tool/software: Linux

Hi,

i have a problem with dcan module, the problem is that the Data can only be sent successfully in loopback mode.

No data can be received except data that is self-sending in loop mode.

the following code is the pin configuration of device tree.

	dcan1_pins_ds: pinmux_dcan1_pins_ds {
		pinctrl-single,pins = <
			DRA7XX_CORE_IOPAD(0x37d4, PIN_INPUT | MUX_MODE15) 	/* (Errata i893) dcan1_rx.dcan1_rx */
			DRA7XX_CORE_IOPAD(0x37d0, PIN_OUTPUT | MUX_MODE0) 	/* dcan1_tx.dcan1_tx */
		>;
	};

	dcan2_pins_ds: pinmux_dcan2_pins_ds {
		pinctrl-single,pins = <
			DRA7XX_CORE_IOPAD(0x37bc, PIN_INPUT | MUX_MODE15) 	/* (Errata i893) spi1_cs3.dcan2_rx */
			DRA7XX_CORE_IOPAD(0x37b8, PIN_OUTPUT | MUX_MODE4) 	/* spi1_cs2.dcan2_tx */
		>;
	};

following log tells what i did>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

root@dra7xx-evm:~# ./setup_can_bus.sh 0
[  103.055836] c_can_platform 4ae3c000.can can0: setting BTR=0504 BRPE=0000
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 
	  bitrate 500000 sample-point 0.875 
	  tq 250 prop-seg 3 phase-seg1 3 phase-seg2 1 sjw 1
	  c_can: tseg1 2..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp-inc 1
	  clock 20000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
root@dra7xx-evm:~# 
root@dra7xx-evm:~# 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:87 

eth0      Link encap:Ethernet  HWaddr 38:0B:3C:40:EA:44  
          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)
          Interrupt:84 

eth1      Link encap:Ethernet  HWaddr 38:0B:3C:40:EA:45  
          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)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1%763612/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:162 errors:0 dropped:0 overruns:0 frame:0
          TX packets:162 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:12300 (12.0 KiB)  TX bytes:12300 (12.0 KiB)

root@dra7xx-evm:~# cansend can0 123#1122334455
root@dra7xx-evm:~# 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:87 

eth0      Link encap:Ethernet  HWaddr 38:0B:3C:40:EA:44  
          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)
          Interrupt:84 

eth1      Link encap:Ethernet  HWaddr 38:0B:3C:40:EA:45  
          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)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1%763612/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:162 errors:0 dropped:0 overruns:0 frame:0
          TX packets:162 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:12300 (12.0 KiB)  TX bytes:12300 (12.0 KiB)

root@dra7xx-evm:~# cat setup_can_bus.sh 
#!/bin/sh

#modprobe can
#modprobe can-dev
#modprobe can-raw
#modprobe mcp251x
ip link set can"$1" down
ip link set can"$1" type can bitrate 500000
ip link set can"$1" up
ip -details link show can0
root@dra7xx-evm:~# ip -details link show can0
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 
	  bitrate 500000 sample-point 0.875 
	  tq 250 prop-seg 3 phase-seg1 3 phase-seg2 1 sjw 1
	  c_can: tseg1 2..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp-inc 1
	  clock 20000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
root@dra7xx-evm:~# can
can-calc-bit-timing  candump              cangen               canlogserver         cansend              
canbusload           canfdtest            cangw                canplayer            cansniffer           
root@dra7xx-evm:~# can
can-calc-bit-timing  candump              cangen               canlogserver         cansend              
canbusload           canfdtest            cangw                canplayer            cansniffer           
root@dra7xx-evm:~# can   ip -details link show can0
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 
	  bitrate 500000 sample-point 0.875 
	  tq 250 prop-seg 3 phase-seg1 3 phase-seg2 1 sjw 1
	  c_can: tseg1 2..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp-inc 1
	  clock 20000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 



==============================================================
I also noticed the comment of Errata code in device tree. If it causes the module to not work properly. what should i do? or where can I refer to sample code?

Thank you so much.
  • I also noticed the comment of Errata code in device tree.

    If it causes the module to not work properly. what should i do

    or where can I refer to sample code?

    Thank you so much.

  • Hi,

    https://e2e.ti.com/support/processors/f/791/t/820733 - in this thread you were able to send and receive messages once you corrected the SYSBOOT[9:8] = 0b11.

    Did anything break after that?

    Regards,

    Karan

  • I thought i fixed it but no, it just corrected the clock.

    I tried to send any messages these days but failed.

  • Hello, do you have any idea about it?

  • Hi,

    I tried to replicate what you did on your board, here on the EVM.

    On the EVM I am able to send and receive CAN messages. Following is the log - 

    root@dra7xx-evm:~# ip link set can0 type can bitrate 500000
    root@dra7xx-evm:~# ip link set can0 up
    [ 54.055864] c_can_platform 4ae3c000.can can0: setting BTR=0504 BRPE=0000
    root@dra7xx-evm:~# cansend can0 123#DEADBEEF
    [ 74.296166] can: controller area network core (rev 20170425 abi 9)
    [ 74.302906] NET: Registered protocol family 29
    [ 74.313217] can: raw protocol (rev 20170425)
    root@dra7xx-evm:~# cansend can0 123#DEADBEEF
    root@dra7xx-evm:~# 
    root@dra7xx-evm:~# 
    root@dra7xx-evm:~# candump can0
    can0 000 [8] DE AD BE EF 00 00 00 00
    can0 000 [8] DE AD BE EF 00 00 00 00
    can0 000 [8] DE AD BE EF 00 00 00 00
    can0 000 [8] DE AD BE EF 00 00 00 00
    can0 000 [8] DE AD BE EF 00 00 00 00
    can0 000 [8] DE AD BE EF 00 00 00 00

    The candump can0 shows the packets which I am sending from the HOST PC using the PCAN tool. And on the PCAN tool, I am also able to receive the messages sent using cansend can0 123#DEADBEEF.

    According to the post - the loopback mode works for you, this will work even when your PINMUX is not set up properly.

    1. So the issue could be the PINMUX, can you please check?
    2. How are you sending the messages to the board? Are you using the PCAN tool?

    Also, there was another similar query in the thread - https://e2e.ti.com/support/processors/f/791/p/822843/3046737 

    I'll be closing the other thread but you can have a look at the experiments done in it.

    Regards,
    Karan

  • Hi, Karan, would you like to tell us the detailed steps  you tried on the evm-board?

    The pinmux on the evm is: 0x3d0 ( tx) and 0x418(rx).

    But our pinmux is 0x3d0(tx) and 0x3d4(rx)

    If you tried our pinmux-change on the evm borad, what changes did you do to the hardware and software?

  • Hi,

    I have tried on the EVM with the default PINMUX.

    The steps I followed are - 

    1. Install Processor SDK 5.01
    2. Create the SD card with the prebuilt images from the Processor SDK
    3. Boot the board and run the following -
    4. root@dra7xx-evm:~# ip link set can0 type can bitrate 500000
      root@dra7xx-evm:~# ip link set can0 up
      root@dra7xx-evm:~# cansend can0 123#DEADBEEF
      
      After this you receive the message DEADBEEF on the PCAN tool
      
      Send the CAN message from the PCAN tool and you can see the message on the EVM by doing a candump can0
      
      root@dra7xx-evm:~# cansend can0 123#DEADBEEF
      root@dra7xx-evm:~# candump can0
      can0 000 [8] DE AD BE EF 00 00 00 00
      can0 000 [8] DE AD BE EF 00 00 00 00
      can0 000 [8] DE AD BE EF 00 00 00 00
      can0 000 [8] DE AD BE EF 00 00 00 00
      can0 000 [8] DE AD BE EF 00 00 00 00
      can0 000 [8] DE AD BE EF 00 00 00 00

    Regards,

    Karan

  • Hi, Karan,

    Thanks for your work, we tried to test DCAN module on EVM, too, and it works very well. The problem is that schematic of custom board and evaluation board are different about DCAN module, the following table is detailed configuration about DCAN:

    1.Following code is that we made for DCAN1:

    /* dcan1*/
    
    dcan1_pins_default: dcan1_pins_default {
    
           pinctrl-single,pins = <
    
                  0x3d0     (PIN_OUTPUT_PULLUP | MUX_MODE0) /* dcan1_tx.dcan1_tx */
    
                  0x3d4     (PULL_UP | MUX_MODE0)  /* dcan1_rx.dcan1.rx */
    
           >;
    
    };
    
     
    
    dcan1_pins_sleep: dcan1_pins_sleep {
    
           pinctrl-single,pins = <
    
                  0x3d0     (MUX_MODE15 | PULL_UP) /* dcan1_tx.dcan1_tx */
    
                  0x3d4     (MUX_MODE15 | PULL_UP)  /* dcan1_rx.dcan1.rx */     
    
           >;
    
    };
    
     
    
    …
    
    &dcan1 {
    
           status = "okay";
    
           pinctrl-names = "default", "sleep", "active";
    
           pinctrl-0 = <&dcan1_pins_sleep>;
    
           pinctrl-1 = <&dcan1_pins_sleep>;
    
           pinctrl-2 = <&dcan1_pins_default>;
    
    };

    Please double-check for us if it is correct.

    2. Next, we changed the connection of DCAN1 on EVM board according to schematic of custom board and then reconfigurated the device tree follow the code above. Result is sending and receiving CAN messages failed through EVM board. 

    3. We are confused about the experiment, is there anything wrong with our configuration? Please let us know If you have the sample code about connections of DCAN1 and DCAN2 like our custom board.

    Thanks.

  • Hi,Karan,

    We finally found out it, wrong manufacturing process causes the problem. Thanks a lot!

  • Hi,

    Can you please elaborate on what the issue was?

    Regards,

    Karan

  • Hi, Karan,

    It's caused by cold solder joint.