tasmota / mgos32-to-tasmota32

ESP32 Mongoose OS to Tasmota32 OTA updates for Shelly
GNU General Public License v3.0
147 stars 10 forks source link

Failed to flash Shelly 1PM Mini Gen3 #74

Open wildekek opened 2 weeks ago

wildekek commented 2 weeks ago

Thanks for the effort getting Gen3 devices supported! I'm running into an issue though.

Followed the instructions:

I've waited a good 10 minutes, opened up WiFi scanner, but I see no access point appearing. After that I rebooted the device (yes, I know this might brick it, but it was unavailable already, so the only option left imo), still no luck. I'll try to hook up and FTDI adapter and flash it hardwired.

I really paid attention to the instructions, not sure if this is an issue with the binary or that I fail to understand the steps.

Jason2866 commented 2 weeks ago

Weird. Honestly idk why the Mini Gen 3 is making issues to OTA convert. Checked again the packages and see nothing wrong. But "something" seems to be not as it should be :-( There are success messages and fail feedback. Will add a warning in the readme

wildekek commented 2 weeks ago

I've hooked up an FTDI adapter and flashed an ESPHome image successfully. Unfortunately the device seems to be stuck in a boot loop:

[22:50:43]ets_loader.c 78 
[22:50:44]ESP-ROM:esp32c3-api1-20210207
[22:50:44]Build:Feb  7 2021
[22:50:44]rst:0x10 (RTCWDT_RTC_RST),boot:0xd (SPI_FAST_FLASH_BOOT)
[22:50:44]SPIWP:0xee
wildekek commented 2 weeks ago

Am I correct that by flashing the ESP via the ESPHome web interface -> USB -> UART should write the bootloader too? Or is this a fuse issue now?

wildekek commented 2 weeks ago

After erasing and flashing mgos32-to-tasmota32-Mini1PMG3.zip via UART:

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xd (SPI_FAST_FLASH_BOOT)
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
Jason2866 commented 2 weeks ago

The OTA convert zip is not a firmware which can be flashed. Use Tasmota Installer https://tasmota.github.io/install/ to flash Tasmota. You just have to select "Tasmota" and hit install. That's all. Don't ask me about esphome. I have zero knowledge here.

wildekek commented 2 weeks ago

Thanks Jason! I used the tasmota binary and that worked. My shelly got in a bootloop since it had a brownout on start, but i fixed that by using an external power supply instead of the ftdi adapter.

Jason2866 commented 2 weeks ago

Great you managed to get the device working with Tasmota. One question how was the Shelly device powered when you try to do the OTA convert process?

wildekek commented 2 weeks ago

Powered via 230v inputs on the shelly.

wildekek commented 2 weeks ago

I have received a new one, I could try and help debug by flashing the vanilla one and investigating when it borks.

Jason2866 commented 2 weeks ago

@wildekek Yes, you can help. Make a full backup of the firmware via esptool.py The flash is 8MB! After you have done please connect a terminal programm which can save the output to a file. Power the device with a reliable 3.3V power supply. Update to latest Shelly fw. After that please start logging. Now provide the OTA package. Try to do all described steps until you can't do anything. Please post this log file. Maybe "something" can be seen

wenningerk commented 2 weeks ago

Same thing just happened to me with a 1 mini Gen 3. I've read about similar issues in other threads. Some experience it just after a week or so. Can it be that the power-supply over 230v is on the edge. Is it possible that the chip can be run at differenct clocks as per configuration or that the wifi power can be controlled? I had that on one of these cloud-based serial connectors used for solar-inverters once I had my own software flashed. Could as well just be the startup sequence. If the above theory is true I probably won't even have to hook up the whole serial adapter. 3.3v supply might be sufficient unless of course the conversion firmware didn't die early enough and had enough time to brick something.

wenningerk commented 1 week ago

ok - more juice wasn't the answer. The shelly-bootloader was just complaining about an invalid image. So I soldered all the connections and after flashing it is looking fine. No 12V relay when driven from just 3.3v. Comes up on 230v as well. But still no relay :-( Maybe GPIO5 is wrong? Anyway button and led are at least working without additional 3.3v.

Btw that is the pattern I saw after the OTA attempt:


Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xd (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cfc5a
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x16dc
load:0x403cc710,len:0x9cc
load:0x403ce710,len:0x2f04
entry 0x403cc8cc
I (35) boot: Shelly OS loader 0.8.2 (Dec 19 2023 13:39:56 IDF 4.4.4-a7)
I (35) boot: chip revision: v0.4
I (35) boot_comm: chip revision: 4, min. bootloader chip revision: 3
I (42) boot.esp32c3: SPI Speed      : 80MHz
I (47) boot.esp32c3: SPI Mode       : DIO
I (51) boot.esp32c3: SPI Flash Size : 4MB
I (56) boot: Enabling RNG early entropy source...
E (62) flash_parts: partition 4 invalid - offset 0x3a0000 size 0x280000 exceeds flash chip size 0x400000
E (72) boot: Failed to verify partition table
E (77) boot: load partition table error!```
wenningerk commented 1 week ago

Aah autoconfiguration does the trick ;-)

Jason2866 commented 1 week ago

Autoconfiguration does way more than config the device with Shelly devices. It is mandatory since it replaces the locked bootloader from Shelly. Without doing the step the device gets 100% bricked!

wenningerk commented 1 week ago

I got that but with the first device that was already bricked on the first step I couldn't start the Autoconfiguration. And after having erased and flashed the bootstrap image I already had the bootloader switched and thus had skipped this step. Btw. meanwhile I've tried the exact same procedure (according to the instructions in the readme with Autoconfiguration of course ;-) ) on a 2nd device. Only difference was that I didn't upgrade to the newest Shelly version (iirc 1.4.2) first. And it went smoothly. Unfortunately I of course didn't spend the effort of soldering the wires first so I can't tell which Shelly OS loader it had.