cancel
Showing results for 
Search instead for 
Did you mean: 

Why is there no "stm32f4xx_hal_uart_ex.c" HAL library in STM32CUbeF4 repository.

MAnto.2
Associate III

I would like to use HAL_UARTEx_RxEventCallback from library "stm32fxxx_hal_uart_ex.c". This driver library is automatically included in STM32CubeIDE if I use F7 MCU but if I use F4 this library is not included. I also noticed it is not included in the github repository

https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Drivers/STM32F4xx_HAL_Driver/Src

How can I get HAL_UARTEx_RxEventCallback to work on F4. Do I have to manually import the library and where can I get one?

5 REPLIES 5
TDK
Guru

It's here:

https://github.com/STMicroelectronics/STM32CubeF4/blob/4aba24d78fef03d797a82b258f37dbc84728bbb5/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c#L2709

Although it's defined as weak and doesn't really help you

> How can I get HAL_UARTEx_RxEventCallback to work on F4.

This is a separate question. You're supposed to implement HAL_UARTEx_RxEventCallback somewhere in your user code. It gets called from within the HAL IRQ handlers. In this case, here:

https://github.com/STMicroelectronics/STM32CubeF4/blob/4aba24d78fef03d797a82b258f37dbc84728bbb5/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c#L2530

If you feel a post has answered your question, please click "Accept as Solution".
MAnto.2
Associate III

I get the undefined reference to `HAL_UARTEx_ReceiveToIdle_DMA' error when I call the:

HAL_UARTEx_ReceiveToIdle_DMA(&huart1, rxBuf, RX_BUF_SIZE);

I think it is because this function is part of extended HAL library "stm32f4xx_hal_uart_ex.c" (note the ex. on the end). And this library is not included in the drivers, but if I use F3 or F7 this library is included.

Dear @MAnto.2​ 

There's no stm32f4xx_hal_uart_ex.c file in STM32CubeF4 HAL drivers.

HAL_UARTEx_ReceiveToIdle_DMA() function is defined in Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c, line 1808, so should be available when you compile the file.

https://github.com/STMicroelectronics/STM32CubeF4/blob/4aba24d78fef03d797a82b258f37dbc84728bbb5/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c#L1808

Regards

MAnto.2
Associate III

Is there any way I can update the drivers or do I have to do it manualy?

V1.26.2 version of STM32CubeF4 package contains all required changes for using Reception To Idle API. F4 HAL drivers available in Drivers/STM32F4xx_HAL_Driver directory