IOError on deep sleep with idf monitor
Posted: Tue Nov 28, 2023 3:48 pm
Context:
I'm working on a project using deep sleep and the ESP32C3. When monitoring the serial output via JTAG, the serial monitor is disconnected, as expected. However, when the ESP goes into deep sleep, "idf.py monitor" raises the an error (see stack trace below).
Since a colleague of mine does not have the problem on macOS (I am using Ubuntu 22.04), I have tried every possible configuration that might be necessary on Ubuntu, but to no avail. Neither have I had any luck with the provided documentation.
I am therefore hoping that someone in here might assist.
Thank you in advance.
Setup:
I'm working on a project using deep sleep and the ESP32C3. When monitoring the serial output via JTAG, the serial monitor is disconnected, as expected. However, when the ESP goes into deep sleep, "idf.py monitor" raises the an error (see stack trace below).
Since a colleague of mine does not have the problem on macOS (I am using Ubuntu 22.04), I have tried every possible configuration that might be necessary on Ubuntu, but to no avail. Neither have I had any luck with the provided documentation.
I am therefore hoping that someone in here might assist.
Thank you in advance.
Setup:
- ESP-IDF version: v5.1.2
- OS: Ubuntu 22.04
- MCU version: ESP32C3
- Serial connection: JTAG
- idf.py monitor called in terminal (does not work without --no-reset either)
Code: Select all
idf.py monitor --no-reset --port /dev/ttyACM0
- OpenOCD running with with the command
Code: Select all
idf.py openocd --openocd-commands "-f board/esp32c3-builtin.cfg -f interface/esp_usb_jtag.cfg"
Code: Select all
Waiting for the device to reconnectException in thread Thread-2 (_run_outer):
Traceback (most recent call last):
File "/home/<user>/.espressif/python_env/idf5.1_py3.10_env/lib/python3.10/site-packages/esp_idf_monitor/base/serial_reader.py", line 76, in run
data = self.serial.read(self.serial.in_waiting or 1)
File "/home/<user>/.espressif/python_env/idf5.1_py3.10_env/lib/python3.10/site-packages/serial/serialposix.py", line 595, in read
raise SerialException(
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/<user>/.espressif/python_env/idf5.1_py3.10_env/lib/python3.10/site-packages/esp_idf_monitor/base/serial_reader.py", line 83, in run
self.close_serial()
File "/home/<user>/.espressif/python_env/idf5.1_py3.10_env/lib/python3.10/site-packages/esp_idf_monitor/base/serial_reader.py", line 104, in close_serial
self._disable_closing_wait_or_discard_data()
File "/home/<user>/.espressif/python_env/idf5.1_py3.10_env/lib/python3.10/site-packages/esp_idf_monitor/base/serial_reader.py", line 120, in _disable_closing_wait_or_discard_data
buf = fcntl.ioctl(self.serial.fd, termios.TIOCGSERIAL, buf)
OSError: [Errno 5] Input/output error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/home/<user>/.espressif/python_env/idf5.1_py3.10_env/lib/python3.10/site-packages/esp_idf_monitor/base/stoppable_thread.py", line 47, in _run_outer
self.run()
File "/home/<user>/.espressif/python_env/idf5.1_py3.10_env/lib/python3.10/site-packages/esp_idf_monitor/base/serial_reader.py", line 100, in run
self.close_serial()
File "/home/<user>/.espressif/python_env/idf5.1_py3.10_env/lib/python3.10/site-packages/esp_idf_monitor/base/serial_reader.py", line 104, in close_serial
self._disable_closing_wait_or_discard_data()
File "/home/<user>/.espressif/python_env/idf5.1_py3.10_env/lib/python3.10/site-packages/esp_idf_monitor/base/serial_reader.py", line 120, in _disable_closing_wait_or_discard_data
buf = fcntl.ioctl(self.serial.fd, termios.TIOCGSERIAL, buf)
OSError: [Errno 5] Input/output error