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.

TMS320F28388D: MCAN baud rate calculation questions

Part Number: TMS320F28388D


Hi expert,

I go through the TRM and still not sure how baud rate of MCAN is calculated based on register value or driverlib structures.

Could you give us an answer based on our example?

Thanks

Sheldon

  • Hi Sheldon,

    These are the calculations on the register values.

    MCANBitClk = CM_Clk/MCANCLKDIV

    NominalbitTime = (NTSEG1 + 1) + (NTSEG2 + 1) + 1
    NominalBRP = (NBRP+1)
    FinalNominalBaudRate = MCANBitClk/( NominalBRP * NominalbitTime)

    DatabitTime = (DTSEG1 + 1) + (DTSEG2 + 1) + 1
    DataBRP = (DBRP+1)
    FinalDataBaudRate = MCANBitClk/( DataBRP * DatabitTime)

    Below is the example for setting 1Mbps assuming 125MHz CM clock.

        bitTimes.nomRatePrescalar   = 0U; // Nominal Baud Rate Pre-scaler.

        bitTimes.nomTimeSeg1        = 21U; // Nominal Time segment before sample point.

        bitTimes.nomTimeSeg2        = 1U; // Nominal Time segment after sample point.

        bitTimes.nomSynchJumpWidth  = 0U; // Nominal (Re)Synchronization Jump Width Range.

        bitTimes.dataRatePrescalar  = 0U; // Data Baud Rate Pre-scaler.

        bitTimes.dataTimeSeg1       = 21U; // Data Time segment before sample point.

        bitTimes.dataTimeSeg2       = 1U; // Data Time segment after sample point.

        bitTimes.dataSynchJumpWidth = 0U; // Data (Re)Synchronization Jump Width.

     

        SysCtl_setMCANClk(SYSCTL_MCANCLK_DIV_5);

    SysCtl_setMCANClk(SYSCTL_MCANCLK_DIV_5) is the api that is used to set MCANCLKDIV in C28x side (cm_common_config_c28x.c).

    Regards,

    Yashwant