Remote frame receiving of the S32K148 FlexCAN module

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

Remote frame receiving of the S32K148 FlexCAN module

619 Views
SONGTAOSI
Contributor I

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));

}

0 Kudos
Reply
2 Replies

607 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

by default the remote request frame is not stored into any MB. This is determined by CTRL2[RRS]. Read chapter 55.3.10.4 Remote frames for more info.

The FLEXCAN_DRV_ConfigRemoteResponseMb function can be used to prepare MB for remote request response. This need to be called just once, you need not to config MB every time. Once remote request frame is received with configured ID a message buffer becomes TX, sends a remote response and switch back to RX one to again recognize a Remote Request Frame and transmit a Response Frame in return.

BR, Petr

0 Kudos
Reply

592 Views
SONGTAOSI
Contributor I

Hi,

Thank you for reply.

0 Kudos
Reply