1

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?
    – hardillb
    Oct 7 '18 at 14:29
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.