class documentation
Flash firmware to an ESP32 ROM bootloader.
| Method | __init__ |
Initialize the ESP32 flasher. |
| Method | bootloader |
Enter the ESP32 ROM bootloader download mode. |
| Method | flash |
Attach the ESP32 SPI flash chip. |
| Method | flash |
Configure the ESP32 flash geometry. |
| Method | flash |
Read and return the connected ESP32 flash size. |
| Method | flash |
Verify a firmware file against the ESP32 flash contents. |
| Method | flash |
Write a firmware file to the ESP32 flash chip. |
| Method | reboot |
Reboot the ESP32 after flashing. |
| Method | set |
Set the ESP32 and UART communication baud rate. |
| Instance Variable | baudrate |
Undocumented |
| Instance Variable | chip |
Undocumented |
| Instance Variable | gpio0 |
Undocumented |
| Instance Variable | log |
Undocumented |
| Instance Variable | md5sum |
Undocumented |
| Instance Variable | reset |
Undocumented |
| Instance Variable | uart |
Undocumented |
| Method | _checksum |
Calculate the ESP32 packet checksum. |
| Method | _clear |
Clear UART input and buffered SLIP data. |
| Method | _command |
Send a command and return its response. |
| Method | _detach |
Detach the flasher UART from the MicroPython REPL. |
| Method | _log |
Log a packet when diagnostics are enabled. |
| Method | _poll |
Poll a flash register until a flag clears. |
| Method | _read |
Read a value from an ESP32 flash register. |
| Method | _read |
Read and decode one SLIP packet from the ESP32. |
| Method | _restore |
Restore the MicroPython REPL UART. |
| Method | _strerror |
Return a human-readable ESP32 error message. |
| Method | _write |
Write a value to an ESP32 flash register. |
| Method | _write |
Write a SLIP-encoded packet to the ESP32. |
| Instance Variable | _flash |
Undocumented |
| Instance Variable | _pyb |
Undocumented |
| Instance Variable | _repl |
Undocumented |
| Instance Variable | _slip |
Undocumented |
| Instance Variable | _spi |
Undocumented |
| Instance Variable | _spi |
Undocumented |
| Instance Variable | _spi |
Undocumented |
| Instance Variable | _spi |
Undocumented |
Initialize the ESP32 flasher.
| Parameters | |
reset:callable | Function used to control the ESP32 reset pin. |
gpio0:callable | Function used to control the ESP32 GPIO0 pin. |
uart:UART | Picoware UART interface connected to the ESP32. |
logbool | Whether to print packet diagnostics. Defaults to False. |
chip:str | ESP ROM target. Defaults to "esp32". |
Enter the ESP32 ROM bootloader download mode.
| Parameters | |
retry:int | Number of reset attempts. Defaults to 6. |
| Returns | |
bool | True after synchronization succeeds. |
Configure the ESP32 flash geometry.
| Parameters | |
flashint | Flash size in bytes. Defaults to 2 * 1024 * 1024. |
Verify a firmware file against the ESP32 flash contents.
| Parameters | |
path:str | Path to the firmware image. |
digest:bytes or None | Expected hexadecimal MD5 digest. Defaults to None. |
offset:int | Flash offset to verify. Defaults to 0. |
def flash_write_file(self, path, blksize=_FLASH_WRITE_SIZE, progress_interval=_FLASH_PROGRESS_INTERVAL):
¶
Write a firmware file to the ESP32 flash chip.
| Parameters | |
path:str | Path to the firmware image. |
blksize:int | Number of bytes in each transfer block. Must be 4-byte aligned and no larger than the ESP32 ROM limit of 0x400. Defaults to 0x400. |
progressint | Number of blocks between progress messages. Defaults to 64. |
Set the ESP32 and UART communication baud rate.
| Parameters | |
baudrate:int | New baud rate. |
timeout:int | Unused compatibility argument. Defaults to 350. |
Send a command and return its response.
| Parameters | |
cmd:int | ESP32 ROM bootloader command. |
payload:bytes | Command payload. Defaults to b"". |
checksum:int | Payload checksum. Defaults to 0. |
| timeout | Undocumented |
| Returns | |
tuple | Response value and response data. |
Log a packet when diagnostics are enabled.
| Parameters | |
data:bytes | Packet data to log. |
out:bool | Whether the packet is outgoing. Defaults to True. |
Poll a flash register until a flag clears.
| Parameters | |
addr:int | Register offset from the flash register base. |
flag:int | Bit flag to wait for. |
retry:int | Maximum number of reads. Defaults to 10. |
delay:float | Delay between reads in seconds. Defaults to 0.050. |
Read a value from an ESP32 flash register.
| Parameters | |
addr:int | Register offset from the flash register base. |
| Returns | |
int | Register value. |
Read and decode one SLIP packet from the ESP32.
| Parameters | |
timeoutint | Maximum time to wait for a complete packet. |
| Returns | |
bytearray or None | Decoded packet, or None if no packet is available. |
Return a human-readable ESP32 error message.
| Parameters | |
err:int | ESP32 error code. |
| Returns | |
str | Error description. |
Write a value to an ESP32 flash register.
| Parameters | |
addr:int | Register offset from the flash register base. |
data:int | Value to write. |
mask:int | Register write mask. Defaults to 0xFFFFFFFF. |
delay:int | Hardware delay value. Defaults to 0. |