Skip to content

ESP32

ESP32 Pinout Reference

Pasted image 20230316230026.png

ESP32 WROOM32 Module

Pasted image 20230316174102.png

ESP32-WROOM

Pasted image 20230316174110.png

Pinout

Pasted image 20230316174123.png

Pasted image 20230316174128.png

Loading MicroPython

  1. Download firmware from: https://micropython.org/download/esp32/
  2. Burn firmware using: https://adafruit.github.io/Adafruit_WebSerial_ESPTool/
    • Offset is 0x1000
  3. Reset board and connect to serial port using Putty
  4. Type following:
from machine import Pin
led = Pin(2, Pin.OUT)
led.value(1)

Additional information: https://docs.micropython.org/en/latest/esp32/general.html

ESP32-CAM

Pasted image 20230316174237.png

Pinout

Pasted image 20230316174301.png

Pasted image 20230316174312.png

Loading MicroPython

  1. Download firmware from: https://micropython.org/download/esp32/
  2. Erase flash completely
  3. Burn firmware using: https://adafruit.github.io/Adafruit_WebSerial_ESPTool/ ○ Offset is 0x1000
  4. Reset board and connect to serial port using Putty
  5. Type following:
    from machine import Pin
    led = Pin(4, Pin.OUT)
    led.value(1)
    

Loading CircuitPython

  1. Download firmware from: https://circuitpython.org/board/espressif_esp32_eye/
  2. Erase flash completely
  3. Burn firmware using: https://adafruit.github.io/Adafruit_WebSerial_ESPTool/ ○ Offset is 0x0
  4. Reset board and connect to serial port using Putty
  5. Type following:
    from machine import Pin
    led = Pin(4, Pin.OUT)
    led.value(1)
    

Developing in VSCode

  • Set Anaconda prompt as default terminal: Pasted image 20230316174438.png

• mpremote mount . • Use 'execfile("filename.py")' to run code

Pasted image 20230316174459.png

JTAG Debugging

Note: See Segger J-Link for additional information.

Software Setup

  1. Download 'USB Driver Tool' from: https://visualgdb.com/UsbDriverTool/
  2. Change Jlink driver to WinUSB
  3. Pasted image 20230316213559.png

Wiring

Pasted image 20230316213607.png

Here's what it looks like when the J-Link is correctly connected:

$ cd C:\...\.platformio\packages\tool-openocd-esp32\bin>
$ openocd -f ..\share\openocd\scripts\interface\jlink.cfg -f ..\share\openocd\scripts\target\esp32.cfg -c "adapter speed 1000"

Pasted image 20230316213722.png

Arduino-ESP32 Library

Setup

  1. Install VSCode extension: https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/install.md
  2. Follow instructions from: Arduino as an ESP-IDF component

Command Line Snippets

OpenOCD

# Setup
cd C:\...\.platformio\packages\tool-openocd-esp32>
bin\openocd -f share\openocd\scripts\interface\jlink.cfg -f share\openocd\scripts\target\esp32.cfg -c "adapter speed 1000"

# Erasing Flash
-c "init; reset halt; flash erase_address 0x1000 4096000; exit"

# Programming Binary
-c "program c:\\...\\esp32-20220618-v1.19.1.bin 0x1000 verify exit"

RShell

In an Anaconda Prompt, type the following: .local/bin/rshell -p /dev/ttyS5 -b 115200

ESPTool

• Flashing Firmware: esptool --chip esp32 --port /dev/ttyUSB0 write_flash -z 0x1000 esp32-idf3-20200902-v1.13.bin

ESP-IDF

Examples

Console

ESP-IDF provides console component, which includes building blocks needed to develop an interactive console over serial port. This component includes following facilities:

  • Line editing, provided by linenoise library. This includes handling of backspace and arrow keys, scrolling through command history, command auto-completion, and argument hints.
  • Splitting of command line into arguments.
  • Argument parsing, provided by argtable3 library. This library includes APIs used for parsing GNU style command line arguments.
  • Functions for registration and dispatching of commands.
  • Functions to establish a basic REPL (Read-Evaluate-Print-Loop) environment.

From https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/console.html

Arduino Usage

This Arduino library wraps the ESP-IDF console: https://github.com/jbtronics/ESP32Console


Last update: 2023-03-16