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\$
  • 1
    \$\begingroup\$ Any particular architecture? \$\endgroup\$ – Ignacio Vazquez-Abrams Nov 27 '14 at 10:33
  • \$\begingroup\$ I am working on a Vector CanCase. \$\endgroup\$ – Zohra-tl Nov 27 '14 at 10:36
1
\$\begingroup\$

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

\$\endgroup\$
  • \$\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 I have no clue how they found those values! \$\endgroup\$ – Zohra-tl Nov 27 '14 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 Nov 27 '14 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 Nov 27 '14 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 for details. \$\endgroup\$ – mic Nov 27 '14 at 14:40
  • \$\begingroup\$ Ok I will look it up :) \$\endgroup\$ – Zohra-tl Nov 27 '14 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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