This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Runtime error in nrf9160dk ADC program "device_get_binding ADC_0 failed"

While debugging this code https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/samples/nrf9160/adc/src/main.c using nrf9160dk getting error "device_get_binding ADC_0 failed"

Compiling successfully.

Can anyone please suggest a solution?

Parents Reply Children
  •  overlay file
    
    &led0 {
        gpios = <&gpio0 12 GPIO_INT_ACTIVE_LOW>;
        status = "enabled";
    };
    
    &adc {
    	status = "ok";
    };
    
    ********************************************************
    conf file
    
    CONFIG_BSD_LIBRARY=y
    CONFIG_GPIO=y
    CONFIG_SERIAL=y
    CONFIG_STDOUT_CONSOLE=y
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_TEST_RANDOM_GENERATOR=y
    CONFIG_NETWORKING=y
    CONFIG_NET_BUF_USER_DATA_SIZE=1
    CONFIG_NET_SOCKETS_OFFLOAD=y
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_SOCKETS_POSIX_NAMES=y
    CONFIG_NET_RAW_MODE=y
    CONFIG_TRUSTED_EXECUTION_NONSECURE=y
    CONFIG_LOG=n
    CONFIG_LOG_DEFAULT_LEVEL=4
    CONFIG_HEAP_MEM_POOL_SIZE=1024
    # LTE link control
    CONFIG_LTE_LINK_CONTROL=n
    CONFIG_ADC=y
    CONFIG_ADC_0=y
    CONFIG_ADC_NRFX_SAADC=y
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_COMPILER_OPT="-DNRFX_SAADC_ENABLED=1"

  • I see you're using the macro GPIO_INT_ACTIVE_LOW in the overlay file, which is deprecated and should give you an error while building so I suspect the overlay file isn't being included in the build for some reason.

    Have you checked that the ADC node is enabled in the resulting DeviceTree? You can see this in the file build/zephyr/zephyr.dts.

  • HI,

    The issue is solved by selecting ADC driver from the below location

    Project > config nRF SDK project > menuconfig - then search ADC then check "ADC driver" checkbox

Related