I am trying to read can frames by polling and, to check whether there a new frame available I check the corresponding bit from the IFLAG register. What I am seeing is that if the CAN message doesn't have a DLC equal to 8 bytes, then checking the IFLAG doesn't work. Does that make sense? Can anybody tell me how to check for a received frame no matter the DLC value?
I am using FLEXCAN0 through PTE4 and PTE5. The code line I use to check if there is a new frame is:
if ((CAN0->IFLAG1 >> 4) & 1)