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.

TCAN4550-Q1: How to enable lookback function ?

Part Number: TCAN4550-Q1


Tool/software:

Hi 

Below are what we done to enable the lookback function, but we can not receive any data. can you help review our steps below if any thing wrong ?

1. We have successful initialized the driver 

      1.350269] tcan4x5x spi0.0 can0: TCAN4X5X successfully initialized.

2. Open CAN0 with below instruction 

    ip link set can0 down

    ip link set can0 type can bitrate 500000 loopback on

    ip link set can0 up

    ip -details link show can0

   candump can0 &

3. send data to CAN0 with below instruction, but we do no see any data at CAN0

cansend can0 123#DEADBEEF

We had checked the loopback was enable correctly but no data at CAN0

below is what we check 

ip link set can0 type can bitrate 500000 loopback on

ip link set can0 up

2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10

    link/can  promiscuity 0 allmulti 0 minmtu 0 maxmtu 0

    can <LOOPBACK> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0

          bitrate 500000 sample-point 0.875

          tq 25 prop-seg 34 phase-seg1 35 phase-seg2 10 sjw 1 brp 1

          m_can: tseg1 2..256 tseg2 2..128 sjw 1..128 brp 1..512 brp_inc 1

          m_can: dtseg1 1..32 dtseg2 1..16 dsjw 1..16 dbrp 1..32 dbrp_inc 1

          clock 40000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 tso_max_size 65536 tso_max_segs 65535 gro_max_size 65536 parentbus spi parentdev spi0.0

  • Hi PY,

    We had checked the loopback was enable correctly but no data at CAN0

    I'm not sure how you checked that loopback was enabled correctly.  Did you read the device registers to verify correct settings?  There is also an External and an Internal Loopback mode.  In the external mode, the message is transmitted to the bus and internally looped back to itself.  In the internal mode, the message is NOT transmitted to the bus and is ONLY looped back to itself.

    You can find more information on the MCAN Loop Back Modes in the M_CAN User's Manual (Link).

    At the TCAN4550-Q1 device register level, you will need to first write a "1" to the Control Register (CCCR) 0x1018[7] to enable Test Mode.  In order to do this you will also need to have the INIT and CCE bits set to "1" to allow the TEST bit to be set, so this may require multiple writes to this register.

    Then after TEST=1, you will need to write a "1" to the LBCK bit of the Test Register 0x1010[4] to enable Loop Back Mode.

    If you want the Internal Loop Back mode, you will also need to set the MON bit of the Control Register 0x1018[5] to "1" which will disable the external transmission.  This can be done in your previous writes to the Control Register.  If you want the External Loop Back mode, you will need the MON bit to be "0" to allow external transmission of the message.

    After this is complete, you will need to set the INIT bit of the Control register to "0" to enable normal operation.

    Please verify the values of the Control and Test registers are correct and have the TEST, LBCK, and MON bits set appropriately.

    Regards,

    Jonathan