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?
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?
Hi!
Have you modified the name of the overlay file? <nrf9160_pca10090> is the old version of the board name, so if you're building for the current board name (nrf9160dk_nrf9160), the overlay file with its current name won't be included in the build, i.e the ADC note won't be set to "okay" and the device binding fails.
Best regards,
Heidi
HI,
Yes I have already modified the name of overlay file to nrf9160dk_nrf9160ns.
Regards
Shahajas
Okay. Please describe all the modifications you've made to the sample or it will be hard to help you .
Have you for instance changed the board names in the if statement on lines 17 through 20?
I have modified line 19 to CONFIG_BOARD_NRF9160_PCA10090NS.
added #define CONFIG_BOARD_NRF9160_PCA10090NS at 16 line.
Changed the name of overlay file to nrf9160dk_nrf9160ns.
change at line 46 - static s16_t m_sample_buffer[BUFFER_SIZE]; to static uint16_t m_sample_buffer[BUFFER_SIZE];
These are the changes i have done .
it shows a warning (assignment discards 'const' qualifies from pointer target type [-wdiscarded-qualifiers] ) at line 89
I have modified line 19 to CONFIG_BOARD_NRF9160_PCA10090NS.
added #define CONFIG_BOARD_NRF9160_PCA10090NS at 16 line.
Changed the name of overlay file to nrf9160dk_nrf9160ns.
change at line 46 - static s16_t m_sample_buffer[BUFFER_SIZE]; to static uint16_t m_sample_buffer[BUFFER_SIZE];
These are the changes i have done .
it shows a warning (assignment discards 'const' qualifies from pointer target type [-wdiscarded-qualifiers] ) at line 89
Which NCS tag are you building this on? When getting it to run on master, I had to modify quite a bit more than what you describe.
NCS version v1.5.1
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