Expand description
A hardware abstraction layer (HAL) for i.MX RT MCUs.
imxrt-hal
contains a collection of hardware drivers for various i.MX RT
MCUs. A default build of imxrt-hal
provides drivers that are portable
across all i.MX RT chips. When your specific chip is known, imxrt-hal
provides additional, chip-specific APIs. Most drivers implement their
corresponding embedded-hal
traits, or they can be adapted to use
embedded-hal
traits in user code.
§Building
imxrt-hal
requires that you, or something in your dependency graph, enable
a chip-specific feature from imxrt-ral
, the i.MX RT register access layer
(RAL). Without this, the HAL does not build. Since the HAL uses the RAL in
its public API, you’re expected to depend on both packages.
Here’s an example of a project that builds the imxrt-hal
for an i.MX RT
1062 system.
[dependencies.imxrt-hal] # There's no required feature here...
version = # ...
[dependencies.imxrt-ral]
version = # ...
features = ["imxrt1062"] # ...but this feature is required.
Once you’ve enabled a RAL feature, the HAL builds without any additional features. All APIs exposed in this build are portable across all supported i.MX RT chips.
§Examples
See each module’s documentation for examples. Note that documentation examples may assume a specific chip and chip family, so you may need to adapt the example for your hardware.
The imxrt-hal
repository maintains examples that run on various i.MX RT
development boards. See the project documentation for more information.
§Configuration
Use these optional features to control the HAL build.
Feature | Description |
---|---|
"imxrt1010" | Enable features for the 1010 chips. |
"imxrt1020" | Enable features for the 1020 chips. |
"imxrt1060" | Enable features for the 1060 chips. |
"imxrt1064" | Enable features for the 1064 chips. |
"imxrt1170" | Enable features for the 1170 chips. |
"eh02-unproven" | Enable implementations for embedded-hal 0.2 "unproven" traits. |
"rand_core" | Allows the TRNG to be used with the rand package. |
The APIs exposed by the various "imxrt[...]"
features are chip specific.
The HAL does not support building with more than one of these features at a
time.
When enabling a HAL chip feature, make sure that it pairs properly with your
RAL chip selection. You are responsible for making sure that your RAL chip
feature is appropriate for the HAL chip feature. For instance, mixing the
RAL’s imxrt1062
feature with the HAL’s imxrt1010
feature is not
supported.
[dependencies.imxrt-hal]
version = # ...
#Bad: doesn't support RAL feature.
#features = ["imxrt1010"]
#Good: supports RAL feature
features = ["imxrt1060"]
[dependencies.imxrt-ral]
version = # ...
features = ["imxrt1062"] # Informs the HAL chip feature
The "eh02-unproven"
feature will not build without the corresponding
"unproven"
feature enabled in embedded-hal 0.2.
Modules§
- Analog to digital converters.
- Clock control module.
- Synchronous buck mode converter.
- Direct memory access.
- Pulse width modulation.
- General purpose I/O.
- General purpose timer.
- Pad muxing and configurations.
- Low-power inter-integrated circuit.
- Low-power serial peripheral interface.
- Low-power universal asynchronous receiver / transmitter.
- Periodic interrupt timers.
- Secure non-volatile storage.
- Temperature monitor.
- General timer APIs.
- True random number generator.
- USB device.