The tranceiver support speeds until 10Mbs but i wanted to know if someone has the BRP T1 and T2 values for 125kbs 250kbs 500kbs and 1000kbs
I’m porting code from EMX to G120 and since processor speed is not the same i will need new values to initialisate CAN.
i had a look at “Implementation of CAN on GHI Electronics devices” on the wiki and used that sample calculation with 120mhz instead of 72mhz
and then i have BRP=40 for 125kbs, no idea if TQ still can be 24? i used T1=15 T2=8 as in the samples for EMX.
If you look at the datasheet from the µprocessor you will see there a a number off different clock’s used (all based on µprocessor or PLL) and the actual clock speed served the APB devices has a divider (in case of the G120 and the CAN controller this was the APB clock at 0x400FC1A8)
The value in here you need to use to divide the µprocessor speed and this value you need to enter in the Kvaser calculator, NOT the µprocessor speed.
Then there is a second element, the sum off T1 and T2 is the number cpu ticks you allocate to process a bit, in the answer to my question I was not aware how to use this factor. I just started from a working value and came to the conclusion that the only correct BRP (presale value or divider factor) could be 2.5 ! and 2.5 is not a value you can store in a 10 bit register… (based on the same T1 and T2 values from a lower speed)
But the number off ticks used, if you change this (and there are ticks for processing a bit) you get another multiply or divider element to get the correct output speed
In the solution provide by Aron we had correct time values for 500Kb: brp = 5; t1 = 16-1; t2 = 8;
Back to the quoted message, when you read the value in the APB clock divider you see this value = 2, and 120Mhz / 2 = 60 MHz, put 60Mhz in the Kvaser tool with the needed CAN bus speed and there you get all the correct possible values ! (including the T1=8-1 and T1=4)
And the the final calculation:
120Mhz / 2 APB divider / 2.5 BRP / 24 T1+T2 = 1000 (but 2.5 is not possible)
120Mhz / 2 APB divider / 5 BRP / 12 T1+T2 = 1000 (and 5 is possible + 12 ticks seems ok to process a bit)
I hope this brings some insight I have obtained to other CAN users