Page 1 of 1

Scrambled UART data after esp_restart()

Posted: Fri Feb 16, 2018 1:27 pm
by PaulFreund
I hope this was not answered somewhere else before, I have a small uart logging application that has to run for months. The code receives data from UART and writes it to MicroSD. For recovery I do a system reset in any error case, e.g. MicroSD card could not be written or mounted, UART could not be initialized, Watchdog timed out etc.)

When I simulate the error condition by removing the MicroSD card it gets to a boot loop which I rate limited by vTaskDelay before reset with esp_restart().

Now if I leave it rebooting for some time and put the MicroSD card back in in some cases I start to get scambled binary from uart uart_read_bytes. The length seems to be matching but the data is sometimes misalligned and sometimes just completely wrong. When my watchdog timer again issues a reset with esp_restart() it still receives scrambled data. Once I reset with the EN pin everything is fine again.

In my init code I configure all parameters, set pins, install the driver and flush the port. In my reboot code I properly delete the UART port. Is there something I overlooked?

Best regards,

Paul

Re: Scrambled UART data after esp_restart()

Posted: Fri Feb 16, 2018 5:19 pm
by WiFive
What idf version?

Re: Scrambled UART data after esp_restart()

Posted: Fri Feb 16, 2018 9:18 pm
by PaulFreund
Toolchain is 20180110 and IDF was at master of January 12. This was a very good trigger, maybe it is now working because the fifo is correctly cleared:

https://github.com/espressif/esp-idf/co ... fb61431339

This fixed was one day later :lol:

I have tested for 10 minutes so far and no scrambled data anymore.