I have the following block of code to receive Can Messages, however I usually only get 1 or 2 times through the while loop before the program hangs in the /* Wait until Rx MB full. */ loop.
I also want to filter to only receive NMEA2000 PGN 1F805, but am using my test ID of rxIdentifier = 0xDF80502; for now which is being sent from a separate test device on the can network.
I must be missing a step to clear the buffer?
while (true)
{
/* Start receive data through Rx Message Buffer. */
rxXfer.mbIdx = (uint8_t)RX_MESSAGE_BUFFER_NUM;
rxXfer.frame = &frame;
(void)FLEXCAN_TransferReceiveNonBlocking(EXAMPLE_CAN, &flexcanHandle, &rxXfer);
/* Wait until Rx MB full. */
while (!rxComplete)
{
};
rxComplete = false;
LOG_INFO("Rx MB ID: 0x%3x, Rx MB data: 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, Time stamp: %d\r\n", frame.id >> CAN_ID_EXT_SHIFT, frame.dataByte0, frame.dataByte1, frame.dataByte2, frame.dataByte3, frame.dataByte4, frame.dataByte5, frame.dataByte6, frame.dataByte7, frame.timestamp);
}
This is the only masking mechanism I see, how can I set the proper mask for matching specific part of a CAN ID?
/* Set Rx Masking mechanism. */
FLEXCAN_SetRxMbGlobalMask(EXAMPLE_CAN, FLEXCAN_RX_MB_EXT_MASK(rxIdentifier, 1, 0));
I believe this issue to due to a misconfigured TJA1152 CAN Tranciever. NDA required for documentation.
Hello @stevenlutz
It seems that the issue is related to your private ticket. I have replied to you on that ticket. Please contact me if you still have any issues.
BR
Alice