Remote frame receiving of the S32K148 FlexCAN module

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Remote frame receiving of the S32K148 FlexCAN module

447件の閲覧回数
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 件の賞賛
2 返答(返信)

435件の閲覧回数
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 件の賞賛

420件の閲覧回数
SONGTAOSI
Contributor I

Hi,

Thank you for reply.

0 件の賞賛