adc_nrfx_saadc: Channel 0 not configured, adc_read() failed with error code -22

I use nRF52832 SAADC to measure battery voltage. But I encounter <err> adc_nrfx_saadc: Channel 0 not configured, adc_read() failed, ret=-22. Do you have suggestion to configure channel 0? What is meaning of error code -22?

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
00> *** Booting Zephyr OS build v3.3.99-ncs1 ***
00> btInit() e
00> _btReady(0) e
00> Bluetooth initialized
00> _btReady(0) x
00> btInit() x
00> [00:00:00.006,011] <dbg> fs_nvs: nvs_recover_last_ate: Recovering last ate from sector 0
00> [00:00:00.012,542] <inf> fs_nvs: 3 Sectors of 4096 bytes
00> [00:00:00.012,573] <inf> fs_nvs: alloc wra: 0, fe8
00> [00:00:00.012,573] <inf> fs_nvs: data wra: 0, 0
00> [00:00:00.012,603] <err> adc_nrfx_saadc: Selected ADC gain is not valid
00> [00:00:00.012,603] <err> battery: adc_channel_setup() failed, errCode=-22
00> configure POWER_UP pin as output
00> configure LED_G pin as output
00> set POWER_UP pin
00> device_is_ready() ok
00> nrfx_gpiote_input_configure() okay for button
00> val=0
00> button pressed
00> start a timer
00> 12
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Procedures to reproduce this issue are as follows.

1. Unzipping custom_nrf52832.zip to C:\ncs\v2.4.0\nrf\boards\arm folder.

2. Unzipping minimal_log_battery.zip to C:\ncs\v2.4.0\nrf\samples folder.

3. cd C:\ncs\v2.4.0\nrf\samples\minimal_log_battery

4. west build -b custom_nrf52832

5. west flash

6. Rebooting nRF52832 device and connecting to nRF Connect Windows APP.