Skip to main content
Explorer
September 19, 2024
Solved

I can't set the can_fd Data time in 8Mbps, what could be the problem? (STM32H753VIT6)

  • September 19, 2024
  • 4 replies
  • 1975 views

Hi, I am currently trying to set the data time of the can_fd function to 8Mbps for can_fd communication.
However, when I set the data time to be 8Mbps, the communication does not proceed normally.
When I set the data time to 1,2,4,5 Mbps, it worked fine, but why does it not work when I set it to 8 Mbps?
I have attached the IOC file in the attachment.

+ i already tried to change the data times into  5/4 , 6/3 but it didn't worked

    This topic has been closed for replies.
    Best answer by mƎALLEm

    Hello @KDG ,

    Watch this video on youtube, how to configure FDCAN timings especially @13:57

    You need to use kvaser calculator from here: https://kvaser.com/support/calculators/can-fd-bit-timing-calculator/

    Node delay to be put here:

    SofLit_0-1726839757823.png

     

     

    4 replies

    Graduate II
    September 19, 2024

    You have to compensate the transceiver delay, there's a register setting for that.

    No idea how to set this with Cube.

    /* enable TDC = transmitter delay compensation
     *	this is a MUST for high data rates
     */
    	/* configure Tx Delay Compensation : TdcOffset = DataTimeSeg1 * DataPrescaler */
    	uint32_t u32TdcOffs = ((uint32_t)phCan->Instance->DBTP >> FDCAN_DBTP_DTSEG1_Pos) + 1;
    	uint32_t u32TdcFltWdw = 0;
    
    	/* set TDC filter window */
    	phCan->Instance->TDCR = (u32TdcFltWdw << FDCAN_TDCR_TDCF_Pos);
    	/* set TDC offset */
    	phCan->Instance->TDCR |= (u32TdcOffs << FDCAN_TDCR_TDCO_Pos);
    	/* enable TDC */
    	phCan->Instance->DBTP |= FDCAN_DBTP_TDC;
    

     

    KDGAuthor
    Explorer
    September 20, 2024

    In the datasheet it says

    "Without transceiver delay compensation, the bitrate in the data phase of a CAN FD frame is limited by the transceivers loop delay"

    you are saying that this could be the cause of my error?

    Technical Moderator
    September 19, 2024

    Hello,

    You are using Normal mode.

    What is the transceiver part number you are using? Is it supporting 8Mb/s bandwidth?

    Did you try the Loopback mode?

    KDGAuthor
    Explorer
    September 20, 2024

    The transceiver is TCAN341x, and it says it supports 8Mbps in its datasheet

    "Support of classical CAN and optimized CAN FD performance at 2, 5, and 8 Mbps"

     

    No, I didn't tried the Loopback mode, can it be used for this solution?

     

    KDGAuthor
    Explorer
    September 20, 2024

    Ohh... so the transceiver delay compensation is needed when using the can fd data time which is over 5Mbps.

    after when i added the transceiver delay compensation, a waveform with a size about 192ns is added before the err waveform occured. 

    I think by adjusting the delay compensation setting, my problem could be solved, but I can't find the guidelines for setting it, Is there any guidelines for it?

    mƎALLEmAnswer
    Technical Moderator
    September 20, 2024

    Hello @KDG ,

    Watch this video on youtube, how to configure FDCAN timings especially @13:57

    You need to use kvaser calculator from here: https://kvaser.com/support/calculators/can-fd-bit-timing-calculator/

    Node delay to be put here:

    SofLit_0-1726839757823.png

     

     

    Graduate II
    September 20, 2024

    It's all in the reference manual, and register description. It's all calculated as "mtq".

    And it depends on the actual transceiver chip, which has its delay in ns usually in its datasheet.