esptool not able to connect - "Device not configured"

meowsqueak
Posts: 151
Joined: Thu Jun 15, 2017 4:54 am
Location: New Zealand

esptool not able to connect - "Device not configured"

Postby meowsqueak » Mon Jul 31, 2017 5:06 am

I'm using the ESP-IDF on a "doit" ESP32 board, using esptool.py v2.1-beta1.

I was playing around with Kolban's WiFi scan example code (page 117 of the July version of his eBook) and after running 'make flash monitor' I'm finding that the board is now behaving strangely. When I press the "EN" button on my board, it resets and I see this info on the serial console:

Code: Select all

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
Falling back to built-in command interpreter.
OK
>ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0010,len:4
load:0x3fff0014,len:5088
ho 0 tail 12 room 4
load:0x40078000,len:0
load:0x40078000,len:12652
entry 0x40078f44
I (47) boot: ESP-IDF v3.0-dev-189-g843159b0 2nd stage bootloader
I (48) boot: compile time 16:32:37
I (48) boot: Enabling RNG early entropy source...
I (66) boot: SPI Speed      : 40MHz
I (78) boot: SPI Mode       : DIO
I (91) boot: SPI Flash Size : 4MB
I (103) boot: Partition Table:
I (114) boot: ## Label            Usage          Type ST Offset   Length
I (137) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (160) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (184) boot:  2 factory          factory app      00 00 00010000 00100000
I (207) boot: End of partition table
I (220) boot: Disabling RNG early entropy source...
I (237) boot: Loading app partition at offset 00010000
I (255) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x0bdd0 ( 48592) map
I (335) esp_image: segment 1: paddr=0x0001bdf8 vaddr=0x3ffb0000 size=0x02e30 ( 11824) load
I (350) esp_image: segment 2: paddr=0x0001ec30 vaddr=0x40080000 size=0x00400 (  1024) load
I (357) esp_image: segment 3: paddr=0x0001f038 vaddr=0x40080400 size=0x00fd8 (  4056) load
I (388) esp_image: segment 4: paddr=0x00020018 vaddr=0x400d0018 size=0x45018 (282648) map
I (711) esp_image: segment 5: paddr=0x00065038 vaddr=0x400813d8 size=0x11e90 ( 73360) load
I (805) esp_image: segment 6: paddr=0x00076ed0 vaddr=0x400c0000 size=0x00000 (     0) load
I (841) cpu_start: Pro cpu up.
I (841) cpu_start: Starting app cpu, entry point is 0x40080eb8
I (0) cpu_start: App cpu up.
I (850) heap_init: Initializing. RAM available for dynamic allocation:
I (871) heap_init: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM
I (889) heap_init: At 3FFB7D38 len 000282C8 (160 KiB): DRAM
I (909) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (928) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (948) heap_init: At 40093268 len 0000CD98 (51 KiB): IRAM
I (967) cpu_start: Pro cpu start user code
I (1025) cpu_start: Starting scheduler on PRO CPU.
I (187) cpu_start: Starting scheduler on APP CPU.
I (257) wifi: wifi firmware version: 9ffec4d
I (257) wifi: config NVS flash: enabled
I (267) wifi: config nano formating: disabled
I (267) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (267) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (297) wifi: Init dynamic tx buffer num: 32
I (297) wifi: Init data frame dynamic rx buffer num: 32
I (297) wifi: Init management frame dynamic rx buffer num: 32
I (307) wifi: wifi driver task: 3ffbe284, prio:23, stack:4096
I (307) wifi: Init static rx buffer num: 10
I (317) wifi: Init dynamic rx buffer num: 32
I (317) wifi: Init rx ampdu len mblock:7
I (317) wifi: Init lldesc rx ampdu entry mblock:4
I (327) wifi: wifi power manager task: 0x3ffc35e8 prio: 21 stack: 2560
I (337) wifi: wifi timer task: 3ffc4654, prio:22, stack:3584
At this point, my serial console (screen) actually dies and I'm dropped back to a bash prompt.

Running esptool.py to try and flash a different application (e.g. hello-world) results in this error:

Code: Select all

$ make flash
Flashing binaries to serial port /dev/cu.SLAB_USBtoUART (app at offset 0x10000)...
esptool.py v2.1-beta1
Connecting.......
Traceback (most recent call last):
  File "/Users/david/esp32/esp-idf/components/esptool_py/esptool/esptool.py", line 2515, in <module>
    _main()
  File "/Users/david/esp32/esp-idf/components/esptool_py/esptool/esptool.py", line 2508, in _main
    main()
  File "/Users/david/esp32/esp-idf/components/esptool_py/esptool/esptool.py", line 2238, in main
    esp.connect(args.before)
  File "/Users/david/esp32/esp-idf/components/esptool_py/esptool/esptool.py", line 365, in connect
    last_error = self._connect_attempt(mode=mode, esp32r0_delay=False)
  File "/Users/david/esp32/esp-idf/components/esptool_py/esptool/esptool.py", line 344, in _connect_attempt
    self.sync()
  File "/Users/david/esp32/esp-idf/components/esptool_py/esptool/esptool.py", line 297, in sync
    self.command(self.ESP_SYNC, b'\x07\x07\x12\x20' + 32 * b'\x55')
  File "/Users/david/esp32/esp-idf/components/esptool_py/esptool/esptool.py", line 254, in command
    p = self.read()
  File "/Users/david/esp32/esp-idf/components/esptool_py/esptool/esptool.py", line 220, in read
    return next(self._slip_reader)
  File "/Users/david/esp32/esp-idf/components/esptool_py/esptool/esptool.py", line 1560, in slip_reader
    read_bytes = port.read(1 if waiting == 0 else waiting)
  File "/Users/david/.pyenv/versions/esp32-2.7.13/lib/python2.7/site-packages/serial/serialposix.py", line 509, in read
    raise SerialException('read failed: {}'.format(e))
serial.serialutil.SerialException: read failed: [Errno 6] Device not configured
make: *** [flash] Error 1
I'm not able to do an erase_flash either for a similar reason:

Code: Select all

$ ../esp-idf/components/esptool_py/esptool/esptool.py --port /dev/cu.SLAB_USBtoUART --chip esp32 erase_flash
esptool.py v2.1-beta1
Connecting.......
Traceback (most recent call last):
  File "../esp-idf/components/esptool_py/esptool/esptool.py", line 2515, in <module>
    _main()
  File "../esp-idf/components/esptool_py/esptool/esptool.py", line 2508, in _main
    main()
  File "../esp-idf/components/esptool_py/esptool/esptool.py", line 2238, in main
    esp.connect(args.before)
  File "../esp-idf/components/esptool_py/esptool/esptool.py", line 365, in connect
    last_error = self._connect_attempt(mode=mode, esp32r0_delay=False)
  File "../esp-idf/components/esptool_py/esptool/esptool.py", line 344, in _connect_attempt
    self.sync()
  File "../esp-idf/components/esptool_py/esptool/esptool.py", line 297, in sync
    self.command(self.ESP_SYNC, b'\x07\x07\x12\x20' + 32 * b'\x55')
  File "../esp-idf/components/esptool_py/esptool/esptool.py", line 254, in command
    p = self.read()
  File "../esp-idf/components/esptool_py/esptool/esptool.py", line 220, in read
    return next(self._slip_reader)
  File "../esp-idf/components/esptool_py/esptool/esptool.py", line 1560, in slip_reader
    read_bytes = port.read(1 if waiting == 0 else waiting)
  File "/Users/david/.pyenv/versions/esp32-2.7.13/lib/python2.7/site-packages/serial/serialposix.py", line 509, in read
    raise SerialException('read failed: {}'.format(e))
serial.serialutil.SerialException: read failed: [Errno 6] Device not configured
Not sure if it's useful, but the very last thing I saw on 'make monitor' before all this happened was:

Code: Select all

W (367) phy_init: failed to load RF calibration data (0x1102), falling back to full calibration
I haven't seen this again though.

If I run 'make monitor' I can see some typical output but it also ends with the same "Device not configured" exception.

I'm not sure what I've managed to do here - somehow the wifi scan program I loaded is causing the device to terminate the serial comms early but I'm not able to update it either. Is there a way to recover from this?

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: esptool not able to connect - "Device not configured"

Postby ESP_Sprite » Mon Jul 31, 2017 6:37 am

There's not really a way to 'terminate' the serial communications on the ESP32 side... it's just not in any protocol we use. Are you sure you do not have another program, script or whatever trying to access that serial port on your computers side?

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

Re: esptool not able to connect - "Device not configured"

Postby WiFive » Mon Jul 31, 2017 7:52 am

People have reported issues powering certain boards from certain USB ports (especially laptops) and with bad cables. Try a powered USB hub if available.

meowsqueak
Posts: 151
Joined: Thu Jun 15, 2017 4:54 am
Location: New Zealand

Re: esptool not able to connect - "Device not configured"

Postby meowsqueak » Mon Jul 31, 2017 9:34 pm

Thanks for the replies. I think the issue was my USB cable, because I switched it for a "branded" one and the problem went away entirely. I went back to the "bad" cable and determined that it would occasionally work, but fails a lot of the time. So I'm fairly certain it's the USB cable at fault. Thanks for the hints!

BTW I am using a powered USB hub, but it was switching the cable (same hub, same port) that resolved the issue.

User avatar
arundale
Posts: 10
Joined: Thu Oct 11, 2018 11:14 am

Re: esptool not able to connect - "Device not configured"

Postby arundale » Wed Feb 27, 2019 9:23 am

I was facing same issue.. Changing cable solved the problem. Thanks.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 140 guests