Sending CAN message in loop but still can see the message only once

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

Sending CAN message in loop but still can see the message only once

538 Views
RishikeshB
Contributor II

Hello NXP,

I am trying to send CAN message in loop but in response   i am receiving it only one time PFA of my code and the screenshot, and please check ad let me know

 

0 Kudos
1 Reply

529 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

as per your code you sent a 0x74F message and waiting till 0x74E message is received, then message is send again and all is repeated. So did you sent above message from CAN tool?
You can use "if" statement instead of "while" to do not wait on that.

flexcan_msgbuff_t recvBuff;
FLEXCAN_DRV_Send(INST_CANCOM1,TX_MAILBOX,&buff_RxTx_Cfg,(uint32_t)TX_PHY_ID,msg_data);
/* Start receiving data in RX_MAILBOX. */
FLEXCAN_DRV_Receive(INST_CANCOM1, RX_MAILBOX, &recvBuff);
while(1)
{
	/* if the previous FlexCAN receive is completed */
	if(FLEXCAN_DRV_GetTransferStatus(INST_CANCOM1, RX_MAILBOX) != STATUS_BUSY);
	{
           // process incomming data and enable receive again
           FLEXCAN_DRV_Receive(INST_CANCOM1, RX_MAILBOX, &recvBuff);
	   /* Toggle output value LED0 & LED1 */
	   PINS_DRV_TogglePins(GPIO_PORT, ((1 << LED1) | (1 << LED2)));
        }
        if(FLEXCAN_DRV_GetTransferStatus(INST_CANCOM1, TX_MAILBOX) != STATUS_BUSY);
	{ 
           FLEXCAN_DRV_Send(INST_CANCOM1,TX_MAILBOX,&buff_RxTx_Cfg,(uint32_t)TX_PHY_ID,msg_data);
        }
}


BR, Petr

0 Kudos