cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 HAL_UARTEx_ReceiveToIdle() function missing

DBara.1
Associate II

Hello. I am working on a project where i need to get different lenghts of data using UART and preferebly with least possible amount of iterrupts, so ive settled to using HAL_UARTEx_ReceiveToIdle() function (when testing the project on F103), but when i moved the project onto F407, i cant seem to find this function.. Was it for some reason removed or renamed, or is my enviroment messing with me?..

12 REPLIES 12

>>..with least possible amount of interrupts

Both these STM32 families interrupt for EVERY BYTE, the HAL decimates the call-back for you, and adds a lot of its own weight.

I suspect the ReceiveToIdle function was never added, as the HAL model for the U(S)ART is a bit of a hack that never really fit the paradigm most people had for buffering/handling serial comms.

The F1 is quite old, but has a lot of use, the F2/F4 perhaps less so, and might explain resource allocated to HAL support, adding functions, bug fixes or refactoring, etc.

You could always port the ReceiveToIdle functionality if critical.

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

It's there:

https://github.com/STMicroelectronics/STM32CubeF4/blob/3d6be4bd406f275728e0a321cc371c62a3100533/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c#L1624

Where are you looking?

If you feel a post has answered your question, please click "Accept as Solution".
DBara.1
Associate II

0693W00000LvWswQAF.pngIm looking into Keil Uvision IDE suggestions and stm32f4xx_hal_uart.c file which stm32cubemx generated. Ive seen that it is there on the github, but hal_uart.c which cube generated seems to be different than the one in github

0693W00000LvWsrQAF.png

TDK
Guru

You might be on a much older version of the library. It's been in there for a bit. Update embedded packages in CubeMX. You can see which library version you're using in Project Manager -> Project -> MCU and Firmware Package.

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

Just updated to newest package version, still cant find the function. I guess its something on my end being not correct, will try to find a workaround, time to play with DMA i guess to save some time on iterrupts :)

TDK
Guru

Should be a solveable problem. Ensure you're looking at a file generated by CubeMX and not one copied into a directory somewhere. Delete the file and ensure it's replaced when you generate code.

If you feel a post has answered your question, please click "Accept as Solution".
Piranha
Chief II

Take a note that even with interrupts, DMA and ***ToIdle() functions you still cannot receive continuous data stream with HAL, because it stops the reception after each of these operations. You can start it again, but inevitably sometimes some bytes will be lost in between. Also you will have to manage FIFO code (buffer indexes) in your application because HAL doesn't implement that also. In the end HAL is a useless broken bloatware, which creates more problems than solves, because it's made by incompetent developers.

For a sane implementation from competent developer, look here:

https://github.com/MaJerle/stm32-usart-uart-dma-rx-tx

For testing purposes, just created a new cubemx project, generated fresh code into a new folder, function is still missing. Where im checking - testing if Keil Uvision can autocomplete the function based on all the funcion names in files, aswell double checked the files in /Projectfolder/Drivers/STM32F4xx_HAL_Driver/Src/ Both HAL_UART.c and HAL_USART.c - function doesnt exist anywhere.