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.

CCS/TMS320F28377S: Trouble in understanding Bit Rate setting in CAN example program for TMS320F28377S

Part Number: TMS320F28377S


Tool/software: Code Composer Studio

Hi all,

I am having a doubt regarding the example program "CAN_external_transmit" for TMS320F28377S in CCS. In the API, CANBitRateSet(), we are using a set of defined combination of values for bit parameters(TSEG1, TSEG2 and SJW). The set starts with a combination of bit parameter values when a Bit time is divided into 5 time quanta. I am having trouble understanding why the value 5. Is that obtained by putting the minimum values for the bit parameters which are [1..8]tq for Prop_Seg, Phase_Seg1 and Phase_Seg2 and 1tq(fixed) for Sync_Seg? If so, shouldn't the minimum divisions be 4 since the sum of minimum values of bit parameters gives 4 (i.e. 1tq for Prop_Seg, Phase_Seg1, Phase_Seg2 and Sync_Seg)? Someone please help me with understanding how those defined values are obtained.

  • Hi,

    From SPRUHX5E.pdf:
    "The bit time may consist of 8 to 25 time quanta." 5 time quantas is not enough, sum of sync-seg, prop-seg, phase seg 1 and phase seg 2 should be >=8 and <= 25.
    BOSCH CAN specification v2.0 should help understanding it all. Google should help finding it.

    You can use scope to verify if your current bitrate settings matches your expectations. Disconnect anything from the CAN bus (automatic BUS recovery should be on or keep manually recovering using your SW), do attempt to send message, determine using scope minimum width of low or high pulse on bus or on TX pin before transceiver. It should pretty exactly match your bitrate, no more no less but 1us for 1Mbps, 2us for 500kbps and so on.

    Edward
  • Hi Edward
    Thank you for the reply. I got your point. Is my understanding that they are using 5 time quanta as the 1st value in the set correct? They are using the max value as 13 also. Is there any particular reason for using those values in the TI example code? I just wanted to know why they are using those values(Divide 5 and Divide 13) in the above mentioned portion of the code.
  • Hi

    I don't think it is correct, as well I doubt it is correct treating bit time expressed in number of time quanta as a divider. I'm not sure, but I think min. number of time quanta comes from CAN specs, IIRC it must be common, I think Freescale/NXP CAN modules also had the same min. number of time quanta. Also the ratio between TSEG1 and TSEG2 sometimes differs according to high level protocol, CanOpen and others IIRC have different TSEG/TSEG ratio requirements, you should check it.

    Edward