Help with flashing Sonoff Dual r3 (please)

Hi all,

I have purchased and received two Sonoff Dual r3 devices and am absolutely struggling to flash them with either Tasmota or ESPHome. I have flashed many devices with both Tasmota and ESPHome using either a FTDI or a raspberry pi (esptool).

I have followed the instructions on the blackadder page and followed along in the various youtube tutorials, but for some reason this time, i am getting stuck. I am getting the same errors with both sonoff devices.

When using the raspberry pi,

  • to erase the firmware i have tried both:
sudo ./esptool.py --port /dev/ttyAMA0 erase_flash

and

esptool.py --port /dev/ttyAMA0 erase_flash

with the same result

esptool.py v3.1-dev
Serial port /dev/ttyAMA0
Connecting....
Detecting chip type... ESP32
Chip is ESP32-D0WD-V3 (revision 3)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 94:b9:7e:69:9a:08
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...

A fatal error occurred: Timed out waiting for packet content
  • to flash the firmware i have tried both:
sudo ./esptool.py --chip esp32 --port /dev/ttyAMA0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dout --flash_freq 40m --flash_size detect 0x1000 bootloader_dout_40m.bin 0x8000 partitions.bin 0xe000 boot_app0.bin 0x10000 tasmota32.bin

and

esptool.py --chip esp32 --port /dev/ttyAMA0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dout --flash_freq 40m --flash_size detect 0x1000 bootloader_dout_40m.bin 0x8000 partitions.bin 0xe000 boot_app0.bin 0x10000 tasmota32.bin

to the same result

esptool.py v3.1-dev
Serial port /dev/ttyAMA0
Connecting.......
Chip is ESP32-D0WD-V3 (revision 3)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 94:b9:7e:69:9a:08
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Warning: Could not auto-detect Flash size (FlashID=0x0, SizeID=0x0), defaulting to 4MB
Flash will be erased from 0x00001000 to 0x00004fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x0000ffff...
Compressed 15872 bytes to 10320...
Writing at 0x00001000... (100 %)
A fatal error occurred: Timed out waiting for packet header

When using the a windows machine, with esp-flasher i get the following error:

Using 'COM9' as serial port.
Connecting........_____....._____....._____....._____....._____....._____....._____
Unexpected error: ESP Chip Auto-Detection failed: Failed to connect to Espressif device: Timed out waiting for packet header

When trying to flash, i can see the rx led on the ftdi adapter flash, but the tx never flashes or lights up.

I have even gone out and purchased a new FTDI adapter thinking it was at fault, but it gives exactly the same error. This is the version i have (and yes i have updated the drivers)


http://deviceinbox.com/drivers/1486-ftdi-d3xx-cdm-drivers.html

Any help would be appreciated.

I had the same issue. Problem is the FTDI doesn’t pass enough power to let it boot. Once you have a successful flash you need to mains power it to get it onto wifi. Just be careful with the mains voltage and unplug the FTDI just in case.

Thanks for the reply @stevemutch0911. Can i just clarify what you have stated (or at least my understanding of it). You are saying that the flash is successful but that i need to then power the device with mains to find and configure tasmota? or are you stating that i need to solder a separate 3.3v power supply to the 3.3v and GND points on the device in order to flash, as the FTDI wont supply enough power, and then connect it to mains power after a successful flash?

thanks in advance

It flashes fine connected to the FTDI Michael but once you see it complete in the serial log and it hard resets it won’t boot up and connect to the WIFI as there isn’t enough power coming through the FTDI.

Once it successfully flashed desolder the leads, put the unit back together and power it L IN and Neutral with mains power and it boots up onto the WIFI. Done 5 of these now and works every time.

1 Like

Thank you for your help.

I will report back as soon as i have received my next delivery as it looks like i have blown both of the r3 devices in my attempt to flash (before your messages).

Thanks

Michael

Ok, so, update.

I received two more Dual r3 over the weekend, (its funny how an order from iTead can take over 2 months for the first two to arrive, then only a few days for the second order to arrive). I again attempted to flash via the Windows esp-flasher app, and again it failed with the exact same errors. I then went out an purchased a new micrSD card so i can build a fresh raspberry pi install and noticed an issue from my original parameters. Where i had esptool.py --chip esp32 --port /dev/ttyAMA0...., i should have had esptool.py --chip esp32 --port /dev/ttyS0.... I ran it with the revised parameters

esptool.py --chip esp32 --port /dev/ttyS0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dout --flash_freq 40m --flash_size detect 0x1000 bootloader_dout_40m.bin 0x8000 partitions.bin 0xe000 boot_app0.bin 0x10000 tasmota32.bin

and successfully flashed one unit. I tried this with the original two units, but i think i cooked those. I will flash my last unit later tonight.

Thanks for the assistance.

Hope this helps others stuck in the same situation.

Hi I had the same problem where they wouldn’t flash saying it couldn’t erase flash, It was due to a bad earth connection on the GND pad, I placed my earth on the - side of the 6.8uf cap as show as an alternative on the tasmota flash instructions and it worked perfectly maybe give this a go on your other units that wouldn’t flash.

Hi
Can you share code for ESPHome to control this sonoff dual R3 ? Please

2 Likes

Is any chance to add to this Sonoff also sensor temperature like Dallas Ds18B20 ?

Hello guys, I had problems flashing esphome to the DualR3.
I got the unit flashed but it didn’t boot. I can’t remember the exact message, sorry.
Anyway, I bought one of the serial converters that was recommended in the esp webpage and it worked first try. The CH340G.

Maybe someone has the same problem as me and this helps.

image

By the way, the FTDI worked in the past with some arduino projects and I read the logs so maybe there’s some sort of compatibility issues with the eshphome firmware. I’m no expert to tell.

Hello! I have a Dual R3 board V1.6, and I can’t flash this board AT ALL.

Just connecting it to the FTDI adapter (without pulling GPIO0 to GND) I can see the original bootloader action:

122.200000.676
ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_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:0x3fff0030,len:4
load:0x3fff0034,len:6968
load:0x40078000,len:13072
ho 0 tail 12 room 4
load:0x40080400,len:3896
entry 0x40080688
I (31) boot: ESP-IDF v4.1-dirty 2nd stage bootloader
I (31) boot: compile time 04:17:36
I (31) boot: chip revision: 3
I (34) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (50) boot.esp32: SPI Speed      : 40MHz
I (50) boot.esp32: SPI Mode       : DIO
I (51) boot.esp32: SPI Flash Size : 4MB
I (55) boot: Enabling RNG early entropy source...
I (60) boot: Partition Table:
I (64) boot: ## Label            Usage          Type ST Offset   Length
I (71) boot:  0 nvs              WiFi data        01 02 00009000 00040000
I (79) boot:  1 otadata          OTA data         01 00 00049000 00002000
I (86) boot:  2 phy_init         RF data          01 01 0004b000 00001000
I (94) boot:  3 ota_0            OTA app          00 10 00060000 001a9000
I (101) boot:  4 ota_1            OTA app          00 11 00210000 001a9000
I (109) boot: End of partition table
I (113) boot_comm: chip revision: 3, min. application chip revision: 0
I (120) esp_image: segment 0: paddr=0x00060020 vaddr=0x3f400020 size=0x304a4 (197796) map
I (205) esp_image: segment 1: paddr=0x000904cc vaddr=0x3ffbdb60 size=0x04394 ( 17300) load
I (212) esp_image: segment 2: paddr=0x00094868 vaddr=0x40080000 size=0x00404 (  1028) load
I (213) esp_image: segment 3: paddr=0x00094c74 vaddr=0x40080404 size=0x0b3a4 ( 45988) load
I (240) esp_image: segment 4: paddr=0x000a0020 vaddr=0x400d0020 size=0x104790 (1066896) map
I (647) esp_image: segment 5: paddr=0x001a47b8 vaddr=0x4008b7a8 size=0x11f60 ( 73568) load
I (694) boot: Loaded app from partition at offset 0x60000
I (695) boot: Disabling RNG early entropy source...

As soon as I press the button (shorts GPIO0 to GND), I have no output whatsoever on the serial port, and esptool won’t receive anything:

➜  ~  esptool.py -p /dev/tty.usbserial-1430 -b 115200 chip_id
esptool.py v4.1
Serial port /dev/tty.usbserial-1430
Connecting......................................

A fatal error occurred: Failed to connect to Espressif device: No serial data received.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html

What am I doing wrong?

BTW, this is the FTDI adapter I have. Seems to be based on the PL2303 chipset: