HI:
/**************************
Using MPC5748G Devkit, and some key configuration to FlexCAN component in S32DS for PA:
Baudrate: arbitration phase: 500kbps, data phase: 2Mpbs.
Enable CANFD, and payload size is "FLEXCAN_PAYLOAD_SIZE_64"
Module clock and pe clock keep default.(80MHz, 40MHz)
MB number is set 16;
Please see the attachment(config flexcan.jpg) for details。
******************************/
The following soures is to config the flexcan using S32_SDK_S32PA_RTM_3.0.3:
/* CAN hardware MB(Message Buffer) configuration */
flexcan_data_info_t CAN_TX_MB1_Config = {
.msg_id_type = FLEXCAN_MSG_ID_STD,
.data_length = 8,
.fd_enable = false,
.fd_padding = 0x00,
.enable_brs = false,
.is_remote = false};
flexcan_data_info_t CAN_TX_MB2_Config = {
.msg_id_type = FLEXCAN_MSG_ID_STD,
.data_length = 64,
.fd_enable = true,
.fd_padding = 0x00,
.enable_brs = true,
.is_remote = false};
flexcan_data_info_t CAN_RX_MB1_Config = {
.msg_id_type = FLEXCAN_MSG_ID_STD,
.data_length = 8,
.fd_enable = false,
.fd_padding = 0x00,
.enable_brs = false,
.is_remote = false};
flexcan_data_info_t CAN_RX_MB2_Config = {
.msg_id_type = FLEXCAN_MSG_ID_STD,
.data_length = 64,
.fd_enable = true,
.fd_padding = 0x00,
.enable_brs = true,
.is_remote = false};
/* initialize the FlexCAN PD driver */
FLEXCAN_DRV_Init(INST_CANCOM1, &canCom1_State, &canCom1_InitConfig0);
/* install the event handler call back */
FLEXCAN_DRV_InstallEventCallback(INST_CANCOM1,CAN_TX_RX_Callback, NULL);
/* install the FlexCAN error ISR callback */
FLEXCAN_DRV_InstallErrorCallback(INST_CANCOM1, CAN_Error_Callback,NULL);
/* configure the TX MB */
FLEXCAN_DRV_ConfigTxMb(INST_CANCOM1,TX_MB1, &CAN_TX_MB1_Config,0x000);
FLEXCAN_DRV_ConfigTxMb(INST_CANCOM1,TX_MB2, &CAN_TX_MB2_Config,0x000);
/* configure the RX MB with receive acceptance ID */
FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1,RX_MB1, &CAN_RX_MB1_Config,0x000);
FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1,RX_MB2, &CAN_RX_MB2_Config,0x000);
FLEXCAN_DRV_SetRxMbGlobalMask(INST_CANCOM1,FLEXCAN_MSG_ID_STD,FLEXCAN_RX_MASK_GLOBAL);
/* start the individual MB CAN message receive */
FLEXCAN_DRV_Receive(INST_CANCOM1, RX_MB1, &CAN_RX_Message_Buffer[0]);
FLEXCAN_DRV_Receive(INST_CANCOM1, RX_MB2, &CAN_RX_Message_Buffer[1]);
FLEXCAN_DRV_SendBlocking(INST_CANCOM1, TX_MB1, &CAN_TX_MB1_Config, 0x111, &TX_MB1_Data, 1000);
FLEXCAN_DRV_SendBlocking(INST_CANCOM1, TX_MB2, &CAN_TX_MB2_Config, 0x222, &TX_MB2_Data, 1000);
Debug on the DEVKIT, and connect pins to CANOE. The result is TX_MB1 and RX_MB1 can send and receive the CAN2.0 message, but TX_MB2 and RX_MB2 can not work normally, How to config the S32DS IDE or MB to send and receive CANFD message?