CAN Rx Issue (LPC11C24)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CAN Rx Issue (LPC11C24)

472 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mesozoic on Tue Oct 15 16:10:18 MST 2013
I'm building a device that receives CAN messages, but does not need to output any.  Currently, I'm able to send 29-bit extended messages, but don't seem to be able to receive anything.  Most of my code is based around the examples provided.  I'm not entirely sure I'm configuring my receive object properly, though.  Here's my CAN initialization function.  I need to be able to receive 29-bit extended format messages with IDs 0x00000EE4, 0x00010EE4, 0x00020EE4, 0x00030EE4, 0x00040EE4, and 0x00050EE4.  My CAN_rx func never gets called.

void InitCAN(void)
{
uint32_t CanApiClkInitTable[2] = { 0, 0 };
/* Publish CAN Callback Functions */
CCAN_CALLBACKS_T callbacks = {
CAN_rx,
CAN_tx,
CAN_error,
NULL,
NULL,
NULL,
NULL,
NULL,
};
baudrateCalculate(CANSERVO_DEV_BAUD_RATE, CanApiClkInitTable);

LPC_CCAN_API->init_can(&CanApiClkInitTable[0], TRUE);
/* Configure the CAN callback functions */
LPC_CCAN_API->config_calb(&callbacks);
/* Enable the CAN Interrupt */
NVIC_EnableIRQ(CAN_IRQn);

/* Configure message object 1 to receive all 29-bit messages for servo outputs */
gCANRxObj.msgobj = 1;
gCANRxObj.mode_id = 0x00000EE4UL;
gCANRxObj.mask = 0x00027FFFUL;
gCANRxObj.dlc = 8;
LPC_CCAN_API->config_rxmsgobj(&gCANRxObj);
}
Labels (1)
0 Kudos
1 Reply

284 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mesozoic on Tue Oct 15 16:41:22 MST 2013
The trick to get this one working was in setting up the receive message object.

gCANRxObj.mode_id = 0x00000EE4UL | CAN_MSGOBJ_EXT;
0 Kudos