2022-03-23 01:26 PM
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?..
2022-03-23 02:01 PM
>>..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.
2022-03-23 02:10 PM
It's there:
Where are you looking?
2022-03-23 03:20 PM
Im 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
2022-03-23 03:20 PM
2022-03-23 03:26 PM
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.
2022-03-23 03:46 PM
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 :)
2022-03-23 05:21 PM
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.
2022-03-23 05:27 PM
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:
2022-03-24 01:13 AM
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.