Skip to main content
Aharon1
Associate II
September 4, 2019
Solved

Problem connecting a STM32 Nucleo (F401RE) to a ESP8266 via UART. (uart channel sends extra '0's)

  • September 4, 2019
  • 2 replies
  • 1377 views

I am try to connecting a STM32 Nucleo (F401RE) to a ESP8266 on UART.

I've managed to control the ESP8266 with the PC using a usb/uart channel and hyperterminal.

I've managed to send uart messages to the PC from the Nucleo

But I am unable to command the ESP8266 from the Nucleo, the same commands that worked sent from my PC, do not work sent from the Nucleo.

I've sent a simple char 't' just to see how it looks on the scope from both PC and Nucleo to comapre, and Im attaching my measurements, There is a difference between the usb/uart device and what the Nucleo sends, an Endian, it seems the Nucelo adds some '0' and I suspect this might cause the problem.

this is my configuration of the Nucleo channel

 huart1.Instance = USART1;

 huart1.Init.BaudRate = 115200;

 huart1.Init.WordLength = UART_WORDLENGTH_8B;

 huart1.Init.StopBits = UART_STOPBITS_1;

 huart1.Init.Parity = UART_PARITY_NONE;

 huart1.Init.Mode = UART_MODE_TX_RX;

 huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;

 huart1.Init.OverSampling = UART_OVERSAMPLING_16;

I would appreciate some insights on this issue

Thanks!

This topic has been closed for replies.
Best answer by Bob S

Show your code that actually sends the data from the Nucleo. I bet it looks something like this:

char cmd[] = "t"; // This is actually 2 bytes, 't' and '\0'
HAL_UART_Transmit( huart1, cmd, sizeof(cmd) ); // therefore, sizeof() is 2

2 replies

Bob S
Bob SBest answer
Super User
September 4, 2019

Show your code that actually sends the data from the Nucleo. I bet it looks something like this:

char cmd[] = "t"; // This is actually 2 bytes, 't' and '\0'
HAL_UART_Transmit( huart1, cmd, sizeof(cmd) ); // therefore, sizeof() is 2

Aharon1
Aharon1Author
Associate II
September 4, 2019

You sir are a national treasure of whatever nation you belong to.

Now it is working.

Have a great day.