2017-11-02 10:51 PM
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.
2017-11-03 04:23 AM
PC code, or
STM32F401 code?
2017-11-03 05:03 AM
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:
2017-11-03 09:30 AM
Salut Vasile,
Ai mai folosit placa te pricepi?
2017-11-03 09:33 AM
Hi,
For STM32F401.
2017-11-03 09:58 AM
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
2017-11-03 11:23 AM
Salut, am alta placa, cu viteza mai mica, Nucleo-L152RE, prima de genul asta si primul meu micro STM32. Invat din mers
2017-11-03 11:56 AM
vreau sa trimit niste numere de la tastatura catre placa crezi ca i stii cum se face?
De exemplu sa setez frecventa si amplitudinea.
2017-11-04 04:51 AM
Hi,how can i use scanf ? is not working
2017-11-04 06:08 AM
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...