Unable to factory reset WROVER

Frankenheim
Posts: 7
Joined: Wed Sep 11, 2019 6:46 am

Unable to factory reset WROVER

Postby Frankenheim » Fri Nov 08, 2019 2:38 am

Hi,
I am using a WROVER kit as a hardware development platform. To program this board, I have installed the eclipse IDE and the Sloeber tool. I have also configured my development environment to use the JTAG debugger on the WROVER kit. For a few weeks now, I have been running openocd and using the eclipse debugger. For some reason this has all stopped working and the following symptoms are present.

1) When I try to run openocd it appears to fail to erase the flash and I get the following messages:

Open On-Chip Debugger v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 20000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 20000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : Listening on port 3333 for gdb connections
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : Target halted. PRO_CPU: PC=0x40062299 (active) APP_CPU: PC=0x00000000
Info : esp32: Debug controller 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x5000004B (active) APP_CPU: PC=0x00000000
Info : esp32: Core 0 was reset (pwrstat=0x1F, after clear 0x0F).
Info : esp32: Debug controller 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x40000400
** Programming Started **
auto erase enabled
Error: timed out while waiting for target halted / 4 - 2
Info : Target halted. PRO_CPU: PC=0x40090064 (active) APP_CPU: PC=0x40000400
Error: xtensa_wait_algorithm: not halted 0, pc 0x40090064, ps 0x60025
Error: Failed to wait algorithm (-302)!
Error: Algorithm run failed (-302)!
Error: Failed to run flasher stub (-302)!
Warn : Failed to get flash mappings (-302)!
Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!
Error: Algorithm run failed (-4)!
Error: Failed to run flasher stub (-4)!
Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!
Error: Algorithm run failed (-4)!
Error: Failed to run flasher stub (-4)!
Error: Failed to probe flash, size 0 KB
Error: auto_probe failed
** Programming Failed **
shutdown command invoked

Warn : Flash driver of esp32.flash does not support free_driver_priv()
Warn : Flash driver of irom does not support free_driver_priv()
Warn : Flash driver of drom does not support free_driver_priv()

2) I tried erasing the flash using esptool. This appeared to work once, however, I now get the following error.

esptool.py v2.8
Found 2 serial ports
Serial port COM4
Connecting.....
Detecting chip type... ESP32
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 24:6f:28:f0:04:24
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...

A fatal error occurred: Timed out waiting for packet content

3) I tried reading the factory flash. In this case the software appear to hang.

esptool.py v2.8
Found 2 serial ports
Serial port COM4
Connecting.......
Detecting chip type... ESP32
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 24:6f:28:f0:04:24
Uploading stub...
Running stub...
Stub running...

4) Pressing the reset button on the PCB gets me a serial stream with the following message.

rst:0x10 (RTCWDT_RTC_RESET),boot:0x3e (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57

5) Cycling power to the board has no effect.

I suspect that some internal setting has somehow become corrupted and needs to be reprogrammed. I would like to try and start with a clean board and the reprogram the factory flash , however, I cannot seem to find any reference to a file or procedure which will allow me to do that.

Can anyone point me to where such a file and instructions may exist, or, any other suggestions would be appreciated.

Regards

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

Re: Unable to factory reset WROVER

Postby WiFive » Fri Nov 08, 2019 3:45 am

Is the module on your board wrover or wrover-b?

Frankenheim
Posts: 7
Joined: Wed Sep 11, 2019 6:46 am

Re: Unable to factory reset WROVER

Postby Frankenheim » Tue Nov 12, 2019 6:19 am

The kit is a WROVER

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

Re: Unable to factory reset WROVER

Postby WiFive » Tue Nov 12, 2019 6:50 am

Wrover kit can come with different modules. I will assume you have a wrover-b module on your wrover kit because you have d0wdq5. To avoid flash read err, 1000 you have to make sure the board boots with the correct flash voltage, which for wrover-b is 3.3v. https://docs.espressif.com/projects/esp ... sh-voltage

Frankenheim
Posts: 7
Joined: Wed Sep 11, 2019 6:46 am

Re: Unable to factory reset WROVER

Postby Frankenheim » Wed Nov 13, 2019 2:56 am

Hi WiFive
Thank-you for your suggestion. I can confirm it is a WROVER-b module.

In the script file esp32-wrover.cfg, I commented out ESP32_FLASH_VOLTAGE to obtain the 3.3V you suggested. It does appear to program the flash, though this appears "flaky" at times.

When trying to launch the debugger in eclipse with the sloeber plugin, I get the following error.

Error in final launch sequence
Failed to execute MI command:
continue
Error message from debugger back end:
Warning:\nCannot insert breakpoint 2.\nCannot access memory at address 0x400d3af7\nCannot insert breakpoint 1.\nCannot access memory at address 0x400d43a8\n
Failed to execute MI command:
continue
Error message from debugger back end:
Warning:\nCannot insert breakpoint 2.\nCannot access memory at address 0x400d3af7\nCannot insert breakpoint 1.\nCannot access memory at address 0x400d43a8\n
Warning:\nCannot insert breakpoint 2.\nCannot access memory at address 0x400d3af7\nCannot insert breakpoint 1.\nCannot access memory at address 0x400d43a8\n


A brand new module programmed ok the first time. Now I get the following when tryin to program it using openocd.

Open On-Chip Debugger v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 10000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 20000 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : Listening on port 3333 for gdb connections
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors

I slowed the clock speed to 10MHz and had the same error.

Any further suggetions?

Regards

Frankenheim
Posts: 7
Joined: Wed Sep 11, 2019 6:46 am

Re: Unable to factory reset WROVER

Postby Frankenheim » Wed Nov 13, 2019 7:33 am

Here's the deal so far.

I obtained my third WROVER kit (WROVER-b module) and downloaded the flash to a binary file. I then re-programmed the faulty unit and I was able to get back to a working unit.

The trouble appears to be as follows...
I am using the UART_NUM_1 block to communicate in RS485 mode. The WROVER kit datasheet appears to imply GPIO6, GPIO9 GPIO10 and GPIO11 are reserved for this serial port. However, the WROVER kit datasheet also states that GPIO6 to GPIO11, GPIO16 and GPIO17 are reserved for the SPI flash and PSRAM.

The ESP32 datasheet states that the peripheral I/O pins are relocatable. This is fine - however - the kit has a very limited number of free I/O lines. The only free ones appear to be those connected to the external SD card port, assuming you are not using these.

What I am finding is that if I use the I/O pins connected to the onboard LED, the function uart_set_pin works. If I try to use an SD card pin, the software goes into oblivion as does the reading and writing of flash via the JTAG port.

Eg:
This works...
uart_set_pin(UART_NUM_1, GPIO_NUM_2, GPIO_NUM_4, GPIO_NUM_0, UART_PIN_NO_CHANGE);

This fails
uart_set_pin(UART_NUM_1, GPIO_NUM_12, GPIO_NUM_4, GPIO_NUM_0, UART_PIN_NO_CHANGE);

I suspect there is some peripheral clash somewhere. Does anyone know what I am missing?

Regards

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

Re: Unable to factory reset WROVER

Postby WiFive » Wed Nov 13, 2019 9:05 am

12-15 are jtag pins

Frankenheim
Posts: 7
Joined: Wed Sep 11, 2019 6:46 am

Re: Unable to factory reset WROVER

Postby Frankenheim » Wed Nov 13, 2019 11:34 pm

Hi WiFive,

Thank-you for pointing that out. I don't know how I missed that.
Many thanks for your assistance.

Regards

Who is online

Users browsing this forum: MSN [Bot] and 10 guests