nxp-pac

Crates

git

Versions

mcxn247

Flavors

Crate nxp_pac

Crate nxp_pac 

Source
Expand description

§nxp-pac

This is a Peripheral Access Crate for NXP microcontrollers.

MCXA and MCXN MetaPAC devices are generated at build time from the curated YAML and chip metadata packaged in data/, using Git-pinned chiptool. Only the selected chip’s required peripherals are rendered into Cargo’s OUT_DIR; generated Rust is not maintained in the source tree. Curated YAML is authoritative and maintained directly.

Legacy PAC devices retain their checked-in generated sources, originally derived from NXP’s mcux-soc-svd repo.

This crate will (hopefully) be used for embassy-nxp Rust Hardware Abstraction Layer (HAL) for the NXP microcontrollers.

§Cloning

Select exactly one chip feature, for example mcxa266, mcxa287, or mcxn235. The pac feature is enabled by default. metadata, rt, and defmt are opt-in; neither the defaults nor chip-selection features enable defmt. Enable it explicitly for defmt::Format implementations on register and enum types:

nxp-pac = { version = "0.1.0", features = ["mcxn556", "defmt"] }

Omit "defmt" when that formatting support is not needed to reduce compiler memory use. Cargo features are additive: another dependency enabling this crate’s defmt feature also enables it for the shared build. Standard core::fmt::Debug implementations do not require defmt.

Metadata-only host builds are supported with default features disabled. Building a MetaPAC does not require a vendor SVD checkout, external formatter, or generator executable.

MCXA/MCXN MetaPAC one-bit fields use primitive bool, not field-specific enums. false is the raw bit value 0 and true is 1, including for active-low controls. The field documentation retains the former enum’s bit meanings. Callers migrating from an enum getter/setter must use those raw Boolean values; true does not universally mean enabled. Wider fields retain their integer or enum types, even when they have only two named choices. Register layouts and software defaults are unchanged. The separate legacy two-core MCXN947 PAC is not part of this migration.

MCXN MetaPAC chip features are mcxn235, mcxn236, mcxn246, mcxn247, mcxn526, mcxn527, mcxn536, mcxn537, mcxn546, mcxn547, mcxn556, mcxn557, mcxn946, and mcxn947. The numeric features also cover matching T variants; mcxn556 and mcxn557 cover both S and T variants. The supplied NXP 26.09.00 packs have matching register maps within each group. Package options vary; verify pin bonding for the exact order code. Each feature selects one chip PAC; the legacy mcxn947_cm33_core0 and mcxn947_cm33_core1 features remain separate legacy PAC selections. For MCXN947, both CPU firmware images can use the single mcxn947 PAC with the appropriate target/runtime ABI. Core peripherals such as SysTick are supplied by the Cortex-M runtime ecosystem, not modeled as device peripherals here. Do not infer the same FPU or MPU features for both CPUs from a shared chip PAC.

These are raw register-access bindings, not a HAL or safety/security certification. Factory trim, behavioral requirements, and errata handling remain the caller’s responsibility. NPU controls are opaque in the available public register documentation; this does not imply a public NPU register model.

Only explicit SVD import and legacy source regeneration require a recursive clone. Import is an onboarding tool, not an automatic update of curated models.

If you forgot this, you can use git submodule update --checkout --init to fetch the submodules.

§Metadata connectivity and reset fields

With metadata enabled, Peripheral::direct_signals() selects records from metadata::DIRECT_SIGNALS for that peripheral on the selected chip. DirectSignalKind::Analog and DirectSignalKind::DirectInput describe non-PORT-mux connectivity, not pin initialization recipes. These routes have no digital ALT number; existing Peripheral.signals and SignalPin.alt remain digital mux routes. Pins may include dedicated analog/PHY pads as well as GPIO pads; every route references a declared pin. Connectivity does not imply all-package bonding. JSON represents the routes as optional direct_signals entries with name and pins: [{"pin": "P1_8", "kind": "analog"}] (or "direct_input").

Gate.bit remains the clock-enable field and Gate.reset names the reset register. When reset is present, use Gate::reset_bit() for its reset field. It resolves explicit JSON gate.reset_bit overrides through metadata::RESET_GATES using (enable, bit, reset), or falls back to Gate.bit. An omitted JSON bit still defaults to the lowercased peripheral name. Empty or orphan reset overrides and conflicting shared-key reset fields are rejected. These lookups perform no hardware access. Existing public struct layouts and legacy initializers are unchanged; legacy devices have empty extension tables and retain the fallback. MetaPAC metadata builds emit the tables in a separate metadata_ext.rs artifact.

Peripheral::named_gates() selects NamedGate records from metadata::NAMED_GATES. Each record has a peripheral owner, a unique control name for that peripheral, and a Gate using the same reset-field lookup and fallback rules as the existing primary gate. JSON uses optional named_gates: [{"name": "processor", "gate": {"enable": "ahbclkctrl3", "bit": "coolflux", "reset": "presetctrl3", "reset_bit": "coolflux_rst"}}]; for example, BSP32 has separate processor and apb controls. These records are information, not an initialization sequence or ordering requirement. They do not infer or replace Peripheral.gate. Reset-key consistency is checked across primary and named controls together. Legacy and current MCXA metadata have no named controls.

The documented pin labels NVM_TM0 through NVM_TM3 have no established owning public peripheral association or purpose in the supplied sources. They are not assigned invented FMU/test ownership; this is a qualified connectivity coverage limit, separate from the represented analog/ADC routes.

Do not consume an inspection output directory from a failed generator invocation.

§License

The contents of this crate are auto-generated and licensed under the same terms as the underlying SVD file, which is licensed by NXP under a BSD-3-Clause license.

Modules§

adc
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
ahbsc
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
cache64_ctrl
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
cache64_polsel
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
can
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
cdog
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
cmc
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
cmp
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
cmx_perfmon
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
common
crc
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
ctimer
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
dac
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
dbgmailbox
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
dma
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
edma_tcd
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
eim
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
els
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
emvsim
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
enet
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
erm
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
evtg
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
ewm
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
flexio
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
flexpwm
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
flexspi
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
fmc
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
fmu
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
freqme
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
gdet
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
gpio
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
i3c
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
inputmux
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
intm
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
itrc
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
lp_flexcomm
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
lpi2c
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
lpspi
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
lptmr
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
lpuart
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
mbc
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
mrt
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
opamp
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
ostimer
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
otpc
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
pint
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
pkc
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
plu
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
port
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
puf
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
puf_key_context
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
qdc
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
rtc
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
rtc_subsystem
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
scg
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
sct
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
sinc
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
smartdma
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
spc
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
syscon
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
tdet
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
usbdcd
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
usbhs
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
usbnc
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
usbphy
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
utick
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
vbat
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
vref
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
wuu
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))
wwdt
Peripheral access API (generated using chiptool v0.1.0 (d54bc66 2026-11-16))

Enums§

Interrupt
interrupt

Constants§

ADC0
ADC1
AHBSC
AHBSC_ALIAS1
AHBSC_ALIAS2
AHBSC_ALIAS3
CACHE64_CTRL0
CACHE64_POLSEL0
CAN0
CAN1
CDOG0
CDOG1
CMC0
CMP0
CMP1
CMX_PERFMON0
CMX_PERFMON1
CRC0
CTIMER0
CTIMER1
CTIMER2
CTIMER3
CTIMER4
DAC0
DAC1
DAC2
DBGMAILBOX
DMA0
DMA1
EIM0
ELS
ELS_ALIAS1
ELS_ALIAS2
ELS_ALIAS3
EMVSIM0
EMVSIM1
ENET0
ERM0
EVTG0
EWM0
FLEXIO0
FLEXSPI0
FMC0
FMU0
FREQME0
GDET0
GDET1
GPIO0
GPIO0_ALIAS1
GPIO1
GPIO2
GPIO3
GPIO4
GPIO5
GPIO1_ALIAS1
GPIO2_ALIAS1
GPIO3_ALIAS1
GPIO4_ALIAS1
GPIO5_ALIAS1
I3C0
I3C1
INPUTMUX0
INTM0
ITRC0
LPI2C0
LPI2C1
LPI2C2
LPI2C3
LPI2C4
LPI2C5
LPI2C6
LPI2C7
LPSPI0
LPSPI1
LPSPI2
LPSPI3
LPSPI4
LPSPI5
LPSPI6
LPSPI7
LPTMR0
LPTMR1
LPUART0
LPUART1
LPUART2
LPUART3
LPUART4
LPUART5
LPUART6
LPUART7
LP_FLEXCOMM0
LP_FLEXCOMM1
LP_FLEXCOMM2
LP_FLEXCOMM3
LP_FLEXCOMM4
LP_FLEXCOMM5
LP_FLEXCOMM6
LP_FLEXCOMM7
MBC0
MRT0
NVIC_PRIO_BITS
Number available in the NVIC for configuring priority
OPAMP0
OPAMP1
OPAMP2
OSTIMER0
OTPC0
PINT0
PKC0
PLU0
PORT0
PORT1
PORT2
PORT3
PORT4
PORT5
PUF
PUF_ALIAS1
PUF_ALIAS2
PUF_ALIAS3
PUF_CTRL
PUF_CTRL_ALIAS1
PUF_CTRL_ALIAS2
PUF_CTRL_ALIAS3
PWM0
PWM1
QDC0
QDC1
RTC0
RTC_SUBSYSTEM0
SCG0
SCT0
SINC0
SMARTDMA0
SPC0
SYSCON0
TCD0
TCD1
TDET0
USB1
USB1_HS_PHY
USB1_NC
USBHS1_PHY_DCD
UTICK0
VBAT0
VREF0
WUU0
WWDT0
WWDT1

Attribute Macros§

interrupt