How to transmit NULL character through uart in esp-idf 3.3
Posted: Wed Feb 19, 2020 11:14 am
by manojsai
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 .
Re: How to transmit NULL character through uart in esp-idf 3.3
Posted: Thu Feb 20, 2020 12:38 am
by PeterR
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.
Re: How to transmit NULL character through uart in esp-idf 3.3
Posted: Thu Feb 20, 2020 7:55 am
by username
I have not tried it, but maybe "uart_write_bytes" might work.
https://docs.espressif.com/projects/esp ... ansmitting