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.

AM3358: CAN transceiver bring up through AM335X DCAN interface unssuccessful

Part Number: AM3358

Hello,


We are trying to bring up CAN 2.0 on our AM335x MPU. However, we are not able to establish CAN communication using CAN-USB Peak CAN adapter connect to a host.

 

When we probe the CAN Transceiver Tx line while sending a "cangen can0" from the Linux command line, we see no activity on r Tx line.

 

Similarly, when we send can messages from our PEAK View App on the host pc to the board, we are able to see acitivity on the Rx line of the receiver but "candump can0" returns no messages.

 

Our CAN transceiver configuration can be found below:

 ...

&dcan0 {

    status = "okay";

    pinctrl-names = "default";

    pintcrl-0 = <&dcan_pins_default>;

 

    can-transceiver {

        max-bitrate=<1000000>;

    };

};

can_pins_default: can_pins_default {

pinctrl-single,pins = <

AM33XX_IOPAD(0x97c, PIN_INPUT | MUX_MODE2) /* (D17) uart1_rtsn.dcan0_rx */

AM33XX_IOPAD(0x978, PIN_OUTPUT | MUX_MODE2) /* (D18) uart1_ctsn.dcan0_tx */

AM33XX_IOPAD(0x980, PIN_OUTPUT | MUX_MODE7) /* (D16) uart1_rxd.gpio0[14] (RS Pin) */

AM33XX_IOPAD(0x984, PIN_OUTPUT | MUX_MODE7) /* (D15) uart1_txd.gpio0[15]  (Loopback pin) */

>;

};

 

We are initializing our can0 bus with the following commands:

 

ip link set can0 type can bitrate 500000

ip link set can0 up

We also make sure the loopback pin is low, by manually setting the gpio0[15] to 0 through /sys/class/gpio

 

Below is our Linux version and can debug message output:

Linux version 5.10.0-rc6-g9e977d2b4674-dirty

[    3.019334] c_can_platform 481cc000.can: c_can_platform device registered (regs=607695bf, irq=37)

[    3.309513] can: controller area network core

[    3.318533] can: raw protocol

[    3.321521] can: broadcast manager protocol

[    3.325757] can: netlink gateway - max_hops=1

[    4.367040] mcp251xfd spi0.0 can1: MCP2518FD rev0.0 (-RX_INT -MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD c:40.00MHz m:16.66MHz r:16.66MHz e:0.00MHz) successfully initialized.

[   12.408398] ubi0: scanning is finished

[   47.339691] c_can_platform 481cc000.can can0: setting BTR=0209 BRPE=0000

[   47.346821] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready

  • Hi,

    Which Linux SDK is being used here?

    What does ifconfig -a show?

    This line is indicating a CAN connected to the SPI interface.

    mcp251xfd spi0.0 can1: MCP2518FD rev0.0 (-RX_INT -MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD c:40.00MHz m:16.66MHz r:16.66MHz e:0.00MHz) successfully initialized.

    Could you please describe your system or attach a block diagram?

    Best Regards,

    Schuyler

  • Hi,

    We are not using a Linux SDK. The Linux version is mainstream 5.10 not a TI version. 

    We have 1 CAN controller over SPI which working fine. (Ignore this one)

    And we have 1 CAN transceiver connected to the Sitara through the Sitara DCAN0 can interface.

    On the left you have the can connections going to the AM335x chip and on the right the actual Can transceiver.

    Here is the can node from ifconfig -a 

    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:37

    When we cansend or cangen, the TX packets still shows 0

  • Hi,

    Please attach the results to these commands. It looks like the driver is correct but as you point out no traffic on the TX line. The first command will show the state of the line. 

    ip -d -s link show can0
    cat /proc/net/can/stats

    Best Regards.

    Schuyler

  • # ip -d -s link show can0
    2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
    link/can promiscuity 0 minmtu 0 maxmtu 0
    can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
    bitrate 500000 sample-point 0.800
    tq 400 prop-seg 1 phase-seg1 2 phase-seg2 1 sjw 1
    c_can: tseg1 2..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp-inc 1
    clock 25000000
    re-started bus-errors arbit-lost error-warn error-pass bus-off
    0 0 0 0 0 0 numtxqueues 1 gso_max_size 65536 gso_max_segs 65535
    RX: bytes packets errors dropped overrun mcast
    0 0 0 0 0 0
    TX: bytes packets errors dropped carrier collsns
    0 0 0 0 0 0

    # cat /proc/net/can/stats

    20 transmitted frames (TXF)
    0 received frames (RXF)
    0 matched frames (RXMF)

    0 % total match ratio (RXMR)
    0 frames/s total tx rate (TXR)
    0 frames/s total rx rate (RXR)

    0 % current match ratio (CRXMR)
    0 frames/s current tx rate (CTXR)
    0 frames/s current rx rate (CRXR)

    0 % max match ratio (MRXMR)
    6 frames/s max tx rate (MTXR)
    0 frames/s max rx rate (MRXR)

    0 current receive list entries (CRCV)
    0 maximum receive list entries (MRCV)