I want to verify the remote frame sending and receiving function, but I can't receive the remote frame. It is normal to send and receive data frames. Can I modify the part marked red in the code to send and receive remote frames? You can provide the code for remote frame reception.
can_buff_config_t buffCfg = {
.enableFD = false,
.enableBRS = false,
.fdPadding = 0U,
.idType = CAN_MSG_ID_STD,
.isRemote = true
};
/* Configure RX buffer with index RX_MAILBOX */
CAN_ConfigRxBuff(&can_pal1_instance, RX_MAILBOX, &buffCfg, RX_MSG_ID);
while(1)
{
/* Define receive buffer */
can_message_t recvMsg ;
/* Start receiving data in RX_MAILBOX. */
CAN_Receive(&can_pal1_instance, RX_MAILBOX, &recvMsg);
/* Wait until the previous FlexCAN receive is completed */
while(CAN_GetTransferStatus(&can_pal1_instance, RX_MAILBOX) == STATUS_SUCCESS);
/* Check the received message ID and payload */
if( recvMsg.id == RX_MSG_ID ) //
{
/* Toggle output value LED1 */
PINS_DRV_TogglePins(GPIO_PORT, (1 << LED0));
}