2

I am using a LOLIN32 lite (ESP32) to read data sent from a STM32F103 (black pill). The ESP32 is using micropython and the STM32 is programmed using CubeMX + Truestudio.

When calling the uart.read() or uart.readline() in micropython I get the data sent by the STM32 but it has appended a \x00 value at the beginning.

From Tera terminal I get: b’\x00test message\n’

CubeMX:

UART configuration CubeMX

Code used in the STM32 (I am using the HAL library, the rest of the code is too long to post).

uint8_t buff_uart[] = "test\t a long message\n";

while (1){
   HAL_UART_Transmit(&huart1,buff_uart,sizeof(buff_uart),1);
   HAL_Delay(1000);
}

Code in micropython:

uart = UART(2, 115200)
uart.init(115200, bits=8, parity=None, stop=1, timeout=2000)

while True:
   uart.readline() 

If I connect the serial line from the STM32 to a serial USB I can see the right data in Tera terminal (without \x00). Can it be that micropython add a delimiter?

or is this an error? What I am missing here?

1
  • 2
    Have you checked it's not the other end sending it that way? Commented Oct 7, 2018 at 14:29

1 Answer 1

1
  1. write uart transmit code for and load it to on STM32 board
  2. write a UART code in micropython launguage for esp32
  3. connect their Rx and Tx and run esp32 code

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.