/* Get the address of the message buffer to write to. Load the buffer and then set the UINC bit.
Set the TXREQ bit next to send the message. */
CANFD_TX_MSGOBJ *txObj;
/* Transmit message from TXQ - CANFD base frame with BRS*/
/* SID = 0x100, 64 bytes of data */
txObj = (CANFD_TX_MSGOBJ *)C1TXQUAL;
txObj->bF.id.SID = 0x100;
txObj->bF.id.EID = 0x0000;
txObj->bF.ctrl.BRS = 1 ; //Switch bit rate
txObj->bF.ctrl.DLC = 0xF; //64 bytes
txObj->bF.ctrl.FDF = 1; // CANFD frame
txObj->bF.ctrl.IDE = 0; //Standard frame
for (index=0;index<0x40;index++ )
{
txObj->byte[index+8] = 0x5A ; // 64 bytes of 0x5A
}
C1TXQCONLbits.UINC = 1; // Set UINC bit
C1TXQCONLbits.TXREQ = 1; // Set TXREQ bit
/* Transmit message 0 from FIFO 1 - CANFD base frame with BRS*/
/* SID = 0x300 , 16 bytes of data */
txObj = (CANFD_TX_MSGOBJ *)C1FIFOUA1L;
txObj->bF.id.SID = 0x300;
txObj->bF.id.EID = 0x0000;
txObj->bF.ctrl.BRS = 1 ; //Switch bit rate
txObj->bF.ctrl.DLC = 0xA; //16 bytes
txObj->bF.ctrl.FDF = 1; // CANFD frame
txObj->bF.ctrl.IDE = 0; //Standard frame
for (index=0;index<0x10;index++ )
{
txObj->byte[index+8] = 0xA5 ; // 16 bytes of 0xA5
}
C1FIFOCON1Lbits.UINC = 1; // Set UINC bit
C1FIFOCON1Lbits.TXREQ = 1; // Set TXREQ bit
/* Transmit message 1 from FIFO 1 - CANFD base frame with BRS*/
/* SID = 0x500, EID = 0xC000, 12 bytes of data */
txObj = (CANFD_TX_MSGOBJ *)C1FIFOUA1L;
txObj->bF.id.SID = 0x500;
txObj->bF.id.EID = 0xC000;
txObj->bF.ctrl.BRS = 1 ; //Switch bit rate
txObj->bF.ctrl.DLC = 0x9; //12 bytes
txObj->bF.ctrl.FDF = 1; // CANFD frame
txObj->bF.ctrl.IDE = 0; //Standard frame
for (index=0;index<0xC;index++ )
{
txObj->byte[index+8] = 0x55 ; // 12 bytes of 0x55
}
C1FIFOCON1Lbits.UINC = 1; // Set UINC bit
C1FIFOCON1Lbits.TXREQ = 1; // Set TXREQ bit
while(1);
}