2017-04-26 07:18 AM
Hi all,
I found my call HAL_UART_Receive() doesn't timeout. Do you have any suggestion what I forget configure?
In CubeMX, I add uart2 and tim2 and I add my timer callback as this.
/* USER CODE BEGIN 4 */
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim){ sprintf(aTxBuffer,'\r\nSTM32CubeMX rocks %d times \t', ++nbtime); HAL_UART_Transmit(&huart2,(uint8_t *) aTxBuffer, strlen(aTxBuffer), 5000); //printf('input:\r\n'); HAL_UART_Receive(&huart2,(uint8_t *) aRxBuffer, 10, 500); HAL_UART_Transmit(&huart2,(uint8_t *) ack, 11, 5000);}/* USER CODE END 4 */If I input 10 characters, the code works well. However, if I don't input any thing,
HAL_UART_Receive() will not return. I believe it should return in 5000 ms. Do you have any idea about this?
PS: I'm using STM32L072.
#hal_uart_receive() #uartSolved! Go to Solution.
2017-04-26 08:40 AM
Calling blocking functions in interrupt context is always a really bad plan.
You are going to need to ensure that the ticker interrupt used for the timeout preempts anything that is relying on it.
2017-04-26 08:40 AM
Calling blocking functions in interrupt context is always a really bad plan.
You are going to need to ensure that the ticker interrupt used for the timeout preempts anything that is relying on it.