AnsweredAssumed Answered

Flexcan receiver file RT1021

Question asked by Carlos Candido on Nov 13, 2019
Latest reply on Nov 18, 2019 by Hui_Ma

Hi,

my test with   RT1020-EVK

receiver file via CAN 500kbps.

 

Problems:

file 256k.....receiver 10k, 36, max 46k, and values the bytes in frame.

 

The interval between frames is 24,000 uS, and I use interrupt to save frames, then I can't time to reset the receiver and end up losing frames.

 

see:

code part:

static void flexcan_callback(CAN_Type *base, flexcan_handle_t *handle, status_t status, uint32_t result, void *userData)
{

switch (status)
{
case kStatus_FLEXCAN_RxIdle:
if (RX_MESSAGE_BUFFER_NUM == result)
{
can_temp.id = rxframe.id;
can_temp.length = rxframe.length;
can_temp.dataWord0 = rxframe.dataWord0;
can_temp.dataWord1 = rxframe.dataWord1;

 

rxframe.id = FLEXCAN_ID_STD(rxIdentifier);
rxXfer.mbIdx = RX_MESSAGE_BUFFER_NUM;
rxXfer.frame = &rxframe;
FLEXCAN_TransferReceiveNonBlocking(EXAMPLE_CAN, &flexcanHandle, &rxXfer);

rxComplete = true;

 

} else if (RX_MESSAGE_BUFFER_11 == result).....blablabla

-------------- save frames

CAN_BUF[bfifo_indx][i++] = can_temp.dataByte0;
CAN_BUF[bfifo_indx][i++] = can_temp.dataByte1;
CAN_BUF[bfifo_indx][i++] = can_temp.dataByte2;

-------------------------------------------

interrupt long time.

 

How to solved it.

Fifo + DMA  how to ?

or other solution.

 

thanks,

Carlos.

Outcomes