85 #if defined(CHIP_LPC175X_6X)
90 #if (CAN_CTRL_NO == 0)
91 #define LPC_CAN (LPC_CAN1)
93 #define LPC_CAN (LPC_CAN2)
97 #define FULL_CAN_AF_USED 1
99 #define CAN_TX_MSG_STD_ID (0x200)
100 #define CAN_TX_MSG_REMOTE_STD_ID (0x300)
101 #define CAN_TX_MSG_EXT_ID (0x10000200)
102 #define CAN_RX_MSG_ID (0x100)
108 "CAN DEMO : Use CAN to transmit and receive Message from CAN Analyzer\r\n"
109 "CAN bit rate : 500kBit/s\r\n";
179 DEBUGOUT(
"\t Error Direction: Transmiting\r\n");
182 DEBUGOUT(
"\t Error Direction: Receiving\r\n");
194 DEBUGOUT(
"\t**************************\r\n");
195 DEBUGOUT(
"\tMessage Information: \r\n");
209 for (i = 0; i < pMsg->
DLC; i++)
211 DEBUGOUT(
"\r\n\t**************************\r\n");
220 SendMsgBuf.
ID = pRcvMsg->
ID;
221 SendMsgBuf.
DLC = pRcvMsg->
DLC;
223 for (i = 0; i < pRcvMsg->
DLC; i++)
224 SendMsgBuf.
Data[i] =
'0' + i;
256 for (i = 0; i < num; i++) {
258 DEBUGOUT(
"\t\t%d: Controller ID: %d, ID: 0x%x, Dis: %1d\r\n",
263 DEBUGOUT(
"\tIndividual Standard ID Table: \r\n");
265 for (i = 0; i < num; i++) {
267 DEBUGOUT(
"\t\t%d: Controller ID: %d, ID: 0x%x, Dis: %1d\r\n",
271 DEBUGOUT(
"\tGroup Standard ID Table: \r\n");
273 for (i = 0; i < num; i++) {
275 DEBUGOUT(
"\t\t%d: Controller ID: %d, ID: 0x%x-0x%x, Dis: %1d\r\n",
280 DEBUGOUT(
"\tExtended ID Table: \r\n");
282 for (i = 0; i < num; i++) {
284 DEBUGOUT(
"\t\t%d: Controller ID: %d, ID: 0x%x,\r\n",
288 DEBUGOUT(
"\tGroup Extended ID Table: \r\n");
290 for (i = 0; i < num; i++) {
292 DEBUGOUT(
"\t\t%d: Controller ID: %d, ID: 0x%x-0x%x\r\n",
330 StdEntry.
ID_11 = 0x20;
332 StdEntry.
ID_11 = 0x40;
337 ExtEntry.
ID_29 = (1 << 11) | 0x02;
339 ExtEntry.
ID_29 = (1 << 11) | 0x04;
391 uint16_t i = 0, FullCANEntryNum = 0;
402 DEBUGOUT(
"Message Received!!!\r\n");
415 if (FullCANEntryNum > 64) {
416 FullCANEntryNum = 64;
418 for (i = 0; i < FullCANEntryNum; i++)
423 DEBUGOUT(
"FullCAN Message Received!!!\r\n");
461 NVIC_EnableIRQ(CAN_IRQn);
466 SendMsgBuf.
Data[0] =
'A';
467 SendMsgBuf.
Data[1] =
'B';
468 SendMsgBuf.
Data[2] =
'C';
469 SendMsgBuf.
Data[3] =
'D';
487 SendMsgBuf.
Data[0] =
'E';
488 SendMsgBuf.
Data[1] =
'F';
489 SendMsgBuf.
Data[2] =
'G';
490 SendMsgBuf.
Data[3] =
'H';
491 SendMsgBuf.
Data[4] =
'I';
492 SendMsgBuf.
Data[5] =
'J';
493 SendMsgBuf.
Data[6] =
'K';
494 SendMsgBuf.
Data[7] =
'L';