Skip to main content
danelifab
Associate II
October 1, 2025
Solved

STM32H7 UART8 interrupt not working

  • October 1, 2025
  • 3 replies
  • 268 views

Hi everyone, I'm using a Riverdi board (STM32 10.1" Rev. 1.2) with an STM32H747XIH6, and I'm having trouble with the UART8 in single-wire mode. I can't get the interrupt callback function to be called when data is received on that port.

This board uses TouchGfx and FreeRTOS.

I'm using a test interrupt code just for the UART8, but it's not responding.

If I use the blocking function HAL_UART_Receive(...), I receive consistent data, so I don't think it's a wiring or pinout issue. 

I have checked that the signal is coming in with the oscilloscope.

I have the global interrupt enabled for the UART8.

The code I'm using is this, in freertos.c

void startUartTask(void *argument)
{
 /* USER CODE BEGIN startUartTask */
	memset(rxBuffer, 65, 128);
	HAL_HalfDuplex_EnableReceiver(&huart8);
	HAL_UARTEx_ReceiveToIdle_IT(&huart8, rxBuffer, 64);

	/* Infinite loop */
	for(;;)
	{
		//HAL_UART_Receive(&huart8, rxBuffer, 128, 120);
		osDelay(10);
	}
 /* USER CODE END startUartTask */
}

 

In main.c

void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
	HAL_UARTEx_ReceiveToIdle_IT(&huart8, rxBuffer, 128);
}

 

I have enabled the interrupt in CubeMX for UART8 and pin J8 (UART8 TX) is configured as pullup but the callback is never called.

The task starts normally and runs.

I don't understand what's going wrong, any ideas?

 

Thanks

 

 

 

 
Best answer by danelifab

Hi Tesla, thanks for your reply. Sorry for the delay, but I was trying a few things to troubleshoot the issue.

I found the problem. The device I connected is a GPS, it sends data continuously, and the MCU receives the HAL_UART_ERROR_ORE flag the first time the UART8 interrupt is enabled, because the GPS is sending data, but it's not being read. This flag must be cleared with __HAL_UART_CLEAR_OREFLAG(&huart8) before the interrupt is triggered.

 

Thanks for your time.

3 replies

Tesla DeLorean
Guru
October 1, 2025

Check startup_stm32h747xx.s for UART8_IRQHandler, confirm build and linkage.

Check UART8_IRQHandler code and that it is a) reached, and b) calls into the HAL infrastructure.

Check HAL_UARTEx_RxEventCallback() is entering with huart handle pointing at your huart8 structure, verify, don't assume.

Check NVIC side configuration/recognition

Check UART8 a register level

 

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

Perhaps going to a different call-back?

Dump UART status in your UART8_IRQHandler to confirm subsequent dispatch path in HAL

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
danelifab
danelifabAuthorBest answer
Associate II
October 10, 2025

Hi Tesla, thanks for your reply. Sorry for the delay, but I was trying a few things to troubleshoot the issue.

I found the problem. The device I connected is a GPS, it sends data continuously, and the MCU receives the HAL_UART_ERROR_ORE flag the first time the UART8 interrupt is enabled, because the GPS is sending data, but it's not being read. This flag must be cleared with __HAL_UART_CLEAR_OREFLAG(&huart8) before the interrupt is triggered.

 

Thanks for your time.