# esp-hal
[](https://crates.io/crates/esp-hal)
[](https://docs.espressif.com/projects/rust/esp-hal/latest/)


[](https://matrix.to/#/#esp-rs:matrix.org)
Bare-metal (`no_std`) hardware abstraction layer for Espressif devices.
Implements a number of blocking and, where applicable, async traits from the various packages in the [embedded-hal] repository.
For help getting started with this HAL, please refer to [The Rust on ESP Book] and the [documentation].
[embedded-hal]: https://github.com/rust-embedded/embedded-hal
[the rust on esp book]: https://docs.espressif.com/projects/rust/book/
## [Documentation]
[documentation]: https://docs.espressif.com/projects/rust/
## Supported Devices
| ESP32 | [Datasheet][esp32-datasheet] [TRM][esp32-trm] | `xtensa-esp32-none-elf` | Revisions below v3.0 are not supported. |
| ESP32-C2 | [Datasheet][esp32c2-datasheet] [TRM][esp32c2-trm] | `riscv32imc-unknown-none-elf` | |
| ESP32-C3 | [Datasheet][esp32c3-datasheet] [TRM][esp32c3-trm] | `riscv32imc-unknown-none-elf` | |
| ESP32-C5 | [Datasheet][esp32c5-datasheet] [TRM][esp32c5-trm] | `riscv32imac-unknown-none-elf` | |
| ESP32-C6 | [Datasheet][esp32c6-datasheet] [TRM][esp32c6-trm] | `riscv32imac-unknown-none-elf` | |
| ESP32-C61 | [Datasheet][esp32c61-datasheet] [TRM][esp32c61-trm] | `riscv32imac-unknown-none-elf` | |
| ESP32-H2 | [Datasheet][esp32h2-datasheet] [TRM][esp32h2-trm] | `riscv32imac-unknown-none-elf` | |
| ESP32-P4 | [Datasheet][esp32p4-datasheet] [TRM][esp32p4-trm] | `riscv32imafc-unknown-none-elf` | Revisions below v3.0 are not supported. |
| ESP32-S2 | [Datasheet][esp32s2-datasheet] [TRM][esp32s2-trm] | `xtensa-esp32s2-none-elf` | |
| ESP32-S3 | [Datasheet][esp32s3-datasheet] [TRM][esp32s3-trm] | `xtensa-esp32s3-none-elf` | |
| ESP32-S31 | [Datasheet][esp32s31-datasheet] [TRM][esp32s31-trm] | `riscv32imafc-unknown-none-elf` | In early stages of development. |
[esp32-datasheet]: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf
[esp32-trm]: https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf
[esp32c2-datasheet]: https://www.espressif.com/sites/default/files/documentation/esp8684_datasheet_en.pdf
[esp32c2-trm]: https://www.espressif.com/sites/default/files/documentation/esp8684_technical_reference_manual_en.pdf
[esp32c3-datasheet]: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf
[esp32c3-trm]: https://www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf
[esp32c5-datasheet]: https://www.espressif.com/sites/default/files/documentation/esp32-c5_datasheet_en.pdf
[esp32c5-trm]: https://www.espressif.com/sites/default/files/documentation/esp32-c5_technical_reference_manual_en.pdf
[esp32c6-datasheet]: https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf
[esp32c6-trm]: https://www.espressif.com/sites/default/files/documentation/esp32-c6_technical_reference_manual_en.pdf
[esp32c61-datasheet]: https://www.espressif.com/sites/default/files/documentation/esp32-c61_datasheet_en.pdf
[esp32c61-trm]: https://www.espressif.com/sites/default/files/documentation/esp32-c61_technical_reference_manual_en.pdf
[esp32h2-datasheet]: https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf
[esp32h2-trm]: https://www.espressif.com/sites/default/files/documentation/esp32-h2_technical_reference_manual_en.pdf
[esp32p4-datasheet]: https://www.espressif.com/sites/default/files/documentation/esp32-p4_datasheet_en.pdf
[esp32p4-trm]: https://www.espressif.com/sites/default/files/documentation/esp32-p4_technical_reference_manual_en.pdf
[esp32s2-datasheet]: https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf
[esp32s2-trm]: https://www.espressif.com/sites/default/files/documentation/esp32-s2_technical_reference_manual_en.pdf
[esp32s3-datasheet]: https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf
[esp32s3-trm]: https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf
[esp32s31-datasheet]: https://www.espressif.com/sites/default/files/documentation/esp32-s31_datasheet_en.pdf
[esp32s31-trm]: https://www.espressif.com/sites/default/files/documentation/esp32-s31_technical_reference_manual_en.pdf
## Peripheral support
* Empty cell: Not available
* ❌: Not supported
* ⚒️: Partial support
* ✔️: Supported
### GPIO
| GPIO | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| Dedicated GPIO | | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ |
| IOMUX | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ |
| LP IO | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ❌ |
### Serial interfaces
| UART | [✔️][6138] | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| LP UART | | | | [❌][5155] | ⚒️ | | | ❌ | | | ❌ |
| UHCI | ❌ | | ⚒️ | ⚒️ | ⚒️ | | ⚒️ | ⚒️ | ❌ | ⚒️ | ⚒️ |
| I2C master | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| LP I2C master | ❌ | | | ⚒️ | ⚒️ | | | ⚒️ | ❌ | ⚒️ | ❌ |
| I2C slave | [❌][1909] | | ⚒️ | [❌][1909] | ⚒️ | [❌][1909] | [❌][1909] | ❌ | [❌][1909] | [❌][1909] | ❌ |
| I3C master | | | | | | | | ❌ | | | |
| I3C slave | | | | | | | | ❌ | | | |
| SPI master | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| SPI slave | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ |
| LP SPI master | | | | | | | | ❌ | | | |
| LP SPI slave | | | | | | | | ❌ | | | |
| I2S | ⚒️ | | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ❌ |
| LP I2S | | | | | | | | ❌ | | | |
| PARL_IO | | | | ⚒️ | ⚒️ | | ⚒️ | ❌ | | | ❌ |
| RMT | ⚒️ | | ⚒️ | ⚒️ | ⚒️ | | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ |
| SDMMC/SDIO host | ⚒️ | | | | | | | ⚒️ | | ⚒️ | ⚒️ |
| SDIO slave | ❌ | | | [❌][5169] | ❌ | [❌][5417] | | | | | |
| TWAI | ⚒️ | | ⚒️ | | ⚒️ | | ⚒️ | ❌ | ⚒️ | ⚒️ | |
| CANFD | | | | [❌][5163] | | | | | | | ❌ |
| USB OTG FS | | | | | | | | ⚒️ | ⚒️ | ⚒️ | |
| USB OTG HS | | | | | | | | ⚒️ | | | ⚒️ |
| USB Serial/JTAG | | | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | | ⚒️ | ⚒️ |
### Wireless and networking
| Bluetooth | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | | | ⚒️ | ❌ |
| WIFI | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | | | ⚒️ | ⚒️ | ❌ |
| IEEE 802.15.4 | | | | ⚒️ | ⚒️ | | ⚒️ | | | | ❌ |
| Ethernet | ⚒️ | | | | | | | ⚒️ | | | ❌ |
### Display and camera
| Camera interface | ❌ | | | | | | | ❌ | ❌ | ⚒️ | ❌ |
| MIPI-CSI | | | | | | | | ❌ | | | |
| MIPI-DSI | | | | | | | | ⚒️ | | | |
| RGB display | ⚒️ | | | | | | | ❌ | ❌ | ⚒️ | ❌ |
| SPI LCD interface | | | | | | | | | [❌][5374] | | |
### Signal processing
| Bit Scrambler | | | | [❌][5170] | | | | ❌ | | | ❌ |
| Image Signal Processor | | | | | | | | ❌ | | | |
| Pixel Processing Accelerator | | | | | | | | ❌ | | | ❌ |
| JPEG Codec | | | | | | | | ❌ | | | ❌ |
| H.264 encoder | | | | | | | | ❌ | | | |
| Audio Sample Rate Converter | | | | | | | | | | | ❌ |
| CORDIC accelerator | | | | | | | | | | | ❌ |
| Voice Activity Detection | | | | | | | | ❌ | | | |
### Analog
| ADC | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ |
| Analog Voltage Comparator | | | | [❌][5168] | | [❌][5423] | ❌ | ❌ | | | ❌ |
| DAC | ⚒️ | | | | | | | | ⚒️ | | ❌ |
| Temperature sensor | ⚒️ | ⚒️ | ⚒️ | [❌][5153] | ⚒️ | [❌][5421] | ⚒️ | ❌ | ⚒️ | ⚒️ | ❌ |
| Touch | ⚒️ | | | [❌][5164] | | | | ❌ | [❌][1905] | [❌][1905] | ❌ |
### Timers and motor control
| LEDC | ⚒️ | ⚒️ | ⚒️ | [❌][5161] | ⚒️ | [❌][5418] | ⚒️ | ❌ | ⚒️ | ⚒️ | ❌ |
| MCPWM | ⚒️ | | | [❌][5154] | ⚒️ | | ⚒️ | ❌ | | ⚒️ | ❌ |
| PCNT | ⚒️ | | | ⚒️ | ⚒️ | | ⚒️ | ❌ | ⚒️ | ⚒️ | ❌ |
| RTC Timekeeping | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ |
| SDM | ⚒️ | | ⚒️ | ⚒️ | ⚒️ | | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ |
| SYSTIMER | | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ |
| Timers | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ |
### Cryptography and security
| AES | ⚒️ | | ⚒️ | ⚒️ | ⚒️ | | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ |
| RSA Digital Signature | | | [❌][884] | [❌][884] | [❌][884] | | [❌][884] | ❌ | [❌][884] | [❌][884] | ❌ |
| ECDSA Digital Signature | | | | [❌][5444] | | [❌][5444] | [❌][5444] | ❌ | | | ❌ |
| ECC | | ⚒️ | | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | | | [⚒️][5972] |
| HMAC | | | ⚒️ | [❌][5166] | ⚒️ | | ⚒️ | ❌ | ⚒️ | ⚒️ | ❌ |
| Key Manager | | | | [❌][5171] | | | | ❌ | | | ❌ |
| RNG | [⚒️][5979] | [⚒️][5979] | [⚒️][5979] | [⚒️][5980] | [⚒️][5979] | [⚒️][5981] | [⚒️][5979] | [⚒️][5982] | [⚒️][5979] | [⚒️][5979] | [⚒️][5977] |
| RSA | ⚒️ | | ⚒️ | ⚒️ | ⚒️ | | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ |
| SHA | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | [⚒️][5973] |
### Low power
| Light/deep sleep | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ❌ |
| ULP (FSM) | [❌][376] | | | | | | | | [❌][376] | [❌][376] | |
| ULP (RISC-V) | | | | [❌][5160] | ⚒️ | | | ❌ | ⚒️ | ⚒️ | ❌ |
### System
| ASSIST_DEBUG | | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ❌ | | ⚒️ | ❌ |
| DMA | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ |
| ETM | | | | [❌][5167] | ⚒️ | [❌][5419] | ⚒️ | ❌ | | | ❌ |
| Interrupts | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ | ⚒️ |
| PSRAM | ⚒️ | | | ⚒️ | | ⚒️ | | ⚒️ | ⚒️ | ⚒️ | ⚒️ |
[376]: https://github.com/esp-rs/esp-hal/issues/376
[884]: https://github.com/esp-rs/esp-hal/issues/884
[1905]: https://github.com/esp-rs/esp-hal/issues/1905
[1909]: https://github.com/esp-rs/esp-hal/issues/1909
[5153]: https://github.com/esp-rs/esp-hal/issues/5153
[5154]: https://github.com/esp-rs/esp-hal/issues/5154
[5155]: https://github.com/esp-rs/esp-hal/issues/5155
[5160]: https://github.com/esp-rs/esp-hal/issues/5160
[5161]: https://github.com/esp-rs/esp-hal/issues/5161
[5163]: https://github.com/esp-rs/esp-hal/issues/5163
[5164]: https://github.com/esp-rs/esp-hal/issues/5164
[5166]: https://github.com/esp-rs/esp-hal/issues/5166
[5167]: https://github.com/esp-rs/esp-hal/issues/5167
[5168]: https://github.com/esp-rs/esp-hal/issues/5168
[5169]: https://github.com/esp-rs/esp-hal/issues/5169
[5170]: https://github.com/esp-rs/esp-hal/issues/5170
[5171]: https://github.com/esp-rs/esp-hal/issues/5171
[5374]: https://github.com/esp-rs/esp-hal/issues/5374
[5417]: https://github.com/esp-rs/esp-hal/issues/5417
[5418]: https://github.com/esp-rs/esp-hal/issues/5418
[5419]: https://github.com/esp-rs/esp-hal/issues/5419
[5421]: https://github.com/esp-rs/esp-hal/issues/5421
[5423]: https://github.com/esp-rs/esp-hal/issues/5423
[5444]: https://github.com/esp-rs/esp-hal/issues/5444
[5972]: https://github.com/esp-rs/esp-hal/issues/5972
[5973]: https://github.com/esp-rs/esp-hal/issues/5973
[5977]: https://github.com/esp-rs/esp-hal/issues/5977
[5979]: https://github.com/esp-rs/esp-hal/issues/5979
[5980]: https://github.com/esp-rs/esp-hal/issues/5980
[5981]: https://github.com/esp-rs/esp-hal/issues/5981
[5982]: https://github.com/esp-rs/esp-hal/issues/5982
[6138]: https://github.com/esp-rs/esp-hal/issues/6138
## `unstable` feature
The stable feature set is designed to remain consistent and reliable. Other parts guarded by the `unstable` feature, however, are still under active development and may undergo breaking changes and are disabled by default.
## Minimum Supported Rust Version (MSRV)
This crate is guaranteed to compile when using the latest stable Rust version at the time of the crate's release. It _might_ compile with older versions, but that may change in any new release, including patches.
## License
Licensed under either of:
- Apache License, Version 2.0 ([LICENSE-APACHE](../LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](../LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in
the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without
any additional terms or conditions.