0
\$\begingroup\$

I am creating an application that uses standard function that sets bitrate. The parameters required are BTR0 and BTR1. But the user of my application will enter the standard value of the Baudrate (eg. : Bitrate = 125000). How can i calculate BTR0 and BTR1 from the given value?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Any particular architecture? \$\endgroup\$ Commented Nov 27, 2014 at 10:33
  • \$\begingroup\$ I am working on a Vector CanCase. \$\endgroup\$
    – Zohra-tl
    Commented Nov 27, 2014 at 10:36

1 Answer 1

1
\$\begingroup\$

The CanCase parameters are compatible to the SJA1000. Chapter 6.5 of its datasheet should answer your question.

\$\endgroup\$
5
  • \$\begingroup\$ Thank you for your answer, but the datasheet doesn't explain how to calculate BTR0 and BTR1 from the baudrate only. The user needs to provide other parameters. Anyway, I found this table candip.com/canbittime16mhz.php (Internet Archive link). I have no clue how they found those values! [Internet Archive link added by moderator, as original link had died (2021-05-21)] \$\endgroup\$
    – Zohra-tl
    Commented Nov 27, 2014 at 13:45
  • \$\begingroup\$ Sorry, but calculating the register values from the baudrate ONLY is impossible! You have to know at least the basic clock frequency. With that, several combinations of BTR0/BTR1 are possible for a specific baudrate, depending on your desired (or required) TSEG settings. For a CAN case, the basic clock should be 16MHz. Try verifying the values of your table by re-calculating it with the SJA1000 specification. \$\endgroup\$
    – mic
    Commented Nov 27, 2014 at 14:04
  • \$\begingroup\$ Yes the baudrate along with the clock of course! But how could I know what is requiered for the TSEG? Can I set it in my application for all the possible baudrate values? Thank you for your answer \$\endgroup\$
    – Zohra-tl
    Commented Nov 27, 2014 at 14:19
  • \$\begingroup\$ The TSEG values depend on your specific system. You may have to consider signal delays, oscillator tolerances, etc. See this paper (Internet Archive link) for details. [Internet Archive link added by moderator, as original link had died (2021-05-21)] \$\endgroup\$
    – mic
    Commented Nov 27, 2014 at 14:40
  • \$\begingroup\$ Ok I will look it up :) \$\endgroup\$
    – Zohra-tl
    Commented Nov 27, 2014 at 14:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.