2018/09/10

VS Code & PlatformIO - How to upload sketch data to the SPIFFS disk of ESP32

This post is about how to upload sketch data to the SPIFFS disk of ESP32 in VS Code using PlatformIO.

Below is the version info.


Source:
http://docs.platformio.org/en/latest/platforms/espressif32.html#uploading-files-to-file-system-spiffs


1. Make sure the "data" folder that contains the data / files to be uploaded to the SPIFFS disk is at the same level as the "src" folder.


2. Be sure to close the Serial Monitor terminal. If it's not closed, click the trash can button to close it.


3. Switch to the cmd terminal.


4. Issue the command "platformio run --target uploadfs" to start uploading sketch data to the SPIFFS disk.

Note, be sure to press and hold the IO0 button of the ESP32 module when seeing "Serial port COM7" and release it when seeing the next message - "Connecting........__".

c:\Users\WeiHsiungHuang\Documents\PlatformIO\Projects\180910-182226-nodemcu-32s>platformio run --target uploadfs
Processing nodemcu-32s (platform: espressif32; board: nodemcu-32s; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Espressif 32 > NodeMCU-32S
SYSTEM: ESP32 240MHz 320KB RAM (4MB Flash)
DEBUG: CURRENT(esp-prog) EXTERNAL(esp-prog, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny)
Converting v03_13_2RC3_5khz_.ino
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 30 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <DNSServer> 1.1.0
|   |-- <WiFi> 1.0
|-- <WiFi> 1.0
|-- <FS> 1.0
|-- <Hash> 1.0
|-- <ArduinoOTA> 1.0
|   |-- <WiFi> 1.0
|   |-- <ESPmDNS> 1.0
|   |   |-- <WiFi> 1.0
|   |-- <Update> 1.0
|-- <ArduinoJson> 5.13.2
|-- <WifiManager> 0.99.9
|   |-- <DNSServer> 1.1.0
|   |   |-- <WiFi> 1.0
|   |-- <WiFi> 1.0
|   |-- <WebServer> 1.0
|   |   |-- <FS> 1.0
|   |   |-- <WiFi> 1.0
|-- <OneWire> 2.3.2
|-- <WebSockets> 2.0.10
|   |-- <WiFiClientSecure> 1.0
|   |   |-- <WiFi> 1.0
|   |-- <SPI> 1.0
|   |-- <WiFi> 1.0
|   |-- <Hash> 1.0
|-- <SPIFFS> 1.0
|   |-- <FS> 1.0
|-- <WebServer> 1.0
|   |-- <FS> 1.0
|   |-- <WiFi> 1.0
|-- <ESPmDNS> 1.0
|   |-- <WiFi> 1.0
Building SPIFFS image from 'data' directory to .pioenvs\nodemcu-32s\spiffs.bin
/gauge.min.js
/index.html
/jquery-1.11.3.min.js
/jquery.mobile-1.4.5.min.css
/jquery.mobile-1.4.5.min.js
Looking for upload port...
Auto-detected: COM7
Uploading .pioenvs\nodemcu-32s\spiffs.bin
Serial port COM7
Connecting........__
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core
MAC: 30:ae:a4:1a:3b:24
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 1503232 bytes to 178924...
Wrote 1503232 bytes (178924 compressed) at 0x00291000 in 9.8 seconds (effective 1222.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
============================================================= [SUCCESS] Took 32.41 seconds ===================================================

The sketch data is now uploaded to the SPIFFS disk of the ESP32 module.

Note, if IO0 button is not pressed in time, error such as the one below will occur.


No comments:

Post a Comment