jihonen opened a new pull request, #18870:
URL: https://github.com/apache/nuttx/pull/18870
• Add support for the i.MX9 SAR ADC block.
The driver provides initialization, deinitialization, channel-mask
validation, and one-shot reads for the supported ADC channels. It also handles
ADC clock bring-up, power-up, calibration, and raw 12-bit result extraction
from the per-channel data registers.
## Summary
Add a basic helper driver for the i.MX9 SAR ADC block in
`arch/arm64/src/imx9`.
This change is needed to support board-level analog sampling on i.MX9
systems without duplicating ADC register sequencing in each board bring-up
file. The driver encapsulates the hardware initialization sequence, validates
the enabled channel mask, and exposes a simple one-shot read path for the
supported channels.
The driver:
- enables and disables the ADC clock tree through the i.MX9 CCM helpers
- powers up the ADC block
- runs the calibration sequence during initialization
- clears stale status before the first conversion
- starts one-shot conversions on a requested channel
- reads the raw 12-bit result from the per-channel data register
- reports initialization state for board code
## Impact
This change adds new runtime support in `arch/arm64/src/imx9` only.
Impact areas:
- Build: `imx9_sar_adc.c` is compiled when `CONFIG_IMX9_SAR_ADC` is enabled
- Runtime: adds ADC initialization, de-initialization, and read support
for the i.MX9 SAR ADC block
- API: adds the internal helper interface in `imx9_sar_adc.h` for
board/arch bring-up code
- Compatibility: no existing user-space API is changed
- Documentation: no documentation updates were included in this change
- Security: no security-sensitive behavior is introduced
## Testing
Testing performed:
- Built and ran on NXP93 hardware
- Verified ADC reporting with `listener adc_report`
Observed output:
```text
TOPIC: adc_report
adc_report
timestamp: 11804674 (0.001465 seconds ago)
device_id: 9371904 (Type: 0x8F, UNKNOWN:0 (0x01))
raw_data: [2024, 2032, 1355, 6, 0, 0, 0, 0, 0, 0, 0, 0]
resolution: 4096
v_ref: 1.80000
channel_id: [0, 1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1]
References:
- nuttx: arch/arm64/src/imx9/imx9_sar_adc.c
- nuttx: arch/arm64/src/imx9/imx9_sar_adc.h
Dependencies:
- none
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]