cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX define "USE_HAL_USART_REGISTER_CALLBACKS"

MMüll.6
Associate III

Hello,

The CubeMX and the ST HAL has in the files "stm32XXxx_hal_conf.h" the

#define USE_HAL_USART_REGISTER_CALLBACKS

When I looking in the source code, there is no position to find where is this define used:

Searching for 'USE_HAL_USART_REGISTER_CALLBACKS'...

D:\Project\Core\Inc\stm32g4xx_hal_conf.h(108) : #define USE_HAL_USART_REGISTER_CALLBACKS     1U

Lines matched: 1     Files matched: 1     Total files searched: 130

In Activate this configuration with "USART" has no effect (CubeMx).

I think you can delete this define in all your HAL libraries and other software.

Best Regards, Markus


_legacyfs_online_stmicro_images_0693W00000biiOIQAY.png

3 REPLIES 3

It's definitely used. Maybe not with your specific MCU model and STM32CubeMX version. It's used in stm32*_hal_uart.c and stm32*_hal_uart.h with all the MCUs I've used so far. CubeMX has to be compatible with many MCU models and library versions, so it certainly is possible there are unused settings. What's your MCU model and STM32CubeMX version?

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.
MMüll.6
Associate III
  • CubeMX: 6.8.0
  • STM32G473
  • STM32H753

USE_HAL_UART_REGISTER_CALLBACKS is used, but USE_HAL_USART_REGISTER_CALLBACKS isn't. UARTs, USARTs and LPUARTs use the same code(with checks like IS_LPUART_INSTANCE for the differences) so these callbacks are enabled for all of them or for none of them. They should have changed it so that if USE_HAL_UART_REGISTER_CALLBACKS or USE_HAL_USART_REGISTER_CALLBACKS is set to true that the callbacks are enabled. But they chose to ignore one of them. This is indeed a mistake by ST.

Use the other setting and it should work!

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.