Sunday, January 13, 2019

ESP32 and ESP8266 - Configuring Arduino IDE and Updating firmware

MacOS 10.14.2
Arduino IDE 1.8.7


Goal:

  • Configure Arduino IDE to develop and compile code to the ESP32 boards. Also download and install tools and SDKs files to update the firmware on ESP32 devices.

Install:
  • Installing Boards support on Arduino IDE:
    • Start Arduino IDE and open Preferences window (File -> Preferences);
    • Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json, https://dl.espressif.com/dl/package_esp32_index.json into Additional Board Manager URLs field;
    • Open Boards Manager from Tools -> Board menu and install esp8266 (zzz...);
    • Open Boards Manager from Tools -> Board menu and install esp32 by Espressif Systems (zzz...);
  • Installing Libraries on Arduino IDE:

  • Download Flash Tools (ESP8266 & ESP32):
    • Download the latest Flash Tools here.
  • Download firmware:
    • ESP32:
      • Download the latest SDK here.
    • ESP8266:
      • Download the latest SDK here or here.
  • Updating Firmware:
    • Connect ESP to a computer.
    • Windows:
      • run the ESPFlashDownloadTool_v3.6.5.exe
      • Choose the right board model (ESP8266,  ESP8265, ESP32)
      • Check, locate the binary files and address for bootloader, singleapp partition and user application:
        • ESP32:
          • 0x1000: bootloader.bin
          • 0x4000: partitions_singleapp.bin
          • 0x10000: helloworld-esp32.bin (the user main application code)
        • ESP8266:
          • 0x0: boot_v1.7.bin
          • 0x1000: user1.2048.new.5.bin
          • 0x3E000: blank.bin
          • 0x7C000: esp_init_data_default_v08.bin
          • 0x7E000: blank.bin
      • Choose a COM port
      • Choose Baud Rate 460800
      • Flash the *.bin files

Tests:
  • Open Arduino IDE, compile and upload a simple example (e.g., Blink)


Troubleshooting:
  • Fix for "sketch is too big" on ESP32 boards:
    • Links:
    • Files to change on Windows:
      • <?>\hardware\espressif\esp32\boards.txt
      • <?>\espressif\esp32\tools\partitions\default.csv
    • Files to change on MacOS:
      • /Users/marcus/Library/Arduino15/packages/esp32/hardware/esp32/1.0.1/boards.txt
      • /Users/marcus/Library/Arduino15/packages/esp32/hardware/esp32/1.0.1/tools/partitions/default.csv
    • boards.txt:
      • lolin32.upload.maximum_size=1638400
    • default.cvs:
      • # Name,   Type, SubType, Offset,  Size, Flags
      • nvs,      data, nvs,     0x9000,  0x5000,
      • otadata,  data, ota,     0xe000,  0x2000,
      • app0,     app,  ota_0,   0x10000, 0x190000,
      • app1,     app,  ota_1,   0x1A0000,0x190000,
      • eeprom,   data, 0x99,    0x330000,0x1000,
      • spiffs,   data, spiffs,  0x331000,0x0CF000,
    • Obs: The board restarts itself after this change, maybe it is related. Don't know for sure. 
Info:
  • ESP8266 x ESP32 - Pros and Cons
  • ESP32 Specification:
    • Number of cores: 2
    • Architecture: 32 bit
    • Wi-Fi, Bluetooth
    • RAM: 512 KB
    • FLASH: 16 MB
    • GPIO Pins: 36
    • Communication Protocols: SPI, IIC, I2S, UART, CAN
    • ADC channels: 18 channels
    • ADC Resolution: 12-bit
    • DAC channels: 2
    • DAC Resolution: 8-bit

Arduino Board Configurations:

  • ESP8266:
    • Wemos D1 mini (GPIO02 = LED):
      • Menu Tools -> Board -> LOLIN(WEMOS) D1 R2 & mini
  • ESP32:
    • ESP32 Mini Kit (GPIO02 = LED):
      • Menu Tools -> Board -> WEMOS D1 MINI ESP32
        • Port:  SLAB_USBtoUART
      • Menu Tools -> Board -> MH ET LIVE ESP32MiniKit
    • ESP32 Lolin 32 lite (GPIO22 = LED):
      • Menu Tools -> Board -> SparkfFun ESP32 Thing
        • Upload Speed: 115200
      • Menu Tools -> Board -> WEMOS LOLIN32
        • Upload Speed: 115200
    • ESP32-Camera:
      • Menu Tools -> Board -> ESP32 Dev Module
    • WEMOS D1 R32 (Uno) (GPIO02 = LED):
      • Menu Tools -> Board -> WEMOS D1 MINI ESP32
        • Upload Speed: 115200

References:
If you like this content, feel free to