fix: Correct CAN RX interrupt to handle extended IDs
parent
c9482f46bb
commit
01b847661b
|
|
@ -352,14 +352,11 @@ void CANFD0_IRQHandler(void)
|
||||||
xCanIdType_t idType = ERROR;
|
xCanIdType_t idType = ERROR;
|
||||||
uint64_t idx = 0;
|
uint64_t idx = 0;
|
||||||
idx = TempRxMsg.id;
|
idx = TempRxMsg.id;
|
||||||
uint32_t value = ((TempRxMsg.id & (uint32_t) 0x1FFC0000) >> (uint32_t) 18);
|
if(TempRxMsg.xtd == 0)
|
||||||
if ((value > 0) && (value <= 0x7FF))
|
|
||||||
{
|
{
|
||||||
idType = STD_ID;
|
idx = ((TempRxMsg.id & (uint32_t) 0x1FFC0000) >> (uint32_t) 18);
|
||||||
idx = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(idx)
|
if(idx)
|
||||||
{
|
{
|
||||||
for(uint8_t inx = 0; inx <= 7; inx++)
|
for(uint8_t inx = 0; inx <= 7; inx++)
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,12 @@ void mcu_FDCAN_RxFifo_Callback(uint32_t Identifier, uint8_t *data, uint16_t Data
|
||||||
uint8_t store_msg_from_isr_to_queue(uint32_t id, uint8_t* data, uint8_t len)
|
uint8_t store_msg_from_isr_to_queue(uint32_t id, uint8_t* data, uint8_t len)
|
||||||
{
|
{
|
||||||
can_buff_t buff = {0};
|
can_buff_t buff = {0};
|
||||||
|
//printf("id %d\n",id);
|
||||||
buff.id = id;
|
buff.id = id;
|
||||||
buff.length = len;
|
buff.length = len;
|
||||||
memcpy(buff.data, data, len);
|
memcpy(buff.data, data, len);
|
||||||
ENQUEUE(g_canQueue, buff);
|
ENQUEUE(g_canQueue, buff);
|
||||||
|
//printf("enqueue id after enqueue %d\n",buff.id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,7 +92,9 @@ IVEC_EcuCommonErr_e xECU_CANGetData(can_buff_t *pxBuff)
|
||||||
|
|
||||||
can_buff_t xBuff = { 0x00 };
|
can_buff_t xBuff = { 0x00 };
|
||||||
DEQUEUE(g_canQueue, xBuff);
|
DEQUEUE(g_canQueue, xBuff);
|
||||||
|
//printf("dequeue id %d\n",xBuff.id);
|
||||||
memcpy(pxBuff,&xBuff,sizeof(can_buff_t));
|
memcpy(pxBuff,&xBuff,sizeof(can_buff_t));
|
||||||
|
// printf("dequeue id after memcpy %d\n",pxBuff->id);
|
||||||
// printf("ID received dequeue %d\n",xBuff.id);
|
// printf("ID received dequeue %d\n",xBuff.id);
|
||||||
l_xFuncStatus = commonECU_SUCCESS;
|
l_xFuncStatus = commonECU_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue