Kvaser Linux CANLIB

Bit Rate Examples

To calculate the bit timing parameters, you can use the bit timing calculator that is included with CANLIB SDK. Look in the BIN directory.

    // 500 kbit/s, using library-supplied default values
    stat = canSetBusParams(hnd, BAUD_500K, 0, 0, 0, 0, 0);



    // 125 kbit/s, tseg1=4, tseg=3, sjw=2, one sample
    // tseg1=4 means 4+1=5 quanta will precede the sampling point.
    // tseg2=3 means 3 quanta will follow the sampling point.
    // The sampling point will occur when 5/(5+3) = 62,5% of the bit has passed.
    stat = canSetBusParams(hnd, 125000, 4, 3, 2, 1, 0);



    // 83333 kbit/s, sampling point 75%, sjw=2, one sample
    stat = canSetBusParams(hnd, 83333, 5, 2, 2, 1, 0);



    // 83333 kbit/s, sampling point 75%, sjw=2, one sample
    stat = canSetBusParamsC200(hnd, 0x4b, 0x14);
See also:
canSetBusParams()
canSetBusParamsC200()
canGetBusParams()