Espressif2Arduino
Espressif2Arduino copied to clipboard
DIO / DOUT / QIO
The defines for respective public images are:
#define URL_QIO_ROM_2 "http://sunlocker.khc.net.nz/static/8266/e2a-1024-2.bin"
#define URL_QIO_ROM_3 "http://sunlocker.khc.net.nz/static/8266/sonoff-1024.bin"
#define URL_DIO_ROM_2 "http://sunlocker.khc.net.nz/static/8285/e2a-1024-2.bin"
#define URL_DIO_ROM_3 "http://sunlocker.khc.net.nz/static/8285/sonoff-1024.bin"
which suggests DIO is used by ESP8285 (AFAIK wrong) and QIO by ESP8266 (AFAIK semi-wrong). ESP8266 can be flashed using DIO/QIO - where 'D' stands for 'dual' (flash is wired with 2 cables) and 'Q' for 'quad' (flash is wire with 4 cables). As far as I know in Sonoffs the flash is wired with 2 cables (I might be wrong here) so QIO for the Sonoffs wouldn't make sense. For the ESP8285 DOUT / QOUT are used instead of DIO/QIO (however since the flash is built-in, you shouldn't have much choice, however I'm uncertain whether it's wired internally by 2 or 4).
From my understanding ESPs being abled to flash via Q* and always also be flashed by its respective D* method. While *OUT and *IO are significantly different and that's what makes the difference in terms of flashing for ESP8285 and ESP8266.
As you see I'm not sure in several points myself, however I'm pretty sure the names of the defines lead to false implications (both using *IO).
I based it on tasmota - https://github.com/arendst/Sonoff-Tasmota/blob/c768f7d610c2bb5c915d6dda1b204246e0638ede/platformio.ini
You can see here that yes I did mess up and DIO should have said DOUT. So 8266 = QIO and 8255=Dout. In anycase I have now followed tasmota lead and everything is using DOUT - as it greatly simplifies the build process (and the sontota side as well.
Ah, ok, so if it's QIO on the Sonoffs using ESP8266 the external flash on the Sonoffs appears indeed quad wired.
In anycase I have now followed tasmota lead and everything is using DOUT - as it greatly simplifies the build process (and the sontota side as well.
However - without having it checked properly . I think that's tasmota hacking DOI/QIO into DOUT, if an ESP 8285 is detected - wouldn't that exclude other firmwares? Don't get me wrong, if you focus on tasmota that's totally fine. This concern just popped up in my head.
I'm a little out past my area of expertise but I believe DOUT is basically universally supported by all esp 82** chips, its the lowest common denominator. Tasmota just generates one DOUT only build now for all devices - so i don't think its a hack (other than, some devices could flash faster with QIO mode).
Best write up i saw when looking into it was here https://www.esp32.com/viewtopic.php?t=1250
DIO - SPI host uses the "Dual I/O Fast Read" command (BBh). Two SPI pins are used to write the flash address part of the command, and to read flash data out. Therefore these phases need half the clock cycles compared to standard SPI. DOUT - SPI host uses the "Dual Output Fast Read" command (3Bh). Two SPI pins are used to read flash data out. Slightly slower than DIO, because the address is written via the single MOSI data pin. QIO - SPI host uses the "Quad I/O Fast Read" command (EBh). Four SPI pins are used to write the flash address part of the command, and to read flash data out. Therefore these phases need a quarter the clock cycles compared to standard SPI. QOUT - SPI host uses the "Quad Output Fast Read" command (6Bh). Four SPI pins are used to read the flash data out. Slightly slower than QIO, because the address is written via the single MOSI data pin.
In terms of performance: QIO > QOUT > DIO > DOUT. I'm fairly sure the flash cache issues 32 byte reads each time, so QOUT or QIO are substantially faster than DIO or DOUT.