I need to use ADC in the project, and then I have configured ADC in overlay. The code is as follows
/ {
zephyr,user {
io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>, <&adc 4>, <&adc 5>, <&adc 6>;
};
};
&adc {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN0>; // TS_ADC
zephyr,resolution = <12>;
};
channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN1>; // TS_ADC
zephyr,resolution = <12>;
};
channel@2 {
reg = <2>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN2>; // TS_ADC
zephyr,resolution = <12>;
};
channel@3 {
reg = <3>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN3>; // TS_ADC
zephyr,resolution = <12>;
};
channel@4 {
reg = <4>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN4>; // TS_ADC
zephyr,resolution = <12>;
};
channel@5 {
reg = <5>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN5>; // TS_ADC
zephyr,resolution = <12>;
};
channel@6 {
reg = <6>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN6>; // TS_ADC
zephyr,resolution = <12>;
};
};
The same code can be measured normally in Zephyr's ADC example, but when it comes to other projects, such as using the application_update example for testing, in this example, ADC channels 1, 2, and 3 will measure voltages of 2.4, 3.0, and 0.9v left and right without connecting any ports.
Then I found out that the problem was with C:\ncs\v2.6.1\zephyr\boards\arm\nrf9160dk_nrf9160\nrf9160dk_nrf9160_common.dtsi, I can solve this problem by setting the status of arduino_serial: &uart1 inside to disabled.
But what's abnormal is that in the ADC example, there is no need to make any modifications to nrf9160dk_nrf9160_common.dtsi, why does overlay not work in the example of app update?



