cancel
Showing results for 
Search instead for 
Did you mean: 

CAN STM32F303K8 HAL_TIMEOUT PROBLEM

abdou si
Associate III
Posted on April 24, 2017 at 17:17

Hi

i am working with CAN of STM32F303K8  when i use 

status = HAL_CAN_Receive(&hcan, CAN_FIFO1, 100);

status always  HAL_TIMEOUT 

any help please 

#can #stm32-can #nucleo-f303 #stm32
4 REPLIES 4
Posted on April 24, 2017 at 18:26

Perhaps it is not receiving anything? Is 100ms long enough? Do you have some filter settings that would exclude all traffic? Do you have the wrong data rate set up?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on April 24, 2017 at 19:52

i did use an 

filter 

and this my config

static CanTxMsgTypeDef TxMessage;

 

static CanRxMsgTypeDef RxMessage;

 

hcan.Instance = CAN;

 

hcan.pTxMsg = &TxMessage;

 

hcan.pRxMsg = &RxMessage;

 

hcan.Instance = CAN;

 

hcan.Init.Prescaler = 2;

 

hcan.Init.Mode = CAN_MODE_NORMAL;

 

hcan.Init.SJW = CAN_SJW_1TQ;

 

hcan.Init.BS1 = CAN_BS1_11TQ;

 

hcan.Init.BS2 = CAN_BS2_4TQ;

 

hcan.Init.TTCM = DISABLE;

 

hcan.Init.ABOM = DISABLE;

 

hcan.Init.AWUM = DISABLE;

 

hcan.Init.NART = DISABLE;

 

hcan.Init.RFLM = DISABLE;

 

hcan.Init.TXFP = DISABLE;

 

if (HAL_CAN_Init(&hcan) != HAL_OK)

 

{

 

Error_Handler();

 

}
Posted on April 24, 2017 at 21:10

i did use an filter and this my config 

static CanTxMsgTypeDef TxMessage;

 

static CanRxMsgTypeDef RxMessage;

 

hcan.Instance = CAN;

 

hcan.pTxMsg = &TxMessage;

 

hcan.pRxMsg = &RxMessage;

 

hcan.Instance = CAN;

 

hcan.Init.Prescaler = 2;

 

hcan.Init.Mode = CAN_MODE_NORMAL;

 

hcan.Init.SJW = CAN_SJW_1TQ;

 

hcan.Init.BS1 = CAN_BS1_11TQ;

 

hcan.Init.BS2 = CAN_BS2_4TQ;

 

hcan.Init.TTCM = DISABLE;

 

hcan.Init.ABOM = DISABLE;

 

hcan.Init.AWUM = DISABLE;

 

hcan.Init.NART = DISABLE;

 

hcan.Init.RFLM = DISABLE;

 

hcan.Init.TXFP = DISABLE;

 

if (HAL_CAN_Init(&hcan) != HAL_OK)

 

{

 

Error_Handler();

 

}

Off a 36 MHz clock that would be 1.125 Mbaud. I don't see a filter in the PM

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on April 25, 2017 at 10:27

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6mJ&d=%2Fa%2F0X0000000bvC%2FhQzJ1ho6ae2ukrpa5sBT5x1Ojbjced.QXfqJKbInQgs&asPdf=false