Skip to main content
Stastny.Petr
Associate III
September 15, 2018
Question

Why does not work UART3 RX interrupt?

  • September 15, 2018
  • 1 reply
  • 488 views
#define RXBUFFERSIZE 2
uint8_t aRxBuffer[RXBUFFERSIZE];
static void MX_USART3_UART_Init(void) {
 
__HAL_RCC_USART3_CLK_ENABLE();
 huart3.Instance = USART3;
 huart3.Init.BaudRate = 115200;
 huart3.Init.WordLength = UART_WORDLENGTH_8B;
 huart3.Init.StopBits = UART_STOPBITS_1;
 huart3.Init.Parity = UART_PARITY_NONE;
 huart3.Init.Mode = UART_MODE_TX_RX;
 huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
 if(HAL_UART_DeInit(&huart3) != HAL_OK)
 {
 Error_Handler();
 } 	
 if (HAL_UART_Init(&huart3) != HAL_OK)
 {
 Error_Handler();
 }
	
	if (HAL_UART_Receive_IT(&huart3, (uint8_t *)aRxBuffer, RXBUFFERSIZE) != HAL_OK) {
 Error_Handler();
 }
}
void USARTx_IRQHandler(void)
{
 HAL_UART_IRQHandler(&huart3);
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle)
{
ToggleLED(LED1);
}

My idea is that when I receive the byte, LED toggles. But instead of this, STM32F103RB is frozen. I do not see any problem. Can you help me please?

This topic has been closed for replies.

1 reply

Tesla DeLorean
Guru
September 15, 2018

Try being explicit

  1. void USART3_IRQHandler(void)
  2. {
  3. HAL_UART_IRQHandler(&huart3);
  4. }

And if you don't get a multiple definition error, check the macro

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..