Setting Timing Parameters

Accessing the Timing Parameters

The timing parameters that control the bit rate for DM6437 EVM CAN Receive and DM6437 EVM CAN Transmit blocks are Baud rate prescaler, TSEG1, and TSEG2 in the DM6437 EVM CAN Setup block:

The following sections describe the process of setting these parameters.

Equations for Bit Rate Calculation

The following steps guide you through the process of configuring the required timing parameters.

  1. Review the known entities:

    Bit Rate

    Obtain the Bit Rate of the CAN network. (Expressed as "Bitrate" in the following formulas).

    SYSCLKOUT

    This is equivalent to the CAN module system clock frequency. The CAN peripheral in the DM6437 is in the CLKIN clock domain, which operates at the same frequency as the primary reference clock to the DSP. In the DM6437EVM board, the primary reference clock operates at 27 MHz.

  2. Estimate the value of the Baud rate prescaler (BRP) and substitute this value, along with the known values of Bitrate and SYSCLKOUT, into the equation below as follows:

    Bitrate = SYSCLKOUT/(BRP * BitTime)

    Solve this equation for BitTime to obtain a value:

    BitTime = SYSCLKOUT/(BRP * Bitrate)

  3. Estimate values of TSEG1 and TSEG2 that satisfy the following equation:

    BitTime = TSEG1 + TSEG2 + 1

    Remember that BitTime is now a known quantity, calculated in the previous step.

  4. Validate these estimated values of BRP, TSEG1, and TSEG2 against the following rules:

    TSEG1 >= TSEG2
    IPT (Information Processing Time) = 3/BRP
    IPT <= TSEG1 <= 16 TQ
    IPT <= TSEG2 <= 8 TQ
    1 TQ <= SJW <= min(4 TQ, TSEG2)

    where:

    IPT is Information Processing Time, TQ is Time Quanta, and SJW is Synchronization Jump Width, which can be set in the CAN Setup block.

  5. Iterate steps two through four until the values selected for TSEG1, TSEG2, and BRP meet all of the criteria.

The following illustration gives an alternate view of the CAN bit timing parameters.

CAN Bit Timing Examples

Assume that SYSCLKOUT = 27 MHz, and a bit rate of 1 Mbits/s is required.

  1. With the Baud rate prescaler (BRP) set to 12, substitute the values of bit rate, BRP, and SYSCLKOUT into the following equation, solving for BitTime:

    BitTime = SYSCLKOUT/(BRP * Bitrate)

    BitTime = 27MHz/(12 * 0.25 MBits/sec) = 9TQ

  2. Try to set the values of TSEG1 and TSEG2 to 6TQ and 2TQ respectively. Substitute the values of BitTime from the previous equation, and the chosen values for TSEG1 and TSEG2 into the following equation:

    BitTime = TSEG1 + TSEG2 + 1

    9TQ = 6TQ + 2TQ + 1

  3. Finally, check the selected values against the rules:

    IPT = 3/BRP = 3/12 = .25
    IPT <= TSEG1 <= 16 TQ True! .25 <= 6TQ <= 16TQ
    IPT <= TSEG2 <= 8TQ True! .25 <= 2TQ <= 8TQ
    1TQ <= SJW <= min(4TQ, TSEG2), as a result of which SJW can be set to either 1 or 2.
  4. Because all chosen values satisfy the criteria, no further iteration is necessary.

The following table provides common timing parameter settings for 3 typical values of Bit Rate and SYSCLKOUT = 27 MHz. This clock frequency is the maximum for the DM6437 EVM blocks.

Bit RateTSEG1TSEG2Bit TimeBRPSJW
250 Kbits/sec623121 or 2
500 Kbits/sec31691
1 Mbits/sec*62931 or 2
2 Mbits/sec*114.5 3ERROR

*Due to a limitation in the DM643x CAN module, 3-time sampling is not possible at this Bit Rate. In the DM6437 EVM CAN Setup block, the SAM parameter cannot be set to Sample three times.

References

For detailed information on the CAN module, see TMS320DM643x DMP High-End CAN Controller User's Guide (Rev. A), Literature Number SPRU981A, available at the Texas Instruments Web site.

See Also

DM6437EVM, DM6437 EVM CAN Setup, DM6437 EVM CAN Transmit

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS