cancel
Showing results for 
Search instead for 
Did you mean: 

Changes required in the CAN configurations for stm32f413xx, since the below configurations in the code is not working

Gautham  Y.T
Associate II
Posted on December 08, 2017 at 12:32

void MXCAN1Init(void)

{

    __HAL_RCC_CAN1_CLK_ENABLE();

    stat_stCAN_HandleTypeDefHCan1.Instance = CAN1;

    //stat_stCAN_HandleTypeDefHCan1.Init.Prescaler = (U16)((U32)HAL_RCC_GetPCLK1Freq() /

    //                                                     (16U * CAN_BAUD_RATE_BPS));

    stat_stCAN_HandleTypeDefHCan1.Init.Prescaler = 16;

    stat_stCAN_HandleTypeDefHCan1.Init.Mode = CAN_MODE_NORMAL;

    stat_stCAN_HandleTypeDefHCan1.Init.SJW = CAN_SJW_1TQ;

    //stat_stCAN_HandleTypeDefHCan1.Init.BS1 = CAN_BS1_8TQ;

    stat_stCAN_HandleTypeDefHCan1.Init.BS1 = CAN_BS1_6TQ;

    //stat_stCAN_HandleTypeDefHCan1.Init.BS2 = CAN_BS2_7TQ;

    stat_stCAN_HandleTypeDefHCan1.Init.BS2 = CAN_BS2_8TQ;

    stat_stCAN_HandleTypeDefHCan1.Init.TTCM = (U32)DISABLE;

    stat_stCAN_HandleTypeDefHCan1.Init.ABOM = (U32)DISABLE;

    stat_stCAN_HandleTypeDefHCan1.Init.AWUM = (U32)DISABLE;

    stat_stCAN_HandleTypeDefHCan1.Init.NART = (U32)DISABLE;

    stat_stCAN_HandleTypeDefHCan1.Init.RFLM = (U32)DISABLE;

    stat_stCAN_HandleTypeDefHCan1.Init.TXFP = (U32)DISABLE;

    if (HAL_CAN_Init(&stat_stCAN_HandleTypeDefHCan1) != HAL_OK)

    {

        ErrorHandler();

    }

}

2 REPLIES 2
Imen.D
ST Employee
Posted on December 11, 2017 at 13:52

Hello,

You are not providing many details about your issue.

Can you clarify more your problem?

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on December 14, 2017 at 13:37

The code is entering the while loop and getting stuck there in stm32f4xx_hal_can.c file....the image for the same is provided below0690X00000609CtQAI.png