CAN LOOP BACK issue in ISR in TEST MODE with LPC4357 on NGX LPC435x-Xplorer++

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

CAN LOOP BACK issue in ISR in TEST MODE with LPC4357 on NGX LPC435x-Xplorer++

984 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by srinivasR on Thu Dec 10 08:09:15 MST 2015
Hi ,
I am testing the CAN example in Loopback mode with lpcopen_2_12_lpcxpresso_ngx_xplorer_4330 on ngxplorer 4357 board.
Enabled the CAN inerrupts and test mode as below;
       Chip_CCAN_EnableInt(LPC_C_CAN0, (CCAN_CTRL_IE | CCAN_CTRL_SIE | CCAN_CTRL_EIE| CCAN_CTRL_TEST));
LPC_C_CAN0->TEST |= (1<<4);//  test loopback mode
NVIC_EnableIRQ(C_CAN0_IRQn);
..
Chip_CCAN_Send(LPC_C_CAN0, CCAN_MSG_IF1, false, &send_obj);//send message
Before transmit, INT and STATUS registers are 0. After send message, ISR is triggered. STATUS register's TXOK is set and ISR register is set to message object correctly.
But receive message buffer is not proper in the below ISR. IT IS NOT CLEAR why receive is not working.??

void CAN0_IRQHandler(void)
{
CCAN_MSG_OBJ_T msg_buf;
uint32_t can_int=0, can_stat=0, i=0;
while ( (can_int = Chip_CCAN_GetIntID(LPC_C_CAN0)) != 0 ) {
if (can_int & CCAN_INT_STATUS) {
can_stat = Chip_CCAN_GetStatus(LPC_C_CAN0);

Chip_CCAN_ClearStatus(LPC_C_CAN0, CCAN_STAT_TXOK);
Chip_CCAN_ClearStatus(LPC_C_CAN0, CCAN_STAT_RXOK);
}
else if ((1 <= CCAN_INT_MSG_NUM(can_int)) && (CCAN_INT_MSG_NUM(can_int) <= 0x20)) {
// Process msg num canint
Chip_CCAN_GetMsgObject(LPC_C_CAN0, CCAN_MSG_IF1, can_int, &msg_buf);
switch (msg_buf.id) { //<<<<<<<<<<<<<id is not correct?????????
case CCAN_TX_MSG_ID:

break;
default:
break;
}
}
}
}
Labels (1)
0 Kudos
Reply
0 Replies