FLEXCAN_TransferReceiveNonBlocking high data rate issue

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

FLEXCAN_TransferReceiveNonBlocking high data rate issue

627 Views
jvanzuijlen
Contributor I

I am running into an issue when receiving data t 1Mbit/s. My setup is as followed: I have a MIMXRT1062 connected to a PEAK-CAN. I am using the FLEXCAN_TransferReceiveNonBlocking with a ISR that puts the received data into a FreeRTOS queue.

When sending two different type of messages using the PEAK-CAN both at 5ms or less I run into the following issue. Let's say the PEAK-CAN sends 500 messages with ID 1 and 500 with ID 2. Then the task that empties the FreeRTOS queue will find 550 messages with ID1 and 450 with ID 2. This indicates that the ISR is fired the correct amount but the data being put in the queue is being re-used of a previous message?

My ISR looks as followed:

 
void ITCMFUNC_ATTR MailBox::retrieveFrameFromISR(BaseType_t &higherPrioTaskWoken)
{
    // Retrieve ID for message
    auto    &f     = _frame;
    bool     isEff = f.format == kFLEXCAN_FrameFormatExtend;
    bool     isRtr = f.type == kFLEXCAN_FrameTypeRemote;
    uint32_t id    = isEff ? ((f.id & (CAN_ID_EXT_MASK | CAN_ID_STD_MASK)) >> CAN_ID_EXT_SHIFT) :
                             ((f.id & CAN_ID_STD_MASK) >> CAN_ID_STD_SHIFT);

    // Push back the message to the receivers
    for(auto &receiver : _receivers)
    {
        if(receiver.filter.matches(id, isRtr, isEff))
        {
            receiver.obj->rxQueue.sendToBackFromISR(_frame, higherPrioTaskWoken);
        }
    }

    // Setup the transfer
    flexcan_mb_transfer_t xfer;
    xfer.frame = &_frame;
    xfer.mbIdx = _mbIdx;
    FLEXCAN_TransferReceiveNonBlocking(_can->_base, &_can->_handle, &xfer);
}
 
The _frame is only accessed in the ISR. I call the FLEXCAN_TransferReceiveNonBlocking once to start receiving and keep calling it in the ISR to keep receiving after a message has been received.
0 Kudos
Reply
1 Reply

595 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @jvanzuijlen,

Do you also see this issue in one of our FlexCAN SDK examples? Does increasing the core frequency change anything?

 

0 Kudos
Reply