I cann't receive CAN frame via RX FIFO

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

I cann't receive CAN frame via RX FIFO

Jump to solution
1,261 Views
Yanncy
Contributor I

hello:

I'm using s32k144 EVB board to test CAN module. The function i want to realize is receiving one CAN message from computer and then sending this message to computer via interrupt.

I configure CAN0 with RX FIFO mode and enable the corresponding interrupt. I can send a default CAN message at the start of the program. I also see the blue light twinkling as a flag of CAN module receiving normally while i don't read that CAN message. However, I can't read this CAN message to a message variable. When i use the function FLEXCAN_DRV_RxFifo in the interrupt, it only send back a default CAN message for the first time and then have no reaction for next CAN message. 

The interrupt i enable is CAN0_ORed_0_15_MB_IRQn, and the interrupt handler is shown below:

捕获.PNG

 

 

 

 

 

Besides, i use S32DS_ARM_v2018.R1  as IDE and EAR SDK v0.8.6 for assistance.

0 Kudos
1 Solution
1,239 Views
Yanncy
Contributor I

Dear PetrS:

Thanks for your suggestion. Although i download the V2.2 S32DS IDE with RTM 3.0.0 SDK, my project still don't work. There might be some key points about how to use SDK functions that i haven't understand. So i write a ReceiveFifo function referring to the datasheet by myself. Lucky, it works. My function is attached below. Still, thanks again!

void ReceiveFifo(uint32_t *RxID,uint8_t *RxData)
{
uint32_t Word1,Word2;

RxCODE= (CAN0->RAMn[0] & 0x00300000) >> 20; /* Read CODE field */
*RxID = (CAN0->RAMn[1] & CAN_WMBn_ID_ID_MASK) >> CAN_WMBn_ID_ID_SHIFT; /* Read ID */
Word1 = CAN0->RAMn[2]; /* Read data field */
Word2 = CAN0->RAMn[3];
RxData[0] = (Word1 & 0xFF000000) >>24;
RxData[1] = (Word1 & 0x00FF0000) >>16;
RxData[2] = (Word1 & 0x0000FF00) >>8;
RxData[3] = (Word1 & 0x000000FF) >>0;
RxData[4] = (Word2 & 0xFF000000) >>24;
RxData[5] = (Word2 & 0x00FF0000) >>16;
RxData[6] = (Word2 & 0x0000FF00) >>8;
RxData[7] = (Word2 & 0x000000FF) >>0;
RxIDHIT = CAN0->RXFIR; /* Read RXFIR */
}

 

View solution in original post

0 Kudos
2 Replies
1,256 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

 

I can suggest to use newer SDK version, now RTM 3.0.3. Try to update SDK from the S32DS you have.

Or install S32DS v 2.2; https://community.nxp.com/t5/S32-Design-Studio-Knowledge-Base/S32-Design-Studio-for-ARM-2-2-Windows-...

Some example with RXFIFO usage can be found in https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-FlexCAN-RXFIFO-DMA-S32DS-ARM-2018-R...

 

BR, Petr

 

0 Kudos
1,240 Views
Yanncy
Contributor I

Dear PetrS:

Thanks for your suggestion. Although i download the V2.2 S32DS IDE with RTM 3.0.0 SDK, my project still don't work. There might be some key points about how to use SDK functions that i haven't understand. So i write a ReceiveFifo function referring to the datasheet by myself. Lucky, it works. My function is attached below. Still, thanks again!

void ReceiveFifo(uint32_t *RxID,uint8_t *RxData)
{
uint32_t Word1,Word2;

RxCODE= (CAN0->RAMn[0] & 0x00300000) >> 20; /* Read CODE field */
*RxID = (CAN0->RAMn[1] & CAN_WMBn_ID_ID_MASK) >> CAN_WMBn_ID_ID_SHIFT; /* Read ID */
Word1 = CAN0->RAMn[2]; /* Read data field */
Word2 = CAN0->RAMn[3];
RxData[0] = (Word1 & 0xFF000000) >>24;
RxData[1] = (Word1 & 0x00FF0000) >>16;
RxData[2] = (Word1 & 0x0000FF00) >>8;
RxData[3] = (Word1 & 0x000000FF) >>0;
RxData[4] = (Word2 & 0xFF000000) >>24;
RxData[5] = (Word2 & 0x00FF0000) >>16;
RxData[6] = (Word2 & 0x0000FF00) >>8;
RxData[7] = (Word2 & 0x000000FF) >>0;
RxIDHIT = CAN0->RXFIR; /* Read RXFIR */
}

 

0 Kudos