[SOLVED] MaixBit UART.write("0") transmits 0x06 instead of ASCII 0x30

Hi, searched far and wide on the Net, but was unable to find a useful solution.

I used the example from the MaixBit docs (Chinese version, translated to EN) - and was able to get a working example.

Using uPyLoader, and accessing the MaixBit REPL via the uPyLoader terminal, I was able to tx a multitude of values.

The most basic tx value, uart.write("0") gave an output 0x06 ( ASCII tables give value 0x30) , received on another computer through a UART-to-USB cable and using PUTTY terminal as reader.

uart.write("0") —> 0x06
uart.write("00") —> 0xE6 0x06
uart.write("000") —> 0xE6 0xE6 0x06
uart.write("0000") —> 0xE6 0xE6 0xE6 0x06

uart.write("1") —> 0x67
uart.write("2") —> 0x33
uart.write("3") —> 0x66
uart.write("4") —> 0x19
uart.write("5") —> 0x65

I actually thought there could be a pattern, some offset, or maybe TX errors in baud rate, but this output stays the same whether or not I change output pins, change baud rates, change UART properties.

I know I have missed something, so here I include my code for your assistance:


uart2 = machine.UART(machine.UART.UART2,
                    timeout=1000, read_buf_len=4096 )

uart2.write( bytes("0", "ascii") )

Thanks for the help.

Hello, I jumped over to the ESP-WROOM-32 board, and changed my code accordingly – ended up with the same issue. uart.write(“0”) transmitted the same results … 0x06 instead of ASCII 0x32.

So I remembered that I had a USB-to-TTL YP-01 adapter, connected the TXD pin to RX2 (of ESP32), and RXD pin to TX2(of ESP32) and it read the data correctly. Yayyyy!!!

I’m not an electronics guy, so I’m guessing that the first adapter that I was using :
Bus 003 Device 010: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light

tends to not react/detect properly the UART tx pulses. Or maybe the voltages that one transmits (from the ESP32 or MAixBit – 3.3V) are not the same that the CP210x adapter is capable of reading ( 5V ).

So for the time being, this issue is SOLVED, for me