Hello TM4C forum,
Currently i am working on TM4C123GH6PM microcontroller for CAN application. I am sending/receiving the data from/to PCAN.
I have used CANBitRateSet() driver function for setting the baud rate with 50MHz clock. It was observed that, when the baud rate is configured for 100k,125k,250k and 500kbps, it works smoothly. But when the baud rate is increased to 800k or 1Mbps, the PCAN displays BUSHEAVY/BUSOFF conditions for 50MHz sysclk.
Then instead of CANBitRateSet() function, i tried by using CANBitTimingSet() for setting the bit rate which inturn uses tCANBitClkParms structure as shown below. The CAN clock was set to 50MHz. In this configuration also, it was observed that, when bit rate is above 500kbps the PCAN displays BUSHEAVY/BUSOFF conditions.
tCANBitClkParms CANBitClkSettings[] =
{
{16, 8, 4, 20}, // CANBAUD_100K ok at 50MHz clock.
{13, 2, 4, 25}, // CANBAUD_125K ok at 50MHz clock.
{6, 1, 2, 25} , // CANBAUD_250K ok at 50MHz clock.
{16, 3, 2, 5}, // CANBAUD_500K ok at 50MHz clock.
{8, 1, 1, 5} // CANBAUD_1M ok at 50MHz clock.
};
The tCANBitClkParms data structure contains the values for SyncPropPhase1, Phase2, SJW, BRP used for calculating bit rate.
typedef struct
{
uint32_t ui32SyncPropPhase1Seg;
uint32_t ui32Phase2Seg;
uint32_t ui32SJW;
uint32_t ui32QuantumPrescaler;
}
tCANBitClkParms;
I am using SN65HVD1040D CAN transceiver and using 8MHz XTAL.
Please anyone help me out, how these values shown in the above data structure were calculated or the parameters considered for getting these values to achieve the respective bit rate.
Thanks in advance.