Scrambled UART data after esp_restart()

PaulFreund
Posts: 45
Joined: Wed Nov 15, 2017 9:07 pm

Scrambled UART data after esp_restart()

Postby PaulFreund » Fri Feb 16, 2018 1:27 pm

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

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Scrambled UART data after esp_restart()

Postby WiFive » Fri Feb 16, 2018 5:19 pm

What idf version?

PaulFreund
Posts: 45
Joined: Wed Nov 15, 2017 9:07 pm

Re: Scrambled UART data after esp_restart()

Postby PaulFreund » Fri Feb 16, 2018 9:18 pm

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.

Who is online

Users browsing this forum: No registered users and 66 guests