Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: adc: nrfx_saadc: Add channel configuration validation for nrf54h20 #87405

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

nordic-krch
Copy link
Contributor

nrf54h20 has AIN8-AIN14 sources which require special handling:

When differential mode is used then AIN0-7 cannot be mixed with AIN8-13.

PR adds channel validation macro which checks at compile time if differential channel configuration is correct.

Result must be multiplied by 3.6 to get the actual value

There is no good way of adding 3.6 multiplier in the driver so only sample is modified. Channel that is using AIN8-AIN14 sources shell use vref-mv property set to referece_mv * 3.6.

On nrf54h20 there are additional analog pins (AIN8+). When differential
mode is used they must not be mixed with AIN0-AIN7. Add build time
validation which detects if configuration is invalid.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Sample is reading vref-mv property to get reference voltage and then if
reference source is set to ADC_REF_INTERNAL this value is overwritten.
If vref-mv property is provided then it should not be overwritten.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
@nordic-krch nordic-krch requested a review from anangl March 20, 2025 12:57
@zephyrbot zephyrbot added area: Samples Samples platform: nRF Nordic nRFx area: ADC Analog-to-Digital Converter (ADC) labels Mar 20, 2025
AIN9 source needs special handling (all from AIN8-AIN14). Conversion
result needs to be scaled up by 3.6 additionally to gain and reference
voltage. In order to achieve correct value in the sample vref-mv is
used as reference voltage instead of predefined internal reference
source.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ADC Analog-to-Digital Converter (ADC) area: Samples Samples platform: nRF Nordic nRFx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants