IOError on deep sleep with idf monitor

alubee
Posts: 5
Joined: Tue Nov 28, 2023 3:01 pm

IOError on deep sleep with idf monitor

Postby alubee » 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:
  • 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"
    
Stack trace:

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

ESP_pdragun
Posts: 12
Joined: Fri Dec 02, 2022 2:18 pm

Re: IOError on deep sleep with idf monitor

Postby ESP_pdragun » Wed Nov 29, 2023 9:48 am

I am sorry for the issues. I was able to reproduce the same problem. We will fix it ASAP and I will let you know once the fix is available.

A possible workaround is to install older version of esp-idf-monitor, to install it you can run `pip install esp-idf-monitor==1.1.2` in ESP-IDF environment.

ESP_pdragun
Posts: 12
Joined: Fri Dec 02, 2022 2:18 pm

Re: IOError on deep sleep with idf monitor

Postby ESP_pdragun » Mon Dec 04, 2023 1:40 pm

Hi, the fix was released and should be now available in esp-idf-monitor 1.3.4. You can install it easily by running the install script (./install.sh) for ESP-IDF.

alubee
Posts: 5
Joined: Tue Nov 28, 2023 3:01 pm

Re: IOError on deep sleep with idf monitor

Postby alubee » Tue Dec 05, 2023 8:27 am

Hi,

I've tested the fix for esp-idf-monitor 1.3.4. Works like a charm now. Thanks!

Who is online

Users browsing this forum: No registered users and 90 guests