I use DMA to accept CAN bus RX data from ECU。But in fifo + dma mode, it may be that fifo can only store up to 5 messages,If at this time the ECU sends 10 messages,There must be a situation where the first five messages are received and the interrupt is entered, causing the following five messages to be lost。Is there a better way to avoid data loss on the CAN bus?
Solved! Go to Solution.
Hi,
the RXFIFO can store up to 6 messages and it is up to used to read it out so another message can be stored in RXFIFO otherwise further messages can be lost for sure. Ideally you could have IFLAG1[BUF5I] interrupt enabled so it will be called if there is message available in the RXFIFO. If DMA is used then DMA request to read single message from RXFIFO is generated on IFLAG1[BUF5I] flag. If teh DMA is not blocked by higher priority DMA transfers, you should not see a situation you outlined.
BR, Petr
Hi,
the RXFIFO can store up to 6 messages and it is up to used to read it out so another message can be stored in RXFIFO otherwise further messages can be lost for sure. Ideally you could have IFLAG1[BUF5I] interrupt enabled so it will be called if there is message available in the RXFIFO. If DMA is used then DMA request to read single message from RXFIFO is generated on IFLAG1[BUF5I] flag. If teh DMA is not blocked by higher priority DMA transfers, you should not see a situation you outlined.
BR, Petr