Xinyuan-LilyGO / T-PicoC3

MIT License
153 stars 40 forks source link

Rollback to stock firmware #39

Open GuilhermeFSouza opened 9 months ago

GuilhermeFSouza commented 9 months ago

Hello,

I´ve uploaded a MicroPython bootloader to study using Thonny IDE. That´s Ok and works fine!

The problem is: Now i have to use the arduino IDE again, running with the stock firmware (after install the micropython bootloader the arduino IDE dnt recognize the device anymore :( ). How can i burn the stock rom on this device?

dshookowsky commented 9 months ago

I have the same issue. I've tried to get back to the factory settings using the bin and uf2 files in example/factory

1) Use bootsel and run buttons together to load in bootloader and drag/drop the example/factory/pico/firmware.uf2 to the drive. 2) Switch the usb connector to the ESP32 side, attach a jumper between pin 9 and ground 3) Clear the flash with python -u -m esptool --port COM4 erase_flash 3) Write the firmware from example/factory/esp32-c3/factory-MINI-1.bin with python -u -m esptool --chip esp32c3 --port COM4 --baud 460800 write_flash -z 0x0 .\factory_MINI-1.bin

Unfortunately in my case, when the device powers back on , I get the splash, but then see a message that "AT Fail" and "The ESP32C3 communication fails.."

I have been unable to get ANY user code running on this device.

juniorgarcia commented 3 weeks ago

I'll say what I've discovered about it in regards of flashing the ESP32 to factory defaults.

  1. Download and unzip (if needed) this repository
  2. Install esptool.py
  3. Connect the device with a cable that is USB-A in one end and USB-C in another end (this step is very important if your device LEDs are blinking very fast. See)
  4. Check if the green LED behind the board is on and NOT blinking fast
  5. Use the terminal to navigate to inside the download repository, and then go to example/factory/esp32-c3/ESP32-C3-MINI-1_AT_Bin_V2.3.0.0 (this is importante because we are flashing based on this folder)
  6. Discover the correct port that your device is connected to. Here it depends on the OS. See more here. I'm using Mac so, in my case the correct port is /dev/cu.usbmodem2101
  7. Now type on the terminal
    esptool.py --chip auto --port PORTNAME --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size 4MB 0x8000 partition_table/partition-table.bin 0xd000 ota_data_initial.bin 0xf000 phy_init_data.bin 0x0 bootloader/bootloader.bin 0x60000 esp-at.bin 0x1e000 at_customize.bin 0x1F000 customized_partitions/ble_data.bin 0x3a000 customized_partitions/mqtt_key.bin 0x27000 customized_partitions/server_key.bin 0x3c000 customized_partitions/mqtt_ca.bin 0x2d000 customized_partitions/client_key.bin 0x2b000 customized_partitions/client_cert.bin 0x31000 customized_partitions/factory_param.bin 0x2f000 customized_partitions/client_ca.bin 0x38000 customized_partitions/mqtt_cert.bin 0x29000 customized_partitions/server_ca.bin 0x25000 customized_partitions/server_cert.bin

    (Remember to change the value of PORTNAME with the correct port on your OS)

If this command fails telling about some communication issue, try to disconnect the cable, short GPIO 109 and GND, and plug the cable again while those pins are still shorted, then run the command on previous step again.

After this command, flash works fine and the screen no longer shows The ESP32C3 communication fails... message.

Explanation:

This command was extracted from ESP32 download guide page, section "Linux or macOS" and it's combined with the contents of the download.config file included on this repository.

Hope it helps!