>>> Join Us in the Fight Against Air Pollution

AirGradient Forum

Outdoor Air Presoldered V1.1 Issues Flashing - Error writing Flash

I recently ordered the Indoor Pro Kit and the Outdoor Kit Presoldered (V1.1), and am having issues trying to flash new code to it. It was working fine and reporting to the dashboard with the factory firmware on it.

My indoor pro is working fine heh, esphome is working well on it.

After trying to apply a basic esphome config to the Outdoor it went into a boot loop, and since then I have not been able to flash it again. I’ve tried flashing directly from the browser from the kit page with the default image (The AirGradient Open Air Outdoor Air Quality Monitor (Presoldered-Version, PCB Version 1.1)), and it does the following every time :

  • Erases in about 60 seconds
  • Flashes the device in about 10 seconds
  • Says the flash is successful, but nothing happens, the airgradient just sits there and does not connect to the WiFi or create the fallback hotspot.
  • Check logs, they are blank. When I reset the device, I get these logs :
Build:Feb 7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x4 (DOWNLOAD(USB/UART0/1))
Saved PC:0x400462e2
waiting for download

I’ve also tried flashing direct from esphome-flasher locally after building an image in legacy format from the web interface / esphome docker image, and get the following :

Using 'COM9' as serial port.
Connecting...
Detecting chip type... ESP32-C3
Connecting...

Chip Info:
 - Chip Family: ESP32
 - Chip Model: ESP32-C3 (revision 4)
 - Number of Cores: 1
 - Max CPU Frequency: 80MHz
 - Has Bluetooth: NO
 - Has Embedded Flash: NO
 - Has Factory-Calibrated ADC: NO
 - MAC Address: 34:85:18:29:30:B0
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
 - Flash Size: 4MB
 - Flash Mode: qio
 - Flash Frequency: 80MHz
Erasing flash (this may take a while)...
Chip erase completed successfully in 19.1s
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00133fff...
Compressed 17392 bytes to 11186...
Writing at 0x00001000... (100 %)Wrote 17392 bytes (11186 compressed) at 0x00001000 in 0.1 seconds (effective 1224.8 kbit/s)...
File  md5: 2613d22b69813404709aa85ac2e6ed03
Flash md5: 2fa1740520bfd87515fed6c0e6a8d801
MD5 of 0xFF is b870ee124b86c03bbf0d109d3dc8b26c
Unexpected error: Error while writing flash: MD5 of file does not match data in flash!

If I then reboot the device, I get errors similar to the following


[17:22:37]ESP-ROM:esp32c3-api1-20210207
[17:22:37]Build:Feb  7 2021
[17:22:37]rst:0x7 (TG0WDT_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
[17:22:37]Saved PC:0x4004d1f8
[17:22:37]invalid header: 0xffffffff
[17:22:37]invalid header: 0xffffffff
[17:22:37]invalid header: 0xffffffff
[17:22:37]invalid header: 0xffffffff
[17:22:37]invalid header: 0xffffffff
[17:22:37]invalid header: 0xffffffff
[17:22:37]invalid header: 0xffffffff
[17:22:37]invalid header: 0xffffffff
[17:22:37]invalid header: 0xffffffff
[17:22:37]invalid header: 0xffffffff
[17:22:37]invalid header: 0xffffffff

<snip lots of repeated lines>

Things i’ve tried

  • putting the module into flash mode by holding the button during boot
  • trying DIO flash mode, no difference
  • various configs from the forums / github -

https://github.com/ajfriesen/ESPHome-AirGradient/blob/main/air-gradient-open-air.yaml
https://devices.esphome.io/devices/AirGradient-DIY - modified for platform: esp32, board:esp32-c3-devkitm-1

DIO flash mode notes

esphome:
  ...
  platformio_options:
    board_build.flash_mode: dio

There should be settings to erase the device (on the web flasher as well as when flashing through the Arduino IDE). Did you check that setting?

Yes, I have tried it with the option to erase selected and cleared. The errors are still the same.

Here’s the error message from the Arduino IDE with the default sketch - I followed all the instructions from the page : The AirGradient Open Air Outdoor Air Quality Monitor (Presoldered-Version, PCB Version 1.1)

I tried multiple times with erase flash enabled and disabled, I also tried setting the baud rate down to 115200, and none of the options seem to work

Sketch uses 1014776 bytes (77%) of program storage space. Maximum is 1310720 bytes.
Global variables use 42636 bytes (13%) of dynamic memory, leaving 285044 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.5.1
Serial port COM9
Connecting...
Chip is ESP32-C3 (revision v0.4)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 34:85:18:29:30:b0
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Erasing flash (this may take a while)...
Chip erase completed successfully in 18.8s
Compressed 13152 bytes to 9473...
Writing at 0x00000000... (100 %)
Wrote 13152 bytes (9473 compressed) at 0x00000000 in 0.1 seconds (effective 1499.8 kbit/s)...
File  md5: 43a742af4d427c583eb7eb94afd37f06
Flash md5: 55cd7cacfbe57b7fb5ac0d61e5801a5d
MD5 of 0xFF is 734d45df0a1e8831b491c6669ae44914

A fatal error occurred: MD5 of file does not match data in flash!
Failed uploading: uploading error: exit status 2

Please contact or support for a new board.