How to transmit NULL character through uart in esp-idf 3.3

manojsai
Posts: 8
Joined: Fri Sep 20, 2019 12:19 pm

How to transmit NULL character through uart in esp-idf 3.3

Postby manojsai » Wed Feb 19, 2020 11:14 am

How to transmit NULL(0x00) character through uart in esp-idf 3.3 .
I need to pass a string which contains NULL in middle of strings .

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: How to transmit NULL character through uart in esp-idf 3.3

Postby PeterR » Thu Feb 20, 2020 12:38 am

fwrite().
You cannot printf() a string with NULLs. A printf() string is null terminated! First null & boom!
I am 99% sure stdio (EDIT: must be stdout) is attached to the idf/monitor UART so fwrite() will be cool.

EDIT: PS
I assume that you are attempting UART access using printf(). The basic UART routines will not be 'string' based. UARTs are used for binary as much as strings.
& I also believe that IDF CAN should be fixed.

username
Posts: 534
Joined: Thu May 03, 2018 1:18 pm

Re: How to transmit NULL character through uart in esp-idf 3.3

Postby username » Thu Feb 20, 2020 7:55 am

I have not tried it, but maybe "uart_write_bytes" might work.


https://docs.espressif.com/projects/esp ... ansmitting

Who is online

Users browsing this forum: Google [Bot] and 112 guests