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: About M_CAN Internal/External Loop Back Test Mode in TCAN4550 spec

Part Number: TCAN4550-Q1
Other Parts Discussed in Thread: TCAN4550,

Hi Teams,

Above Is the MCAN core a separate piece of hardware? Or has been included in the tcan4550 chip?

First of all, I read and write the register of tcan4550 is OK. I try run command "echo "MCAN_CCCR 0x320" > registers" for  internal-only loop back, It does not change the value of the corresponding register. 

Please tell me the correct step.

Thanks,

Hongwei

  • Hongwei,

    Yes, the MCAN core is a part of the TCAN4550-Q1 device, it is integrated into the controller portion of the IC.

    Can you elaborate on the echo run command? In order to configure the device for internal-only loop back mode, you must set bit[0] in register 0x0800 to 1. You can find more information about this in the TCAN4550-Q1 datasheet, page 33.

    Please let me know if you have any questions.

    Regards,

  • Hi Eric,

    https://www.ti.com/lit/ds/symlink/tcan4550.pdf?ts=1597730988880&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FTCAN4550

    1. It is described in page1 of the above document:  CAN FD controller supports both ISO 11898- 1:2015 and Bosch M_CAN Revision 3.2.1.1

    And the description of Page33 MCAN core ,  I personally understand that they belong to the same product. Is that right?

    2. My current product is not connected to Bosch M_CAN, but directly connected to TCAN4550 through SPI,From the code, if need to verify Loopback, need the Bosch M_ CAN . About this, Am I right?

    The specific open source code Loopback mode configuration link is:  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/can/m_can/m_can.c  line: 1201

    3. About a mentioned in the spec, Page33  “Figure 31. M_CAN External Loop Back Test Mode”,   set bit[0] in register 0x0800 to 1. This step is only related to "Figure 28" and "Figure 29", Is it also related to "Figure 31" and "Figure 30"?  I didn't see the connection and GPIO1 in the "Figure 31" picture.

    Thanks,

    Hongwei Ren

  • Hongwei,

    1. The CAN FD controller integrated into the TCAN4550-Q1 supports the Bosch MCAN definition for CAN controllers. This controller also complies with the definitions for controllers in the ISO11898-1:2015 specification. Yes, they are the same part of the device as the MCAN core.

    2. No, the Bosch MCAN definition is implemented into the controller inside TCAN4550-Q1. The controllers generates CAN frames and follows the protocol based on the Bosch MCAN definition. The intent of the internal loopback mode is to test the MCAN configurations through SPI and verify MRAM implementation, configuration settings, interrupts, etc. without disturbing the CAN bus. So when you're communicating to the TCAN4550-Q1 through SPI, you are correct, you're not directly connected to the MCAN core, but the MCAN core is totally configurable through the SPI registers.

    3. Yes you are correct, bit[0] is meant for Figures 28 and 29. For figures 30 and 31, the test mode register, 0x1010 can be used to enable loop back mode. For external loop back mode, where the device will transmit to the bus but not receive, all you need to do is enable loop back mode in register 0x1010. For internal loop back mode, you must enable loop back mode in register 0x1010, and set MON (bit 5 in register 0x1018) to 1. Setting MON to 1 disables the ability to transmit to the bus. 

    For the last question, do you need to transmit something to GPIO1? If you're just testing the MCAN core you only need the SPI pins.

    Regards,

  • Hi Eric,

    Thank you for your reply.

    I don't need to transfer anything for GPIO1. My TCAN4550 driver has been successfully registered on kernel 4.19 version. I can normally read the register value in TCAN4550. The following is the value read from TCAN4550:

    [root@localhost ~]# cat /sys/bus/spi/devices/spi0.0/registers
    DEV_ID0 0x4E414354
    DEV_ID1 0x30353534
    REV 0x00110201
    STATUS 0x00000008
    ERROR_STATUS 0x00000000
    CONTROL 0x1F1F0113
    CONFIG 0xC80004A8
    PRESCALE 0x00000002
    TEST_REG 0x00000000
    INT_FLAGS 0x00000000
    INT_EN 0xFFFFFFFF
    MCAN_INT_FLAG 0x00000000
    MCAN_INT_EN 0x00000255
    MCAN_CCCR 0x00000300
    MCAN_ECR 0x00000000
    TX_ELM_SZ 0x00000007
    DBTP 0x00000A33
    NBTP 0x00000703
    PROTOCAL_STATUS 0x0000070F
    TDCR 0x00000000
    TXBAR 0x00000000
    ILE 0x00000001
    RXESC 0x00000777
    CREL 0x32150320
    TXBC 0x05000324

    Then I want to verify the communication of TCAN4550. I connect the two devices through the CAN interfaces, that is, the CANH/CANL of a device is connected to the CANH/CANL and straight thru of the B device. After the connection, the test is conducted through the open source CAN tool (canutils), and the following command is run:

    sh-4.6# ip link set can0 down

    sh-4.6# ip link set can0 type can bitrate 3000000

    sh-4.6# ip link set can0 up

    On the A device, configure to be ready to receive,  run command:

    sh-4.6#  candump can0

     

    On the B device, configure to start sending, run command:

    sh-4.6#  cansend can0 0x11 0x22 0x33 0x44  0x55 0x66 0x77 0x88

    Unfortunately, I did not receive the content sent by B on a device. Is my verification method correct?  If not, how should I verify it?

    Thanks,

    Hongwei Ren

  • Hongwei,

    Is there any way you can share a block diagram or schematic of your setup? I want to make sure I understand how your two nodes are connected. For instance, if there is no termination resistance on the bus, at 3 Mbps the communication won't work correctly. Your register setting don't indicate any issues from my side, but I'll go through them again to make sure your nominal bit rate and data bit rate are correct.

    Regards,

  • Hi Eric,

    I've solved this problem,  Thank you for your great support. 

    Thanks,

    Hongwei Ren

  • Hongwei,

    That's great to hear, can you let us know what the issue was?

    Regards,

  • Hi Eric,

    Use https://www.peak-system.com/PCAN-USB-FD.365.0.html?&L=1 connect TCAN4550 for Loopback test,  The test was successful.

    Thanks,

    Hongwei Ren