Understanding UART Overrun Error When Sending AT Commands from STM32 to ESP8266

I’m interfacing an ESP8266 with an NUCLEO-L073RZ using UART1 PA9, PA10 for communication with the ESP and UART2 for communication with a PC for debugging. I also used a CP2102 USB to TTL converter to tap the Tx signal from UART1 and monitor AT commands sent from the STM32 The STM32 sends the first AT command correctly, but when I send the second command AT+RST, only part of it is received by the ESP8266. After debugging, I found that HAL_UART_Transmit returns HAL_ERROR, and the cause seems to be an overrun error. See how I set things up: _Baud rate : 115200 for both STM32 and ESP8266 _Buffer size: 256 bytes _Communication method: Polling for UART communication _Power supply: 5V regulated power source for ESP8266 Using HAL_MAX_DELAY as the timeout fixed the issue, but I’m unsure why. Increasing the delay in HAL_Delay() didn’t resolve the issue, so I’m still confused about what’s causing the overrun error. Here’s the code I’m using to send AT commands;
attachment 0
2 Replies
Edison_ngunjiri
Edison_ngunjiri2mo ago
Hi,please consider using 3.3v power supply. Then,you can turn off reply feature or else wait until you get the reply before you send another command. Also you can try to increase the 100ms /use HAL_MAX_DELAY as timeout. Let me know if these options works for you
Sterling
Sterling2mo ago
I will get back to you on this @Edison_ngunjiri ... Bless 🙏🏽
Want results from more Discord servers?
Add your server