cancel
Showing results for 
Search instead for 
Did you mean: 

Does HAL_UART_Transmit() sends ASCII or binary?

M7890.1
Associate III

Hi! Does anyone know if HAL_UART_Transmit() sends ASCII or binary? I've tried to send some data a serial plotter but nothing is being plotted. The format of the data sent follows the setting in STM32CubeMx. (It works on Arduino serial plotter)

Serial plotter that I used: https://hackaday.io/project/5334-serialplot-realtime-plotting-software

10 REPLIES 10
Mohamed Aymen HZAMI
ST Employee

Hello @M7890.1​,

Which MCU you use ?

You can try the USART example in the firmware of the product you use.

Mohamed Aymen.

I'm using STN32F103CBT6. Changing UART to USART doesn't solve the problem.

LMI2
Lead

HAL_UART_Transmit() sends bytes what you put in there. ASCII is a subset of 8 bit binary data.

Exactly, it sends whatever is in the buffer

If you need ASCII numbers send "255," not 255 as a byte

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
LMI2
Lead

Arduino has libraries for everything, which spoils people, but ST users should also be spoiled that way.

Arduino serial output is so oversimplified, it ends up being confusing, Uart outputs only byte or bytes, (one or more of 0-255s), and its receivers job to make sense of it.

Javier1
Principal

HAL_UART_Transmit()

transmits the "binary", well.... everything transmitts binary its the receiving side the one that interprets the data as ascii.

@M7890.1​ Try this: https://realterm.updatestar.com/en

This serial console PC programm allows you to read/send raw binary data and also the ascii interpretation, its pretty handy for debugging.

arduino serial.print("a"); will send one byte represented in binary as 0x61.

your arduino PC console would read that 0x61 and translate it back to "a".

if you want to send raw bytes with arduino try serial.write();

we dont need to firmware by ourselves, lets talk

arduino is a tool created to be simple and easy to use for beginers.

people sometimes shouldnt bother to know...

we dont need to firmware by ourselves, lets talk

I learned binary data representations, including floating point, in secondary school, forty years ago. Current education is complete s**t..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I am using Atollic TrueSTUDIO as my IDE and only use the Arduino serial plotter for plotting the graph. Any other suggestion?