LPC4357 CAN cannot receive

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC4357 CAN cannot receive

904件の閲覧回数
hyd007
Contributor I

Hello everyone, I use LPC4357, CAN function, I send a data to the board through the PC, after the board receives, reply, the PC sends (Chip_CCAN_Send(LPC_C_CAN0, CCAN_MSG_IF1, false, &msg_buf);)the same data again, at this time CAN can only enter the RXOK state of the interrupt, cannot enter the msg interrupt again .Or  the board sends the data once, the board can only enter the receiving RXOK state interrupt, but can not enter the msg interrupt.,Have some people encountered this similar problem?

void CAN0_IRQHandler(void)
{
CCAN_MSG_OBJ_T msg_buf;
uint32_t can_int, can_stat, i;
while ( (can_int = Chip_CCAN_GetIntID(LPC_C_CAN0)) != 0 ) {
if (can_int & CCAN_INT_STATUS) {
can_stat = Chip_CCAN_GetStatus(LPC_C_CAN0);
// TODO with error or TXOK, RXOK
if (can_stat & CCAN_STAT_EPASS) {
DEBUGOUT("Passive error\r\n");
return;
}
if (can_stat & CCAN_STAT_EWARN) {
DEBUGOUT("Warning!!!\r\n");
return;
}
if (can_stat & CCAN_STAT_BOFF) {
DEBUGOUT("CAN bus is off\r\n");
return;
}
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) {
case CCAN_RX_MSG_ID:
DEBUGOUT("Msg ID :%x\r\n", msg_buf.id);
DEBUGOUT("Msg data :");
for (i = 0; i < msg_buf.dlc; i++) {
DEBUGOUT("%x ", msg_buf.data[i]);
}
DEBUGOUT("\r\nFeed back...\r\n");
msg_buf.id += 1;
Chip_CCAN_Send(LPC_C_CAN0, CCAN_MSG_IF1, false, &msg_buf);
break;

case CCAN_TX_MSG_ID:
break;

case CCAN_TX_MSG_REMOTE_ID:
msg_received_counter++;
if (msg_received_counter == 5) {
DEBUGOUT("Remote transmit total is 5. Delete remote ID\r\n");
Chip_CCAN_DeleteReceiveID(LPC_C_CAN0, CCAN_MSG_IF1, CCAN_TX_MSG_REMOTE_ID);
}
break;

default:
break;
}
}
}
}

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 返信

744件の閲覧回数
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
Actually, I'm not very clear with your question, and I see you use periph_ccan demo which is from the LPCOpen library for testing, so does your question is that this demo doesn't work as to be expected?
If yes, I was wondering if you can introduce the testing process you did.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信