Hello Community,
I created one project for the understanding of the FlexCAN Module.in my test project i added the FlexCAN Module and trying to do the communication over the CAN bus.i am able to send the data over CAN from my NXP Board to another node.
but in receiving i am able to receive the data on my receive buffer but in my FLEXCAN_DRV_GetTransferStatus
while(FLEXCAN_DRV_GetTransferStatus(INST_CANCOM1, RX_MAILBOX) == STATUS_BUSY);
I am not getting the STATUS_BUSY .
and but
/* Start receiving data in RX_MAILBOX. */
FLEXCAN_DRV_Receive(INST_CANCOM1, RX_MAILBOX, &recvBuff);
I am able to see the data as it is in the recvBuff.
I don't know what I missed here.
Kindly let me know how I can proceed here.
PFA for my main.c File.and FlexCAN module configuration.
Thanks in advance,
Rohit Alate
Hi,
your setting and code looks normal, it follows a demo example, i think.
The FLEXCAN_DRV_Receive function initiate (start) a receive by beginning the process of receiving data and enabling the interrupt for given MB. Internal MB status is changed to FLEXCAN_MB_RX_BUSY. The receive buffer is filled and internal driver MB status is updated within driver interrupt upon message is accepted and moved into selected MB.
So if you see receive buffer updated this interrupt should be called and MB status updated (FLEXCAN_MB_IDLE). This MB status is checked by FLEXCAN_DRV_GetTransferStatus function, which returns STATUS_BUSY when MB does not receive new message and STATUS_SUCCESS if receiving is complete.
So as you wrote you are not getting STATUS_BUSY, does it mean the code does not wait on while loop until message is received?
BR, Petr