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.12k stars 6.21k forks source link

zephyr - ADC - ATSAMD21G18A #36716

Closed ieeeHuseyin closed 2 years ago

ieeeHuseyin commented 3 years ago

I want to create an ADC sample for the ATSAMD21G18A processor (for pins PA02-PA03-PA04) But I don't understand which sample should I use. Can you help me?

github-actions[bot] commented 2 years 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.

krucialdavidw commented 1 year ago

For any weary traveller, I had to port from zephyr 2.7 -> 3.3.99 for the adafruit m0 LoRa feather and got a quick fix by defining the status and pinctrl for the adc in the overlay. This was to measure PA07 - AIN7 - Feather pin 9 and PB02 - AIN10 - Feather pin A5

overlay:

&pinctrl {
    adc0_adc: adc0_adc {
        group1 {
            pinmux = <PA7B_ADC_AIN7>, <PB2B_ADC_AIN10>; 
        };
    };
};

&adc {
    status = "okay";
    pinctrl-0 = <&adc0_adc>;
    pinctrl-names = "default";
};

HTH!