Skip to main content

ESP32 flasher driver for Jumpstarter

Project description

ESP32 driver

jumpstarter-driver-esp32 provides functionality for flashing and managing ESP32 devices using esptool as a library. It implements the FlasherInterface from jumpstarter-driver-opendal.

Installation

:substitutions:
$ pip3 install --extra-index-url {{index_url}} jumpstarter-driver-esp32

Configuration

Example configuration:

export:
  storage:
    type: jumpstarter_driver_esp32.driver.Esp32Flasher
    config:
      baudrate: 115200
      chip: "esp32"
    children:
      serial:
        ref: serial
  serial:
    type: jumpstarter_driver_pyserial.driver.PySerial
    config:
      url: "/dev/ttyUSB0"
      baudrate: 115200

Config parameters

Parameter Description Type Required Default
baudrate Baud rate for esptool communication int no 115200
chip Target chip type str no esp32

The ESP32 driver requires a serial child driver (PySerial) for serial port access. DTR/RTS control signals and the serial port path are managed through the child driver. Use a ref proxy to share the serial driver with the top-level composite, enabling both j serial start-console and j storage flash to work.

API Reference

.. autoclass:: jumpstarter_driver_esp32.client.Esp32FlasherClient()
    :members: flash, dump, get_chip_info, erase, hard_reset, enter_bootloader

CLI

$ j storage
Usage: j storage [OPTIONS] COMMAND [ARGS]...

Commands:
  bootloader  Enter download mode
  chip-info   Get chip info (name, features, MAC)
  dump        Dump flash content to file
  erase       Erase entire flash
  flash       Flash firmware to ESP32
  reset       Hard reset the chip

$ j serial
Usage: j serial [OPTIONS] COMMAND [ARGS]...

Commands:
  start-console  Start serial port console
  pipe           Pipe serial port data to stdout or file

Examples

CLI usage

# Flash MicroPython firmware
j storage flash firmware.bin --address 0x1000

# Get chip info
j storage chip-info

# Enter download mode
j storage bootloader

# Erase entire flash
j storage erase

# Hard reset
j storage reset

# Open serial console
j serial start-console

# Read serial output
j serial pipe

Python API

# Get chip information
info = client.storage.get_chip_info()
print(info["chip"])      # e.g. "ESP32-D0WD-V3 (revision v3.1)"
print(info["features"])  # e.g. "Wi-Fi, BT, Dual Core"
print(info["mac"])       # e.g. "5c:01:3b:68:ab:0c"

# Flash firmware
client.storage.flash("/path/to/firmware.bin", target="0x1000")

# Enter download mode
client.storage.enter_bootloader()

# Erase flash
client.storage.erase()

# Hard reset
client.storage.hard_reset()

# Serial console via pexpect
console = client.serial.open()
console.sendline("import machine")
console.expect(">>>")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jumpstarter_driver_esp32-0.8.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jumpstarter_driver_esp32-0.8.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file jumpstarter_driver_esp32-0.8.1.tar.gz.

File metadata

File hashes

Hashes for jumpstarter_driver_esp32-0.8.1.tar.gz
Algorithm Hash digest
SHA256 e19d6562e14ec8deb845212bf9aa43d9085784b92d67d75e7738f69f44c15731
MD5 9644988ce73cfa14b83e10d7fecf840c
BLAKE2b-256 d3b2d9c1c52bbddca8ea522d9b9d24622a4fcf8db20f9e354cf75e224ae02ee6

See more details on using hashes here.

File details

Details for the file jumpstarter_driver_esp32-0.8.1-py3-none-any.whl.

File metadata

File hashes

Hashes for jumpstarter_driver_esp32-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a71447cf028624feb0a24753cbed3b3ac70903599ffa95e9640ecdcbcf5c1e6b
MD5 7707ff7826e525f82bb80daba42d9763
BLAKE2b-256 618dabbe8bc9182cbb856ef91be4c937d66a29f546b50035a4c35490d09281fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page