cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F51K8 - UART Receiving using HAL libraries

racaillous
Associate II
Posted on July 29, 2015 at 17:29

Hello,

I'm working on a STM32F051K8 using the HAL libraries (with CubeMX).

The MCU is connected with a processor through an UART link.

I'm currently able to send characters strings withouth any problem using the normal mode (HAL_UART_Transmit) but I still don't understand how do I receive data using UART.

What I'm looking to do is detecting a specific characters string among the big data burst sent by the processor during its initialisation time.

I just don't understand what do I have to use/configure, despite all the research I've done until now.

I read about the circular buffer in DMA mode and also the RxCpltCallBack function but I don't understand what's needed to make them work or even how to use them (particularly the RxCpltCallBack function).

To make it simple, I just need to understand how can I receive data with the HAL_UART library.

I've tried using the USART1 Global Interrupt but it seems that no matter what's happening, the interruption is never triggered.

Obvsiously there is something that I missed since the beginning and it's why I'm asking for your help.

If someone could show me a general example code of  an UART reciving program while explaining the logic of the process it would be a great help for me. I'm looking for a specific strings among a big data burst so I guess interrupt mode or DMA mode would be the most useful for me.

Any help is appreciated.

Thank you.

(Sadly I dont have the time to learn to use the standart libraries, and I'm using HAL libraries because the team I'm working with was using them before I joined the project)

 

#usart #stm32f051
4 REPLIES 4
tm3341
Associate II
Posted on July 30, 2015 at 09:09

You can check link below, download libraries and check USART lib with configuration. There are used custom buffers for receive via interupts for RX. Change settings for your board (probably only IRQ handler functions) and you are ready to do the job.

http://stm32f4-discovery.com/2015/07/hal-library-07-usart-for-stm32fxxx/

racaillous
Associate II
Posted on July 30, 2015 at 10:30

I'm going to take a look at that, thank you

Amel NASRI
ST Employee
Posted on July 31, 2015 at 12:14

Hi astley.rick,

Have a look to examples that you may find in the

http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/LN1897/PF260612

package (Under STM32Cube_FW_F0_V1.3.0\Projects\USED_BOARD\Examples\UART).

The package can be downloaded from the provided page, and you find there a set of User Manuals that help you to use the HAL library (Mainly the UM1785: Description of STM32F0xx HAL drivers). 

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

racaillous
Associate II
Posted on July 31, 2015 at 14:12

Thank you Mayla