cancel
Showing results for 
Search instead for 
Did you mean: 

Send non-printable characters using HAL_UART_Transmit()?

John Griswold
Senior
Posted on September 14, 2017 at 20:53

I am working on a project where I have to send characters such as 0x00, 0x01, 0x09, 0x13 and such to a display device. It wasn't doing what I expect, so I connected the UART output to a terminal to suss out why.

I can send a string (thousands of times it now seems) of 'This is UART 1\n\r' through this UART with no problem. When I try to send a string consisting of non-readable characters: 01 09 00 00 64 6C ix converted to 0964 6c 0d 0a. First of all, what happened to the 01? That's the command code. The two zeros are dropped as well, and those are parameters. And where did the 0a 0d come from? I thought HAL_UART_Transmit took a UART handle, a string pointer, a count, and a timeout. No mention of filtering and adding characters.

Is there another function I should be using? A different mode?

4 REPLIES 4
Posted on September 14, 2017 at 20:57

Likely your terminal, use something like RealTerm in HEX mode. HAL_UART_Transmit() doesn't molest the data, but things like strlen()/strcpy()/printf() are clearly inadvisable.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on September 14, 2017 at 21:20

Good on you for teaching me a new tool. Thanks. RealTerm indeed shows that I am send 00 and 01 OK. At least I can get  beyond THIS WTF moment.

Posted on March 08, 2018 at 04:35

You question is done? Why don't you close your question?

Posted on March 08, 2018 at 06:31

See it is not entirely necessary to do so, as the two participants understood that the interaction was sufficiently complete.

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