Hi @PetrS ,
I have successfully transmitted multiple messages on CAN bus.
I am still stuck in situation for receiving CAN messages. Please see the attached screenshots, Even if I am not sending any message still "RStatus" is "FLEXCAN_STATUS_SUCCESS", and when I am sending message from PCAN then also the "RStatus" is "FLEXCAN_STATUS_SUCCESS".
The msgID shows some garbage value.
Hi,
if want to use polling mode then have below code for each reception. This would be
- start receiving, i.e. call FlexCAN_Ip_Receive
- check status using FlexCAN_Ip_GetTransferStatus and call FlexCAN_Ip_MainFunctionRead repeatedly to process received message in given MB.
FlexCAN_Ip_Receive(INST_FLEXCAN_0, RX_MB_IDX, &rxData, TRUE);
while(FlexCAN_Ip_GetTransferStatus(INST_FLEXCAN_0, RX_MB_IDX) !=FLEXCAN_STATUS_SUCCESS)
{ FlexCAN_Ip_MainFunctionRead(INST_FLEXCAN_0, RX_MB_IDX); }
...process received data in user buffer here
BR, Petr
Hi @PetrS ,
I tried this but FlexCAN_Ip_GetTransferStatus(INST_VS_0_FLEXCAN_0, RX_MB_IDX) returns "FLEXCAN_STATUS_SUCCESS" every time.
When I debugged the code I found that the below base->IFLAG1 is setting to 0 and hence causing the skipping of while loop.
Can you please help me to know from where is this getting set to 0, I tried debugging but didn't find the exact loophole?
Hi,
you can refer to below example which shows multiple MBs usage with interrupt/callbacks too.
https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K344-FlexCAN-Ip-TX-RX-EnhanceRXFIFO-test...
It is for S32K344, but it is similar.
BR, Petr
Hi,
did not get a point much.
On the bus there is always just single message at the time, the one sent from a node which won bus arbitration. If node/MCU is receiving this message, it will be stored in MB/RXFIFO if MB/RXFIFO was configured to receive this message. Meanwhile a node can have prepared other MBs for message transmissions and those will be transmitted once selected by internal arbitration process and after first opportunity window on the bus.
BR, Petr