Hello,
I am trying to understand the CAN reception for the MPC5748G Dev Kit, I am using S32KDS for generation and development of the code. I am trying to read the CAN messages , I am not understanding the MB argument in the function call FLEXCAN_DRV_Receive(); if i send the CAN messages from Canoe it is receiving perfect as i dont see any ACK error , but I am not getting the data in pay load, my setting for the CAN0 is as shown in the snap shot , below.
i am using the MB= 0 for the experiment purpose.
some one could please help me ?
my code is as below
int main(void)
{
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
#ifdef PEX_RTOS_INIT
PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
/* For example: for(;;) { } */
uint8_t buff[]={'H','e','l','l','O','\n'};
flexcan_msgbuff_t my_data;
uint8_t payload[9];
uint8_t i;
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0u,CLOCK_MANAGER_POLICY_FORCIBLE);
LINFLEXD_UART_DRV_Init(INST_LINFLEXD_UART1,&linflexd_uart1_State,&linflexd_uart1_InitConfig0);
FLEXCAN_DRV_Init(INST_CANCOM1, &canCom1_State, &canCom1_InitConfig0);
while (1)
{
if( STATUS_SUCCESS == FLEXCAN_DRV_Receive(INST_CANCOM1,0,&my_data))
{
for (i=0;i<8;i++)
{
payload[i]= my_data.data[i];
}
payload[8]='\n';
LINFLEXD_UART_DRV_SendData(INST_LINFLEXD_UART1,payload,8);
OSIF_TimeDelay(500);
SIUL2->GPDO[0]=1;
}
else
{
SIUL2->GPDO[1]=1;
}
LINFLEXD_UART_DRV_SendData(INST_LINFLEXD_UART1,buff,6);
OSIF_TimeDelay(500);
}
Thank you very much in advance
Best Regards
Laxmikanth Indur
Hi,
Please refer to the SDK's “flexcan_mpc5748g” demo example to know how the driver could be used.
Before you start receiving you should configure RX MB using FLEXCAN_DRV_ConfigRxMb().
The FLEXCAN_DRV_Receive() just enable interrupt for given MB and FLEXCAN_DRV_GetTransferStatus() can be used to know if the the previous FlexCAN receive is completed.
BR, Petr