Picture1 : Set flexcan1 to fifo receive mode and dma send mode
Picture 2 Set flexcan2 to fifo receive mode and dma send mode
Picture 3
Picture 4
But when I downloaded the program to the chip, when can data come , it got stuck in the image below。
Picture 5 Where the program stuck
However, when I changed the send mode to interrupt mode, the program could run, but when sending multiple CAN data, some CAN data frames would be missed. Unless I insert a 1ms delay function after each CAN send data frame.(Because I set up 16 filters, MB0 to 5 is occupied by data frames, MB6 to 9 is occupied by filters, so I use the sending mailbox MB10 to MB15)
I would like to know why FLEXCAN data frames cannot be sent in dma mode, please kindly ask NXP technical staff to help answer it, thank you!
Hi,
could you please specify the SDK version you are using? Or better share full project you have so we can check and test. How modules are used, you do communication between CAN1 and CAN2 or are you somehow connected to other nodes?
Did you meant you cannot send message using TX MBs when DMA is used to read out RXFIFO? There shouldn't be issue with this. YOu can refer to below example,
https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-FlexCAN-RXFIFO-DMA-S32DS-ARM-2018-R...
BR, Petr
Hi:
First, the SDK version I'm using is 3.0.0;
Second, I used CAN1 and CAN2 interfaces of a control circuit board to communicate with multiple external devices at the same time, rather than directly connecting CAN1 and CAN2.
Third, what I said above about the failure is wrong, the reality is that when the program is running, the data can be sent from my control board (which I observed with PEAKCAN), but once the external device run and starts sending data, my board starts receiving data. The program gets stuck inside the FLEXCAN_IRQHandler's while((flag_req&1u) == 0U);
Look forward to your professional answer, thank you
Hi,
if remember well there was some issue in S32PA RTM 3.0 regards desynchronization of MB status with the IFLAGs flags.
The solution was to apply a check at the end of ISR function check in FLEXCAN_IRQHandler:
if (FLEXCAN_GetMsgBuffIntStatusFlag(base, mb_idx) != 0U)
{
/* In case of desynchronized status of the MB to avoid trapping in ISR
* clear the MB flag */
FLEXCAN_ClearMsgBuffIntStatusFlag(base, mb_idx);
}
This would be fixed in SDK 4.0.x. Moreover SDK30 is no longer maintained, I think, so it is advisable to use latest one, or move to RTD driver.
BR, Petr
Thank you for your reply. After a week of code debugging, the above problems have been solved;
But here's a new problem:
When my target board sends only one frame of data with a period of 10 seconds, the software shows that the receiving time period is very small error.
When my target board sent multiple frames of different periods of data, the original 10-second cycle of CAN data frame receiving time error became very large, and the entire program running slower, I roughly calculated that the program running 2 minutes of error is 4 seconds.
Is there a solution?