Scrambled UART data after esp_restart()
Posted: 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
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