zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.06k stars 6.18k forks source link

Atmel SAM0 ADC driver implementation error #72320

Open PeeJay opened 2 months ago

PeeJay commented 2 months ago

While using the adc_dt sample with an Atmel SamE51 board with multiple adc inputs, I noticed that all channels were reading from the same mux input on the ADC. Inspecting adc_sam0.c reveals that the mux position is set inside of adc_channel_setup_dt, so naturally the last chanel to get setup is the one actually read, regardless of what is passed to adc_read_dt(). Having a quick look at adc_nrfx_adc.c it appears that the channels are selected inside of start_read(). If I run adc_channel_setup_dt() before adc_sequence_init_dt() then it works as expected, however that doesn't seem to be the intended behaviour.

henrikbrixandersen commented 2 months ago

Please use our bug template when reporting bugs. You need to edit this issue to include the information requested in https://github.com/zephyrproject-rtos/zephyr/blob/main/.github/ISSUE_TEMPLATE/001_bug_report.md

github-actions[bot] commented 1 day ago

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.