cancel
Showing results for 
Search instead for 
Did you mean: 

UART Help

Andrei Gheorghiu
Associate II
Posted on November 03, 2017 at 06:51

Hello,

I am using an STM 32 F401 Nucleo and i want to send numbers from PC via UART.

For example I need to set the frequency and amplitude.

Can some one help me to provide the code?

Thank you in advance.

12 REPLIES 12
Andrew Neil
Chief II
Posted on November 03, 2017 at 12:23

PC code, or 

STM32F401 code?

http://www.lmgtfy.com?q=STM32F401+UART

 
Posted on November 03, 2017 at 13:03

Andrei, in your STM32CubeF4 package you should find UART examples (Polling, IT and DMA) for your Nucleo board. Download it from here if you don't have it yet:

http://www.st.com/en/embedded-software/stm32cubef4.html

 
Posted on November 03, 2017 at 16:30

Salut Vasile,

Ai mai  folosit placa  te pricepi?

Posted on November 03, 2017 at 16:33

Hi,

For STM32F401.

Posted on November 03, 2017 at 16:58

Should be able to use USART2 via PA2/PA3, buffer inbound data, parse, and process with sscanf(), etc.

Might want to start with output, and adapt

STM32Cube_FW_F4_V1.16.0\Projects\STM32F401RE-Nucleo\Examples\UART\UART_Printf\Src\main.c

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on November 03, 2017 at 18:23

Salut, am alta placa, cu viteza mai mica, Nucleo-L152RE, prima de genul asta si primul meu micro STM32. Invat din mers

Posted on November 03, 2017 at 18:56

vreau sa trimit niste numere de la tastatura catre placa crezi ca i stii cum se face?

De exemplu sa setez frecventa si amplitudinea.

Posted on November 04, 2017 at 11:51

Hi,how can i use scanf ? is not working

Posted on November 04, 2017 at 13:08

scanf is a standard 'C' library function:

http://www.cplusplus.com/reference/cstdio/scanf/

To find out how to link a UART to

http://www.cplusplus.com/reference/cstdio/stdin/

, you will have to study your toolchain

documentation.

Alternatively, you could just receive characters form the UART into a buffer to form a string, and use sscanf:

http://www.cplusplus.com/reference/cstdio/sscanf/

Or you could just parse the received characters manually.

Guta_Ciucur.Vasile

‌ has already pointed you to UART examples...