Hi, I want to use the can with FIFO buffer but I don´t know how to handle it.I took this example from the tiva user´s guide and I can´t completly understand how the read the data, in the last line uses CANMessageGet pointing to MsgObjectRx, shouldn´t it pass a buffer to the object´s data member of the MsgObjectRx.Also is there another example that i can use?
tCANBitClkParms CANBitClk;
tCANMsgObject sMsgObjectRx;
tCANMsgObject sMsgObjectTx;
uint8_t pui8BufferIn[8];
uint8_t pui8BufferOut[8];
//
// Enable the CAN0 module.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN0);
//
// Wait for the CAN0 module to be ready.
//
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_CAN0)){}
//
// Enable the CAN1 module.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN1);
//
// Wait for the CAN1 module to be ready.
//
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_CAN1)){}
//
// Reset the state of all the message objects and the state of the CAN
// module to a known state.
//
CANInit(CAN0_BASE);
CANInit(CAN1_BASE);
//
// Configure the controller for 1 Mbit operation.
//
CANSetBitTiming(CAN1_BASE, &CANBitClk);
//
// Take the CAN0 device out of INIT state.
//
CANEnable(CAN0_BASE);
CANEnable(CAN1_BASE);
//
// Configure a receive object.
//
sMsgObjectRx.ulMsgID = (0x400);
sMsgObjectRx.ulMsgIDMask = 0x7f8;
sMsgObjectRx.ulFlags = MSG_OBJ_USE_ID_FILTER | MSG_OBJ_FIFO;
//
// The first three message objects have the MSG_OBJ_FIFO set to indicate
// that they are part of a FIFO.
//
CANMessageSet(CAN0_BASE, 1, &sMsgObjectRx, MSG_OBJ_TYPE_RX);
CANMessageSet(CAN0_BASE, 2, &sMsgObjectRx, MSG_OBJ_TYPE_RX);
CANMessageSet(CAN0_BASE, 3, &sMsgObjectRx, MSG_OBJ_TYPE_RX);
//
// Last message object does not have the MSG_OBJ_FIFO set to indicate that
// this is the last message.
//
sMsgObjectRx.ulFlags = MSG_OBJ_USE_ID_FILTER;
CANMessageSet(CAN0_BASE, 4, &sMsgObjectRx, MSG_OBJ_TYPE_RX);
//
// Configure and start transmit of message object.
//
sMsgObjectTx.ulMsgID = 0x400;
sMsgObjectTx.ulFlags = 0;
sMsgObjectTx.ulMsgLen = 8;
sMsgObjectTx.pucMsgData = pui8BufferOut;
CANMessageSet(CAN0_BASE, 2, &sMsgObjectTx, MSG_OBJ_TYPE_TX);
//
// Wait for new data to become available.
//
while((CANStatusGet(CAN1_BASE, CAN_STS_NEWDAT) & 1) == 0){
//
// Read the message out of the message object.
//
CANMessageGet(CAN1_BASE, 1, &sMsgObjectRx, true);
}
//