Hi,
I have a 9s12XEQ384 running on a 5 MHz resonator and I have CAN communication using TJA1040 and TJA1042 that works at 250 Kb/s and 500 Kb/s.
I now need to make it work at 1 Mb/s.
I can see that I need to change my 5 MHz resonator to a 8 MHz resonator.
Now the settings for CAN_BTR0 and CAN_BTR1 is where I am confused.
For 250 Kb/s I have
#define BTR0_250 0x41 // 5 MHz reference
#define BTR1_250 0x34 // Sample at 4 / 5 = 80%
for 500 Kb/s I have
#define BTR0_500 0xC0 // Suggested by Radek - Works
#define BTR1_500 0x34 // Suggested by Radek - Works
When I use your CAN calculator (ver 7) I get
#define BTR0_1000 0x40 // 8 MHz reference
#define BTR1_1000 0x94 // 3 samples / bit
But when I go back to using a 5 MHz resonator on the calculator it says
For 250 Kb/s
#define BTR0_250 0x41
#define BTR1_250 0x16 or 0x96
for 500 Kb/s
#define BTR0_500 0x40
#define BTR1_500 0x16 or 0x96
Now I have confirmed the 250 and 500 KB/s as working using CAN_BTR1 = 0x34
So which is correct? And should I use the above for 1 Mb/s ?
Regards,
Wade Whitehorn
Hi,
Radek used older version of the calculator where I programmed the sample point as close as possible to 50%. Moreover, I am not sure whether he used the right version. There was some error I can not remember.
Here is a calculation he probably used (after my call with him):
If you want to follow changes you can change Propagation delay of the interface, bus length, sample point,...the changes are clearly visible in the right part of the table -> length of segment changes.
If I use TJA1040 propagation delay 255ns, different bus length and sample point 80% then relations between values change.
So that's the reason.
Note: You can see better oscillator must be used in the second case.
Best regards,
Ladislav