Closed sinameshksar closed 1 year ago
This might be a long shot, but there is basically no other bug report of a similar behavior so...
I'm facing the same exact same Packet content transfer stopped (received 25 bytes)
error in a very different setting:
Everything worked fine while on the development branch before v5.0 was released, then one day after pulling the latest changes (around the time beta 1 was released) I started getting this error very often (~80% of the time) when trying to flash my board. It can fail at any stage (at the end of flashing the bootloader, app or any of the other partitions, before outputting Hash of data verified.
) but it's very random, so I can usually flash it successfully by retrying between 2 and 10 times.
What I've already tried:
$ idf.py flash monitor
Executing action: flash
Serial port /dev/ttyACM0
Connecting...
Detecting chip type... ESP32-S3
Running ninja in directory /home/mart/Repos/eva/build
Executing "ninja flash"...
[1/5] cd /home/mart/Repos/eva/build/esp-idf/esptool_py && /home/mart/.espressif/python_env/idf5.0_py3.10_env/bin/python /home/mart/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 partition --type app /home/mart/Repos/eva/build/partition_table/partition-table.bin /home/mart/Repos/eva/build/eva.bin
eva.bin binary size 0xaf7d0 bytes. Smallest app partition is 0x200000 bytes. 0x150830 bytes (66%) free.
[2/5] Performing build step for 'bootloader'
[1/1] cd /home/mart/Repos/eva/build/bootloader/esp-idf/esptool_py && /home/mart/.espressif/python_env/idf5.0_py3.10_env/bin/python /home/mart/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 /home/mart/Repos/eva/build/bootloader/bootloader.bin
Bootloader binary size 0x56c0 bytes. 0x2940 bytes (32%) free.
[2/3] cd /home/mart/esp/esp-idf/components/esptool_py && /usr/bin/cmake -D IDF_PATH=/home/mart/esp/esp-idf -D "SERIAL_TOOL=/home/mart/.espressif/python_env/idf5.0_py3.10_env/bin/python;;/home/mart/esp/esp-idf/components/esptool_py/esptool/esptool.py;--chip;esp32s3" -D "SERIAL_TOOL_ARGS=--before=default_reset;--after=hard_reset;write_flash;@flash_args" -D WORKING_DIRECTORY=/home/mart/Repos/eva/build -P /home/mart/esp/esp-idf/components/esptool_py/run_serial_tool.cmake
esptool esp32s3 -p /dev/ttyACM0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 16MB 0x0 bootloader/bootloader.bin 0x20000 eva.bin 0x8000 partition_table/partition-table.bin 0xf000 ota_data_initial.bin 0x11000 phy_init_data.bin
esptool.py v4.4
Serial port /dev/ttyACM0
Connecting...
Chip is ESP32-S3 (revision v0.1)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 70:04:1d:ad:d4:14
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00005fff...
Flash will be erased from 0x00020000 to 0x000cffff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000f000 to 0x00010fff...
Flash will be erased from 0x00011000 to 0x00011fff...
Compressed 22208 bytes to 14071...
Writing at 0x00000000... (100 %)
Wrote 22208 bytes (14071 compressed) at 0x00000000 in 0.4 seconds (effective 449.9 kbit/s)...
A fatal error occurred: Packet content transfer stopped (received 25 bytes)
CMake Error at run_serial_tool.cmake:55 (message):
/home/mart/.espressif/python_env/idf5.0_py3.10_env/bin/python;;/home/mart/esp/esp-idf/components/esptool_py/esptool/esptool.py;--chip;esp32s3
failed
FAILED: CMakeFiles/flash /home/mart/Repos/eva/build/CMakeFiles/flash
cd /home/mart/esp/esp-idf/components/esptool_py && /usr/bin/cmake -D IDF_PATH=/home/mart/esp/esp-idf -D "SERIAL_TOOL=/home/mart/.espressif/python_env/idf5.0_py3.10_env/bin/python;;/home/mart/esp/esp-idf/components/esptool_py/esptool/esptool.py;--chip;esp32s3" -D "SERIAL_TOOL_ARGS=--before=default_reset;--after=hard_reset;write_flash;@flash_args" -D WORKING_DIRECTORY=/home/mart/Repos/eva/build -P /home/mart/esp/esp-idf/components/esptool_py/run_serial_tool.cmake
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /home/mart/Repos/eva/build/log/idf_py_stderr_output_56353 and /home/mart/Repos/eva/build/log/idf_py_stdout_output_56353
Following this issue in case it's related!
I use Windows rather than Linux, but whenever I get a libusb error, it means that Windows is treating both usb endpoints on the esp32-s3 as serial ports. The simple solution is to use Zadig to replace the cdc driver with generic winusb that Openocd can use. Don't know if Linux has an equivalent solution.
Do not build the code with CDC serial support, otherwise it will conflict with the Jtag usb. Create a custom board definition json to make sure of this.
I can confirm that the built-in usb jtag does work for both uploading and debugging, with Open On-Chip Debugger v0.11.0-esp32-20220706 (2022-07-06-15:48) on a esp32-s3-wroom-1 on a bread board.
Update Jan 16 2023: USB jtag now works properly with the CDC com port on the esp32-s3 on my system.
cc @radimkarnis
Looks more related to esptool.
Hello everyone,
I can confirm this is an esptool.py issue. There was a bug in the stub loader when flashing the ESP32-S3 in the USB-JTAG/Serial mode. A bugfix has been issued and should be automatically installed if you run the install script in your IDF environment again (esptool.py v4.5.dev2
should get installed).
Please try that and let us know if that solves your issues. Thank you!
I can confirm that flashing using the previous version was unreliable at best, and the new version of esptool.py fixes that.
But I still couldn't get openocd to work, with the same error message:
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
Error: esp_usb_jtag: could not find or open device!
Turns out that was a permission issue for me:
cat << EOF | sudo tee /etc/udev/rules.d/70-esp32s3-jtag.rules
ATTRS{idVendor}=="303a", ATTRS{idProduct}=="1001", MODE="0660", GROUP="plugdev", TAG+="uaccess"
EOF
sudo udevadm control --reload-rules && sudo udevadm trigger
This fixed it for me.
I guess flashing worked because /dev/ttyACM0 is owned by the plugdev group, but openocd requires libusb and doesn't use /dev/ttyACM0.
Maybe this should be mentioned in the documentation. The only reference to "udev" currently is regarding DFU flashing, which requires the same udev rule.
@max1220 thank you for testing and sharing your solution.
@max1220 this solved my problem(openocd permission)
@sinameshksar please try the suggested solutions. If you still have an issue, feel free to re-open it.
Development Kit
ESP32-S3-DevKitM-1
Module or chip used
ESP32-S3-MINI-1-N8
Debug Adapter
USB Built-in debugger
OpenOCD version
v0.11.0-esp32-20220706 (2022-07-06-15:48)
Operating System
Ubuntu 22.04
Using an IDE ?
bash terminal
OpenOCD command line
openocd -f board/esp32s3-builtin.cfg
JTAG Clock Speed
default
ESP-IDF version
V4.4.3
Problem Description
My ESP32-S3-DevKitM-1 is connected to /dev/ttyACM0. I get the log below when run:
$
openocd -f board/esp32s3-builtin.cfg
Open On-Chip Debugger v0.11.0-esp32-20220706 (2022-07-06-15:48) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : only one transport option; autoselect 'jtag' Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001 Info : esp_usb_jtag: capabilities descriptor set to 0x2000 Warn : Transport "jtag" was already selected Info : Listening on port 6666 for tcl connections Info : Listening on port 4444 for telnet connections Error: libusb_open() failed with LIBUSB_ERROR_ACCESS Error: esp_usb_jtag: could not find or open device!
I am able to erase the flash using
idf.py erase-flash
which tells me permision to the port /dev/ttyACM0 is fine but I get the error below when trying to flash the chip:$
idf.py -p /dev/ttyACM0 flash
... esptool.py v3.3.2 Serial port /dev/ttyACM0 Connecting... Chip is ESP32-S3 Features: WiFi, BLE Crystal is 40MHz MAC: f4:12:fa:57:b4:e0 Uploading stub... Running stub... Stub running... Changing baud rate to 460800 Changed. Configuring flash size... Flash will be erased from 0x00000000 to 0x00005fff... Flash will be erased from 0x00010000 to 0x0003dfff... Flash will be erased from 0x00008000 to 0x00008fff... Compressed 20736 bytes to 12909... Writing at 0x00000000... (100 %) Wrote 20736 bytes (12909 compressed) at 0x00000000 in 0.4 seconds (effective 460.0 kbit/s)...A fatal error occurred: Packet content transfer stopped (received 25 bytes) CMake Error at run_serial_tool.cmake:56 (message): /home/builder/.espressif/python_env/idf4.4_py3.10_env/bin/python /home/builder/esp/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32s3 failed
FAILED:CMakeFiles/flash /home/builder/esp/esp-idf/examples/get-started/hello_world/build/CMakeFiles/flash cd /home/builder/esp/esp-idf/components/esptool_py && /home/builder/.espressif/tools/cmake/3.23.1/bin/cmake -D IDF_PATH="/home/builder/esp/esp-idf" -D SERIAL_TOOL="/home/builder/.espressif/python_env/idf4.4_py3.10_env/bin/python /home/builder/esp/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32s3" -D SERIAL_TOOL_ARGS="--before=default_reset --after=hard_reset write_flash @flash_args" -D WORKING_DIRECTORY="/home/builder/esp/esp-idf/examples/get-started/hello_world/build" -P /home/builder/esp/esp-idf/components/esptool_py/run_serial_tool.cmake ninja: build stopped: subcommand failed. ninja failed with exit code 1
Any thought what can be wrong?
Debug Logs
No response
Expected behavior
I am trying to debug the chip using the built-in jtag but I get the error messages described above.
Screenshots
No response