ESPTool 2.0.5
See the version list below for details.
dotnet add package ESPTool --version 2.0.5
NuGet\Install-Package ESPTool -Version 2.0.5
<PackageReference Include="ESPTool" Version="2.0.5" />
paket add ESPTool --version 2.0.5
#r "nuget: ESPTool, 2.0.5"
// Install ESPTool as a Cake Addin #addin nuget:?package=ESPTool&version=2.0.5 // Install ESPTool as a Cake Tool #tool nuget:?package=ESPTool&version=2.0.5
ESPTool - ESP32 Flashing and Bootloader Tool
ESPTool is a C# implementation of Espressif's ESP tool: https://github.com/espressif/esptool
I created this project because I wanted a native C# implementation that does not rely on external applications. This library is designed to interact with ESP32 devices for tasks such as flashing firmware and erasing flash memory, providing a way to communicate with ESP32 using serial communication.
Note: The NuGet package is currently outdated. See this issue for more details: Issue #5
Looking for a GUI tool? Check out the ESPFlasher GUI tool on GitHub.
Features
- Execute pin sequences to start the bootloader
- Load and run a softloader
- Erase flash memory
- Upload firmware to the device
- Detect chip type
- Reset the device
Supported Devices
Currently, the following ESP devices are supported:
- ESP8266
- ESP32
- ESP32-S2
- ESP32-S3
- ESP32-C2
- ESP32-C3
- ESP32-C6
Contributions to add support for other ESP chips are welcome! Feel free to submit pull requests or open an issue if you encounter problems.
Example Usage
// Create the tool
var espTool = new ESPTool();
// Open the serial port
espTool.OpenSerial("COM3", 115200);
// Start the bootloader (This is the bootloader on the device itself)
await espTool.StartBootloaderAsync();
// Detect the chip type
var chipType = await espTool.DetectChipTypeAsync();
Console.WriteLine($"Detected chip: {chipType}");
// Get the firmware for the softloader
var softloaderFirmware = DefaultFirmwareProviders.GetSoftloaderForDevice(chipType);
// Start the softloader (This supports commands that the bootloader lacks)
await espTool.StartSoftloaderAsync(softloaderFirmware);
// Erase the flash, this is not supported by the bootloader, so we needed to start the softloader
await espTool.EraseFlashAsync();
// Change the baudrate for faster uploading
await _espTool.ChangeBaudAsync(BaudRate, token);
// Upload some firmware, you will need to implement the IFirmwareProvider interface
var firmware = xxx;
await _espTool.UploadFirmwareAsync(firmware, FirmwareUploadMethods.FlashDeflated);
// Reset the device after uploading firmware
await espTool.ResetDeviceAsync();
// Close the serial port
espTool.CloseSerial();
Software Overview
ESPTool
is a C# implementation of the ESP32 flashing and bootloader communication protocol. It allows you to interface with ESP32-based devices over serial communication, perform chip detection, erase flash memory, and upload firmware. It extends the default bootloader functionality by enabling the use of a softloader, which adds extra commands that aren't available in the ESP ROM bootloader.
Loader and SoftLoader
The ESP32BootLoader
and SoftLoader
classes are responsible for communicating with the bootloader and softloader running on the ESP device.
ESP32BootLoader
: Represents the interaction with the bootloader built into the ESP ROM, offering limited commands.SoftLoader
: Represents the interaction with a software-loaded bootloader running in RAM, extending functionality with additional commands like compressed data flashing and baud rate adjustments.
Communicator
Communicator
handles low-level serial communication with the ESP32 device, including:- Opening and closing the serial port
- Sending SLIP-encoded frames
- Reading and writing data from/to the device
- Sending bootloader and reset pin sequences
License
This project is licensed under the MIT License. See LICENSE for details.
Additional Resources
- Official ESPTool Protocol Documentation: Espressif Docs
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Logging (>= 8.0.0)
- System.IO.Ports (>= 5.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.