espulp – ESP Ultra Low Power Processor Module

The espulp module adds ability to load and run programs on the ESP32-Sx’s ultra-low-power RISC-V processor.

import espulp
import memorymap

shared_mem = memorymap.AddressRange(start=0x50000000, length=1024)
ulp = espulp.ULP()

with open("program.bin", "rb") as f:
    program = f.read()

ulp.run(program)
print(shared_mem[0])
# ulp.halt()

Available on these boards
  • ATMegaZero ESP32-S2
  • Adafruit Camera
  • Adafruit Feather ESP32 V2
  • Adafruit Feather ESP32-S2 Reverse TFT
  • Adafruit Feather ESP32-S2 TFT
  • Adafruit Feather ESP32-S3 Reverse TFT
  • Adafruit Feather ESP32-S3 TFT
  • Adafruit Feather ESP32S2
  • Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM
  • Adafruit Feather ESP32S3 No PSRAM
  • Adafruit Feather HUZZAH32
  • Adafruit FunHouse
  • Adafruit HUZZAH32 Breakout
  • Adafruit ItsyBitsy ESP32
  • Adafruit MagTag
  • Adafruit MatrixPortal S3
  • Adafruit Metro ESP32S2
  • Adafruit Metro ESP32S3
  • Adafruit Mini Sparkle Motion
  • Adafruit QT Py ESP32 PICO
  • Adafruit QT Py ESP32-S3 4MB Flash 2MB PSRAM
  • Adafruit QT Py ESP32-S3 no psram
  • Adafruit QT Py ESP32S2
  • Adafruit Sparkle Motion
  • Adafruit Sparkle Motion Stick
  • Adafruit Vindie S2
  • Adafruit-Qualia-S3-RGB666
  • Ai Thinker ESP32-CAM
  • Arduino Nano ESP32
  • Artisense Reference Design RD00
  • AutosportLabs-ESP32-CAN-X2
  • BARDUINO 4.0.2
  • BLING!
  • BPI-Bit-S2
  • BPI-Leaf-S3
  • BPI-PicoW-S3
  • BastWiFi
  • Bee-Data-Logger
  • Bee-Motion-S3
  • Bee-S3
  • BlizzardS3
  • CRCibernetica IdeaBoard
  • CircuitART Zero S3
  • ColumbiaDSL-Sensor-Board-V1
  • CrowPanel 4.2 EPaper
  • CrumpS2
  • Cytron Maker Feather AIoT S3
  • DFRobot FireBeetle 2 ESP32-S3
  • Deneyap Kart
  • Deneyap Kart 1A
  • Deneyap Kart 1A v2
  • Deneyap Mini
  • Deneyap Mini v2
  • EDGES3D
  • ES3ink
  • ESP 12k NodeMCU
  • ESP32 Devkit V1
  • ESP32-S2-DevKitC-1-N4
  • ESP32-S2-DevKitC-1-N4R2
  • ESP32-S2-DevKitC-1-N8R2
  • ESP32-S3-Box-2.5
  • ESP32-S3-Box-3
  • ESP32-S3-Box-Lite
  • ESP32-S3-DevKitC-1-N16
  • ESP32-S3-DevKitC-1-N32R16
  • ESP32-S3-DevKitC-1-N32R8
  • ESP32-S3-DevKitC-1-N8
  • ESP32-S3-DevKitC-1-N8R2
  • ESP32-S3-DevKitC-1-N8R2 (ROS version)
  • ESP32-S3-DevKitC-1-N8R8
  • ESP32-S3-DevKitC-1-N8R8-with-HACKTABLET
  • ESP32-S3-DevKitM-1-N8
  • ESP32-S3-EYE
  • ESP32-S3-USB-OTG-N8
  • Elecrow CrowPanel
  • Eliobot
  • Espressif ESP32 DevKitc V4 WROOM-32E
  • Espressif ESP32 DevKitc V4 WROVER
  • Espressif ESP32 TTGO T8 v1.7
  • Espressif ESP32-EYE
  • Espressif ESP32-LyraT
  • Espressif-ESP32-S3-LCD-EV-Board
  • Espressif-ESP32-S3-LCD-EV-Board_v1.5
  • FeatherS2
  • FeatherS2 Neo
  • FeatherS2 PreRelease
  • FeatherS3
  • FeatherS3 Neo
  • Flipper Zero Wi-Fi Dev
  • Franzininho WIFI w/Wroom
  • Franzininho WIFI w/Wrover
  • Freenove ESP32-WROVER-DEV-CAM
  • Gravitech Cucumber M
  • Gravitech Cucumber MS
  • Gravitech Cucumber R
  • Gravitech Cucumber RS
  • HMI-DevKit-1.1
  • Hardkernel Odroid Go
  • Heltec ESP32-S3-WIFI-LoRa-V3
  • Heltec Vison Master E290
  • Heltec Wireless Paper
  • HexKyS2
  • Ikea Alpstuga Drop-In ESP32S3 4MB Flash 2MB PSRAM
  • IoTs2
  • Kaluga 1
  • LILYGO T-DISPLAY S3 v1.2
  • LILYGO T-Deck (Plus)
  • LILYGO T-Display S3 Pro
  • LILYGO T-Dongle S3
  • LILYGO T-QT PRO NO PSRAM
  • LILYGO T-QT PRO PSRAM
  • LILYGO T-Watch-S3
  • LILYGO TEMBED ESP32S3
  • LILYGO TTGO T-DISPLAY v1.1
  • LILYGO TTGO T-DISPLAY v1.1 4M
  • LILYGO TTGO T8 ESP32-S2
  • LILYGO TTGO T8 ESP32-S2 w/Display
  • LOLIN S3 16MB Flash 8MB PSRAM
  • LOLIN S3 MINI 4MB Flash 2MB PSRAM
  • LOLIN S3 MINI PRO 4MB Flash 2MB PSRAM
  • LOLIN S3 PRO 16MB Flash 8MB PSRAM
  • Lilygo T-watch 2020 V3
  • M5Stack Atom Echo
  • M5Stack Atom Lite
  • M5Stack Atom Matrix
  • M5Stack Atom U
  • M5Stack AtomS3
  • M5Stack AtomS3 Lite
  • M5Stack AtomS3U
  • M5Stack Cardputer
  • M5Stack Cardputer (ROS version)
  • M5Stack Core Basic
  • M5Stack Core Fire
  • M5Stack Core2
  • M5Stack CoreS3
  • M5Stack CoreS3 SE
  • M5Stack Dial
  • M5Stack DinMeter
  • M5Stack M5Paper
  • M5Stack Stamp-S3
  • M5Stack Stick C
  • M5Stack Stick C Plus
  • M5Stack Stick C Plus2
  • M5Stack Timer Camera X
  • MORPHEANS MorphESP-240
  • MagiClick S3 N4R2
  • Maker badge by Czech maker
  • MakerFabs-ESP32-S3-Parallel-TFT-With-Touch-7inch
  • MicroDev microS2
  • MixGo CE
  • NHB Systems JL401-S3 4MB Flash 2MB PSRAM
  • NanoS3
  • Neuron
  • OMGS3
  • Oak Dev Tech PixelWing ESP32S2
  • Oxocard Artwork
  • Oxocard Connect
  • Oxocard Galaxy
  • Oxocard Science
  • PCBCupid GLYPH S3
  • ProS3
  • Prokyber Ai-On-The-Edge-Cam
  • RGBTouch Mini
  • Red S2-WROOM
  • S2Mini
  • S2Pico
  • SQFMI Watchy
  • Saola 1 w/Wroom
  • Saola 1 w/Wrover
  • Seeed Xiao ESP32-S3 Sense
  • Seeed Xiao ESP32-S3 Trmnl DIY Kit
  • Sunton-ESP32-8048S050
  • Sunton-ESP32-8048S070
  • TTGO T8 ESP32-S2-WROOM
  • Targett Module Clip w/Wroom
  • Targett Module Clip w/Wrover
  • ThingPulse Pendrive S3
  • TinyPICO
  • TinyPICO Nano
  • TinyS2
  • TinyS3
  • TinyWATCH S3
  • VCC-GND YD-ESP32-S3 (N16R8)
  • VCC-GND YD-ESP32-S3 (N8R8)
  • VIDI X V1.1
  • Waveshare ESP32-S2-Pico
  • Waveshare ESP32-S2-Pico-LCD
  • Waveshare ESP32-S3 LCD 1.47
  • Waveshare ESP32-S3 Touch LCD 1.47
  • Waveshare ESP32-S3 Touch LCD 2.8
  • Waveshare ESP32-S3-ETH
  • Waveshare ESP32-S3-GEEK
  • Waveshare ESP32-S3-Matrix
  • Waveshare ESP32-S3-Pico
  • Waveshare ESP32-S3-Tiny
  • Waveshare ESP32-S3-Tiny-N8R8
  • Waveshare ESP32-S3-Touch-AMOLED-2.41
  • Waveshare ESP32-S3-Zero
  • Waveshare ESP32S3 LCD 1.28
  • Waveshare ESP32S3 Touch LCD 2
  • WeMos LOLIN32 Lite
  • Yoto Mini 2024
  • Yoto Player V3
  • nanoESP32-S2 w/Wrover
  • nanoESP32-S2 w/Wroom
  • senseBox MCU Eye ESP32S3
  • senseBox MCU-S2 ESP32S2
  • sunton_esp32_2432S024C
  • sunton_esp32_2432S028
  • sunton_esp32_2432S032C
  • uGame S3

espulp.get_rtc_gpio_number(pin: microcontroller.Pin) → int | None

Return the RTC GPIO number of the given pin or None if not connected to RTC GPIO.

class espulp.Architecture

The ULP architectures available.

FSM: Architecture

The ULP Finite State Machine.

RISCV: Architecture

The ULP RISC-V Coprocessor.

class espulp.ULP(arch: Architecture = Architecture.FSM)

The ultra-low-power processor.

Raises an exception if another ULP has been instantiated. This ensures that is is only used by one piece of code at a time.

Parameters:

arch (Architecture) – The ulp arch.

deinit() → None

Deinitialises the ULP and releases it for another program.

__enter__() → ULP

No-op used by Context Managers.

__exit__() → None

Automatically deinitializes the hardware when exiting a context. See Lifetime and ContextManagers for more info.

set_wakeup_period(period_index: int, period_us: int) → None

Sets the wakeup period for the ULP.

Parameters:
  • period_index (int) – = 0..4. Up to 5 different wakeup periods can be stored and used by the wakeup timer. By default, the value stored in period index 0 is used.

  • period_us (int) – The wakeup period given in microseconds.

run(program: circuitpython_typing.ReadableBuffer, *, entrypoint: int = 0, pins: Sequence[microcontroller.Pin] = ()) → None

Loads the program into ULP memory and then runs the program.

The program will continue to run even Python is halted or in deep-sleep.

Parameters:
  • program (ReadableBuffer) – the ULP binary.

  • entrypoint (int) – Specifies the offset (in bytes) of the first instruction from the start of the program (Only used by FSM ULP).

  • pins (Sequence[microcontroller.Pin]) – Pins made available to the ULP. The pins are claimed and not reset until halt() is called.

halt() → None

Halts the running program and releases the pins given in run(). Note: for the FSM ULP, a running ULP program is not actually interrupted. Instead, only the wakeup timer is stopped.

arch: Architecture

The ulp architecture. (read-only)

class espulp.ULPAlarm(ulp: ULP)

Trigger an alarm when the ULP requests wake-up.

Create an alarm that will be triggered when the ULP requests wake-up.

The alarm is not active until it is passed to an alarm-enabling function, such as alarm.light_sleep_until_alarms() or alarm.exit_and_deep_sleep_until_alarms().

Parameters:

ulp (ULP) – The ulp instance