AnsweredAssumed Answered

CAN Messages reception

Question asked by Laxmikanth Indur on Mar 26, 2018
Latest reply on Mar 28, 2018 by Petr Stancik

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

Outcomes