2016-10-01 11:58 AM
How can I print data acquired from a gyroscope on RealTerm using printf. I'm using a STM32F411RE and I used CubeMX to set registers. Thanks!
#printf2016-10-02 06:32 AM
The exact method depends on the tool-chain being used.
You need to initialize USART2 and the PA2/PA3 pins that it uses for the VCP connection. Then you need to create a putchar() or chain specific equivalent to output characters to USART2. This is an example using the SPL and Keil for this board.http://www.keil.com/forum/61540/
2016-10-02 09:37 AM
2016-10-03 08:29 AM
thank you! But I have some questions.
Why return len? Does it work even if my buffer is an array? because it prints just one number instead of three.2016-10-03 08:48 AM
It writes bytes, it doesn't understand arrays of numbers, the buffer/length can describe an array of numbers, and it will write it as is. Understand representation of data in memory, and in files.
It returns a length as a success code, just as the standardhttp://codewiki.wikidot.com/c:system-calls:write
function would, negative for a failure. Review standard C texts. If you want to print an array of numbers in ASCII, you'd perhaps use printf() or puts(itoa()) and those would then initiate multiple write(), as you enumerate through the array.2016-10-04 05:25 AM
Hi pirotta.marco,
I recommend the example ''UART_printf'' in the at this path: STM32Cube_FW_F4_V1.13.0\Projects\STM32F411RE-Nucleo\Examples\UART\UART_Printf-Hannibal-2016-10-04 10:56 AM
thank you everyone. it works!
2018-01-26 06:04 PM
Hi,
look this examples:
http://www.emcu.eu/how-to-implement-printf-for-send-message-via-usb-on-stm32-nucleo-boards/