Main Site Documentation

G120 CAN Bit timing for MCP2551


has anyone the correct CAN bit time values for MCP2551 with G120? (125/250/500/1000 kbs)?
The calculator at kvaser is no more there… I used this one :
But i dont think these values are correct for the MCP2551, always getting “CAN BusOff error”



Seems to be 500KB has said here :


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.


     public enum Bitrate
        NONE = 0,
        BITRATE_125k = 125000,
        BITRATE_250k = 250000,
        BITRATE_500k = 500000,
        BITRATE_1000k = 1000000,

       /// <summary>
        /// Returns a bitrate for the internal CAN driver
        /// </summary>
        /// <param name="bitrate">Bitrate</param>
        /// <returns>CAN driver bitrate for LPC17XX</returns>
        public uint GetBitRateConfig_120MHZ(Bitrate bitrate)
            int t1 = 0;
            int t2 = 0;
            int brp = 0;

            switch (bitrate)
                case Bitrate.BITRATE_125k:
                    brp = 20;
                    t1 = 16 - 1;
                    t2 = 8;

                case Bitrate.BITRATE_250k:
                    brp = 10;
                    t1 = 16 - 1;
                    t2 = 8;

                case Bitrate.BITRATE_500k:
                    brp = 5;
                    t1 = 16 - 1;
                    t2 = 8;

                case Bitrate.BITRATE_1000k:
                    brp = 2;
                    t1 = 16 - 1;
                    t2 = 8;

            return (uint)(((t2 - 1) << 20) | ((t1 - 1) << 16) | ((brp - 1) << 0));


@ Honken - This is great. Do you mind if I add to wiki?


I will try this first thing next morning :slight_smile:
What’s the calculation behind these values, with the calculation from Wiki i had brp=40 with 120mhz?


No problem, go ahead!


@ David@ Emrol - I have made the first calculation with Kvaser tool and then adjusted it with measuring it with oscilloscope.


kvaser CAN bit calculator is still availible on :

I added the link to the Wiki.


and at the same page : "Most, if not all, CAN controllers, standalone or built-in, will then divide that frequency by 2 before actually using it. "
thats why the 40 had to be 20 i suppose.


Tested BRP=20 T1=15 T2=8 with the MCP2551 (only 125kbs at the moment)
Tested BRP=20 T1=15 T2=8 with the TJA1050 (gadgeteer CAN DW v1.2)

Both are working just fine :slight_smile:

@ Honken : Thanks !!!


A Correction needs to be made to the BITRATE_1000k. It should be as follows:

 case Bitrate.BITRATE_1000k:
     brp = 5;
     t1 = 8 - 1;
     t2 = 4;


Clarification on above:

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 :slight_smile:
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 :slight_smile: