AnsweredAssumed Answered

set two identical id for flexcan rx and tx

Question asked by 植渲 周 on Apr 22, 2020
Latest reply on Apr 26, 2020 by Kerry Zhou

Hello, 

I set flexcan of tx and rx the same ID, and find a strange phenomenon. Flexcan complete after sending will enter callback function and trigger rx flag, but I did not send any data to the MCU.I modified the two are not the same ID, return to normal.

However, I don't set loopback.  

 

the same id:

rxid=txid =0x123;

different id:

txid = 0x321;

rxid = 0x122;

 

 

 

 

 

phenoemon:

 

 

Code function:

MCU waits after sending a data,  and receive data from the computer.

 

Code:

 

while(1):

 

frame.id = FLEXCAN_ID_STD(txIdentifier);
frame.format = kFLEXCAN_FrameFormatStandard;
frame.type = kFLEXCAN_FrameTypeData;
frame.length = 1;
txXfer.mbIdx = TX_MESSAGE_BUFFER_NUM;

txXfer.frame = &frame;
FLEXCAN_TransferSendNonBlocking(EXAMPLE_CAN, &flexcanHandle, &txXfer);

while (!txComplete)
{
};
txComplete = false;


rxXfer.mbIdx = RX_MESSAGE_BUFFER_NUM;

rxXfer.frame = &frame;
FLEXCAN_TransferReceiveNonBlocking(EXAMPLE_CAN, &flexcanHandle, &rxXfer);

/* Wait until Rx MB full. */
while (!rxComplete)
{
};
rxComplete = false;

PRINTF("Rx MB ID: 0x%3x, Rx MB data: 0x%x\r\n", frame.id >> CAN_ID_STD_SHIFT, frame.dataByte0);
PRINTF("Press any key to trigger the next transmission!\r\n\r\n");
frame.dataByte0++;

}

Outcomes