Pin Assignment Overwrite for adc

I want to read data from 8 channels of ADC, when configuring all channels it shows that some of the pins are pre-occupied by other nodes. i have applied different things to resolve this issue including these  GPIO overlays  Can't override pin assignment in .overlay , but an error occurred, kindly tell me how should i resolve this issue. 

This is my Overlay file:

/ {
    pinctrl: pin-controller{
        /delete-node/ &uart0_default;
        /delete-node/ &uart0_sleep;
    };
    
    zephyr,user {
		io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>, <&adc 4>, <&adc 5>, <&adc 6>,  <&adc 7>;
	};
};

&adc {
	#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>; /* P0.03 */
		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>; /* P0.03 */
		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>; /* P0.03 */
		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>; /* P0.03 */
		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>; /* P0.03 */
		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>; /* P0.03 */
		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>; /* P0.03 */
		zephyr,resolution = <12>;
	};
    channel@7 {
		reg = <7>;
		zephyr,gain = "ADC_GAIN_1_6";
		zephyr,reference = "ADC_REF_INTERNAL";
		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
		zephyr,input-positive = <NRF_SAADC_AIN7>; /* P0.03 */
		zephyr,resolution = <12>;
	};
};

This the error thrown:

Problem window:

Before adding delete node uart0-default and sleep, Pin 5 was also shown in the problem as preoccupied.

Parents
  • Hello,

    There is a sample found in:

    ncs\zephyr\samples\drivers\adc\

    that is set up pretty much like you did here. I can't spot any immediate errors from what you have included here (other than the build log, of course), but does this sample work if you try to build it? Remember to copy the nrf52840dk_nrf52840.overlay file found in adc\boards and name it nrf52dk_nrf52832.overlay.

    If you are still stuck, can you please .zip and upload your application folder here?

    Best regards,

    Edvin

Reply
  • Hello,

    There is a sample found in:

    ncs\zephyr\samples\drivers\adc\

    that is set up pretty much like you did here. I can't spot any immediate errors from what you have included here (other than the build log, of course), but does this sample work if you try to build it? Remember to copy the nrf52840dk_nrf52840.overlay file found in adc\boards and name it nrf52dk_nrf52832.overlay.

    If you are still stuck, can you please .zip and upload your application folder here?

    Best regards,

    Edvin

Children
Related