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.

TM4C123GH6PM: Unable to set up CAN bit rate at 1 Mbps

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: SN65HVD1040

Hello,

I am trying to set-up CAN bit rate at 1Mbps. After making attempts, first with CanBitRateSet() and then with CanBitTimingSet(), all I could achieve was some arbitrary pulses coming from CAN H and L. 

To check with other bit rates, I tried to configure the bit rate to 500 kbps and it worked fine. I verified the same on oscilloscope as well as checked the message on PC received via CAN-USB Cable(PCAN devices). 

Further details of the configured system are:-

TM4C123GH6PM controller is clocked at 80MHz,  from a 8MHz Crystal. The transceiver used is SN65HVD1040. 

I am doing the above process of different bit rates with Simple_tx.c from example codes of TM4C123. 

Please provide your advise to get the desired bit rate.

Thank you,

Aditya 

  • A few questions

    • Do you have good controlled impedance cabling?
    • Proper termination at both ends of the cable?
    • Same transceiver on both ends?
    • STB pin is pulled low?
    • Both ends are set to the same transmission speeds?

    Robert

  • Can you look at the CAN TX pin between the TM4C and the SN65HVD1040 with an oscilloscope? That would help us identify if the problem is on the TM4C or on the CAN bus side.
    • Good controlled impedance cabling – Yes
    • Proper termination at both ends of cable

    At TM4C123 end there exists proper termination with 120 ohm resistor, while at the other end it should be, as I am using http://www.peak-system.com/PCAN-USB.199.0.html?L=1 device from PCAN, which connects to PC.

    • Same transceiver at both ends-

    No, at TM4C123 end it’s SN65HVD1040, while at PCAN end it’s NXP PCA82C251.

    • STB pin is pulled Low – Yes.
    • Both ends are set to same transmission speeds- Yes

    By TM4C123 end I mean the SN65HVD1040 side and other is PCAN side.

    Thanks

  • Hi Bob,

    Attached are the oscilloscope captures for 500kbps and 1Mbps bit rate.

    @1Mbps

    I observe that the data is in-consistent from the micro-controllers end.

    The data sent is Msg Id: 0x55; and Msg Data: 0x5555 (2 Bytes).

    Please suggest corrections to be taken for the same.

    Thank you.

  • Aditya Barve said:
    At TM4C123 end there exists proper termination with 120 ohm resistor, while at the other end it should be, as I am using http://www.peak-system.com/PCAN-USB.199.0.html?L=1 device from PCAN, which connects to PC.

    According to the PCAN documentation https://www.peak-system.com/produktcd/Pdf/English/PCAN-USB_UserMan_eng.pdf that requires opening the case and making solder modifications, you've done that? Your sentence suggests you are only hoping it's set.

    IXXAT sells DSUB plug-ins with termination resistors built in which may be an alternative

    Robert

  • From the scope picture at 1MBaud, the CAN TX pin timing looks correct. (The single dominant bit has sharp edges. If you zoom in it would be easier to measure the time of that bit, but it looks to be half the time of the 500KBaud single bit.) The CAN_H line looks like it is not getting back to the recessive (low) state in time for the single bit. The recessive state is a simple RC discharge. Failure to get to the recessive state can be that the capacitance of the CAN bus is too high, or that the termination resistance is too high. The latter can happen if, for example, one end is missing the termination resistor. The different bit pattern you see is probably due to the TM4C constantly retransmitting the frame because either it or the PC recognizes a bit problem (receive not equal to transmit bit, stuff bit, acknowledge bit, checksum ...).
  • Robert Adsett said:
    IXXAT sells DSUB plug-ins with termination resistors built in which may be an alternative

    It appears Peak sells a similar device

    http://www.peak-system.com/PCAN-Term.270.0.html?&L=1

    This seems to me to be a better solution than making solder changes on your CAN adapter.

    Robert

  • *** LIKE *** Very nicely detailed.

    Is it the opinion of (both) you and poster/friend Robert - that the "1MBaud" rate (naturally) presents such "vulnerability" - which is not seen at (even) 500KBaud?

    And - has it not been (recently) noted that "Multiple such, "Failure to achieve 1MBaud CAN rates" have arrived - in force? (having spent (some, slight) time here - one is able to "detect" such trends...)
  • *** LIKE ***    (your "crack of the bat" discovery of and/or knowledge of - and then SHARING of such focused Tech info!)

    You Sir - have been - or are becoming - a, "Highly skilled Investigator!"     Such data appears (almost) "At R.A.'s fingertips!")
    So valuable - so useful - and SO rarely "suggested" here... Pity...

  • cb1_mobile said:
    Is it the opinion of (both) you and poster/friend Robert - that the "1MBaud" rate (naturally) presents such "vulnerability" - which is not seen at (even) 500KBaud?

    It's certainly mine. It's not a step function where everything is great at 500kbd and fails dramatically at 1Mbd but as the frequency increases the importance of good connections and transmission characteristics increases. Since CAN is quite robust, small errors at lower frequencies can be masked and tolerated but cause large or catastrophic failures at higher communications rates. The higher baud rates also introduce higher frequency components and these are more important (i.e. the edge rates must be faster) so any distortion introduced by the transmission media becomes more important as you increase speed.

    I've seen a CAN bus work, just with higher errors when one of it's termination resistors making intermittent connection.

    Robert

  • *** LIKE ***   (perhaps easier to "denote" your posts which are simply, "far above average!")

    Might it be mentioned then - in light of the, "Significant EXTRA interconnect & circuit DEMANDS" - commanded/imposed by 1MBaud rates - that such, "Users must really establish "good reason" for subjecting their system, themselves, and we (hapless helpers) to their RESCUE!

    Long ago - we were taught that (usually) "Distance & Signal Robustness trumped Speed - and that both were achieved via "Reduced (yet acceptable) Data Rates!"

    Never/ever do posters make (even the attempt) to justify their use of such "max performance."     And (few) here "follow up" - seek to confirm any (real) need for, always & only, "Full speed ahead!"    

    Note too - that, "Over time, aging and "hostile environmental conditions"" - such "full speed" may prove problematic - and would likely be avoided by a "more conservative" (i.e. slowed data rate) approach!

  • cb1_mobile said:
    Might it be mentioned then - in light of the, "Significant EXTRA interconnect & circuit DEMANDS" - commanded/imposed by 1MBaud rates - that such, "Users must really establish "good reason" for subjecting their system, themselves, and we (hapless helpers) to their RESCUE!

    Not sure that it's non-linear with frequency and I suspect that at 500kbd the OPs connection was already marginal.

    Definitely agree that there should be some thought before simply using a higher baud rate. OTOH testing at a higher baud rate could be used to reveal marginal connections.

    Baud rate selection is a trade-off between current performance requirements, robustness and future proofing. It's a parameter that can be hard to change later.

    Robert

  • Robert Adsett said:
    It's a parameter that can be hard to change later.

    SO Agree - thus - as "Mil. Intelligence" (oxy moron, acknowledged!) long urged - stress the "conservative approach" which (most always) proves more robust AND longer lasting!

    Full Speed Ahead - minus (ANY) justification - wanders (not far) from, "fool's gold."

  • Thank you Robert and Bob for sharing this information.

    I was hoping it to be done, as the PCAN device was already tested at 1Mbps speed with similar arrangement and it worked fine.

    I will check with the device and come back. 

    Thank you.

    Aditya

  • Aditya Barve said:
    I was hoping it to be done, as the PCAN device was already tested at 1Mbps speed with similar arrangement and it worked fine.

    It's possible the earlier system was also marginal but had just enough overhead in other parts of the system to allow it to work.

    Robert

  • "Just because 'it works' that doesn't mean it's working."

    Surely one of the "all time" GREAT Tags!

    Let the record show that poster (still) has not provided (any) justification for his (need) for such speed!    

    Substantial time/effort has been focused here - as one "transitions" to the real-world (i.e. workplace) and seeks such "guidance/support" from "senior tech crüe" - all posters here should recognize such "withhold of justification" is likely to be seen as "negative" (expectant) and unlikely to garner full & inspired support.    Clearly "time & effort" have a "real cost" in the workplace - so such "justification" makes (great) sense!

    Such requests - either "here" (this forum) - or in the workplace - are best "guided/attended" by others when the request is (somewhat) SOLD!    (i.e. request is presented as other than, "I wanna" - the request is designed to appeal to "many" - offer real benefit(s) - not (just) satisfy the "idle curiosity" of one!     (which is always suspected when NO/ZERO attempt is made to SELL the request - and absolutely "no justification" for poster's "demand upon others" is provided...)

    Such gentle "selling" - while providing legitimate justification - proves "far more likely" to earn (real) helper interest and/or (even) commitment!

    Poster Robert presents a (very) special (extreme knowledge AND caring) case - yet "his kind" (so rare this forum) may prove (even rarer) in the competitive workplace!     (forum remains "silent" this point - yet (someone) had to "highlight the many "negatives" arriving w/"withholding!")

  • Hi Robert and Bob,

    Thank you for the suggestion. And that has resolved the issue.

    As the PCAN device with us is pretty old, it does not have provision to enable the termination resistance as mentioned in the manual. However the termination resistance was added, and it worked fine at 1Mbps.

    Thanks a lot for your constructive support and time, which helped me learn things and new lessons.

    Thank you,

    Aditya

  • Glad we could help Aditya,

    If you are simply adding a resistor to the harness then I encourage you to take a look at the terminators from Peak and IXXAT I mentioned earlier. They are more expensive to purchase but they are also considerably more robust.

    Robert
  • Should it not be noted that "constructive" poster reported, "Working @ 500KBaud!"
    Was the termination resistor then removed - when the test migrated to 1MBaud?

    If "justification" for a posted request is NOT deemed "constructive" - poster's understanding of the word's definition - and "work-place" relationships - may require "re-think."

    One can simply, "Give another a caught fish" or "Teach the other to fish!"     One suspects that such "fishing lesson" IS constructive.    (and in time - so too will posters...)