Using AIN0/P0.13 as a ADC pin in nRF9160

I want to use P0.13 for ADC reading.
However, I noticed that it is already used as an SCK pin in this configuration:

spi3_default: spi3_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
<NRF_PSEL(SPIM_MISO, 0, 12)>,
<NRF_PSEL(SPIM_MOSI, 0, 11)>;
};
};

So I disabled the SPI:

&arduino_spi {
status = "disabled";
};

Then I remapped GPIO P0.13 to a new ADC channel:

&arduino_header {
gpio-map = <0 0 &gpio0 14 0>,
<1 0 &gpio0 15 0>,
...
<19 0 &gpio0 13 0>,
...
};

And I also updated the ADC mapping:

&arduino_adc {
io-channel-map = <0 &adc 1>, <1 &adc 2>, <2 &adc 3>, <3 &adc 4>, <4 &adc 5>, <5 &adc 6>, <19 &adc 7>;
};

But it seems I still cannot read ADC on pin P0.13.

Here is my voltage divider configuration:

vbatt_divider {
compatible = "voltage-divider";
io-channels = <&adc 7>; // P0.13 (AIN0)
output-ohms = <220000>;
full-ohms = <900000>;
power-gpios = <&gpio0 VOLTAGE_DIV_EN GPIO_ACTIVE_LOW>;
};

Could you please help check if I am missing or misconfiguring anything?

Parents Reply Children
No Data
Related