Hi Martin Kovar@ As per the sample code you provided ,I have written the code for initializing M_CAN_1 for MPC5777M.
for sending CAN messages
void MCAN_1_Init()
{
M_CAN_1.CCCR.B.INIT = 0x1; // set to initialization mode
while(M_CAN_1.CCCR.B.INIT == 0x0); // wait till previous written value has been accepted.
M_CAN_1.CCCR.B.CCE = 0x1; // unlock protected registers for configuration
// while(M_CAN_1.CCCR.B.CCE == 0x0); // wait till previous written value has been accepted.
M_CAN_1.CCCR.B.CMR = 0x0; // Request CAN Mode
M_CAN_1.CCCR.B.CME = 0x0; // Enable CAN Mode
M_CAN_1.TSCC.R = 0x00000000; // Time Stamp Counter
M_CAN_1.TOCC.R = 0x00000000; // Time out counter
M_CAN_1.IE.R = 0xFFFFFFFF; // Enable all interrupts.
M_CAN_1.ILS.R = 0xFFFFFFFF; // Interrupt Assigns to one of the two interrupt lines.
M_CAN_1.ILE.R = 0x00000003; // Enable two interrupt lines.
M_CAN_1.BTP.R = 0x00011E77; // Set time quanta for 0.5Mbps SYNC=1, TSEG1=30+1, TSEG2=7+1, SJW=7+1
M_CAN_1.GFC.R = 0x00111111; // Reject Non Matching Frames
M_CAN_1.SIDFC.R = 0x00020000; // Configuring Two Standard ID filters and its offset address.
M_CAN_1.TXBC.R = 0x00200300; // Setting up 2 Tx Buffers, Transmit Buffer Offset Address
M_CAN_1.RXF0C.R = 0x80020100; // Setting up 5 Rx FIFO 0 with overwrite new messages when fifo full and its offset address.
M_CAN_1.RXF1C.R = 0x00020200; // Setting up 5 Rx FIFO 1 with discard new messages when fifo full and its offset address
M_CAN_1.RXESC.R = 0x00000000; // 8 data bytes for Message FIFO 1 / 8 data bytes for Message FIFO 0
M_CAN_1.TXESC.R = 0x00000000; // 8 data bytes for Tx Buffer.
M_CAN_1.CCCR.B.CCE = 0x0; // disable CCE to prevent configuration changes
M_CAN_1.CCCR.B.INIT = 0x0; // Return to normal operation
while(M_CAN_1.CCCR.B.INIT == 0x1); // lock protected registers for configuration
//while((M_CAN_1.CCCR.R & 0x1) == 1);
SIUL2.MSCR_IO[10].R = 0x32000001; // Very Strong Drive,Push-Pull output enable MCAN1TX Pin, PA[10]
SIUL2.MSCR_IO[11].R = 0x00080002; // Enable input buffer for MCAN1RX
SIUL2.MSCR_MUX[246].B.SSS = 0x2; // Connect MCAN1RX to PA[11]
}
I Flashed the same code into the board, And I tried to debug ,when it encounters the M_CAN_1.CCCR.B.CCE = 0x1; instruction ,It is not taking.I dont why it is not taking ,Can you please help me how to resolve the issue.