assert failed: adc_oneshot_ll_set_output_bits

ligteltelecom
Posts: 11
Joined: Wed Oct 25, 2023 10:37 pm

assert failed: adc_oneshot_ll_set_output_bits

Postby ligteltelecom » Wed Oct 25, 2023 10:40 pm

Hello
I am trying use ADC oneshot, but i got this issue below:
How can I solve this problem?


ELF file SHA256: ed41beccee7c5719

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:7092
load:0x40078000,len:15584
ho 0 tail 12 room 4
load:0x40080400,len:4
0x40080400: _init at ??:?

load:0x40080404,len:3876
entry 0x4008064c
I (31) boot: ESP-IDF HEAD-HASH-NOTFOUND 2nd stage bootloader
I (31) boot: compile time Oct 24 2023 13:19:18
I (32) boot: Multicore bootloader
I (36) boot: chip revision: v1.0
I (40) boot.esp32: SPI Speed : 40MHz
I (45) boot.esp32: SPI Mode : DIO
I (49) boot.esp32: SPI Flash Size : 2MB
I (54) boot: Enabling RNG early entropy source...
I (59) boot: Partition Table:
I (63) boot: ## Label Usage Type ST Offset Length
I (70) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (77) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (85) boot: 2 factory factory app 00 00 00010000 00100000
I (92) boot: End of partition table
I (97) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=09e68h ( 40552) map
I (120) esp_image: segment 1: paddr=00019e90 vaddr=3ff80000 size=00004h ( 4) load
I (120) esp_image: segment 2: paddr=00019e9c vaddr=3ffb0000 size=02168h ( 8552) load
I (129) esp_image: segment 3: paddr=0001c00c vaddr=40080000 size=0400ch ( 16396) load
I (141) esp_image: segment 4: paddr=00020020 vaddr=400d0020 size=15628h ( 87592) map
I (174) esp_image: segment 5: paddr=00035650 vaddr=4008400c size=07fd8h ( 32728) load
I (194) boot: Loaded app from partition at offset 0x10000
I (194) boot: Disabling RNG early entropy source...
I (206) cpu_start: Multicore app
I (206) cpu_start: Pro cpu up.
I (206) cpu_start: Starting app cpu, entry point is 0x400810e8
0x400810e8: call_start_cpu1 at C:/Users/Admin/esp/esp-idf/components/esp_system/port/cpu_start.c:154

I (194) cpu_start: App cpu up.
I (224) cpu_start: Pro cpu start user code
I (224) cpu_start: cpu freq: 160000000 Hz
I (224) cpu_start: Application information:
I (229) cpu_start: Project name: TestDock
I (234) cpu_start: App version: 1
I (238) cpu_start: Compile time: Oct 24 2023 13:19:02
I (245) cpu_start: ELF file SHA256: ed41beccee7c5719...
I (251) cpu_start: ESP-IDF: HEAD-HASH-NOTFOUND
I (256) cpu_start: Min chip rev: v0.0
I (261) cpu_start: Max chip rev: v3.99
I (266) cpu_start: Chip rev: v1.0
I (271) heap_init: Initializing. RAM available for dynamic allocation:
I (278) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (284) heap_init: At 3FFB2A50 len 0002D5B0 (181 KiB): DRAM
I (290) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (297) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (303) heap_init: At 4008BFE4 len 0001401C (80 KiB): IRAM
I (311) spi_flash: detected chip: generic
I (314) spi_flash: flash io: dio
W (318) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (331) app_start: Starting scheduler on CPU0
I (336) app_start: Starting scheduler on CPU1
I (336) main_task: Started on CPU0
I (346) main_task: Calling app_main()
Start....

assert failed: adc_oneshot_ll_set_output_bits /IDF/components/hal/esp32/include/hal/adc_ll.h:374 (false)


Backtrace: 0x4008171a:0x3ffb4b10 0x40085775:0x3ffb4b30 0x4008ac69:0x3ffb4b50 0x400d8e9a:0x3ffb4c70 0x400d8fe3:0x3ffb4c90 0x400d8a6e:0x3ffb4cb0 0x400d563e:0x3ffb4ce0 0x400d5701:0x3ffb4d30 0x400e4e98:0x3ffb4d50 0x40087c15:0x3ffb4d80
0x4008171a: panic_abort at C:/Users/Admin/esp/esp-idf/components/esp_system/panic.c:452

0x40085775: esp_system_abort at C:/Users/Admin/esp/esp-idf/components/esp_system/port/esp_system_chip.c:84

0x4008ac69: __assert_func at C:/Users/Admin/esp/esp-idf/components/newlib/assert.c:81

0x400d8e9a: adc_oneshot_ll_set_output_bits at C:/Users/Admin/esp/esp-idf/components/hal/esp32/include/hal/adc_ll.h:374

0x400d8fe3: adc_oneshot_hal_setup at C:/Users/Admin/esp/esp-idf/components/hal/adc_oneshot_hal.c:72

0x400d8a6e: adc_oneshot_read at C:/Users/Admin/esp/esp-idf/components/esp_adc/adc_oneshot.c:177

0x400d563e: adcConfig at C:/Users/Admin/TestDock/main/main.c:102 (discriminator 2)

0x400d5701: app_main at C:/Users/Admin/TestDock/main/main.c:51

0x400e4e98: main_task at C:/Users/Admin/esp/esp-idf/components/freertos/app_startup.c:208 (discriminator 13)

0x40087c15: vPortTaskWrapper at C:/Users/Admin/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162

my code below
void adcConfig()
{
adc_oneshot_unit_handle_t adc1_handle;
adc_oneshot_unit_init_cfg_t init_config1 = {
.unit_id = ADC_UNIT_1,
};

ESP_ERROR_CHECK(adc_oneshot_new_unit(&init_config1, &adc1_handle));

ESP_ERROR_CHECK(adc_oneshot_del_unit(adc1_handle));

adc_oneshot_chan_cfg_t config = {
.bitwidth = ADC_BITWIDTH_DEFAULT,
.atten = EXAMPLE_ADC_ATTEN,
};
ESP_ERROR_CHECK(adc_oneshot_config_channel(adc1_handle, EXAMPLE_ADC1_CHAN0, &config));
ESP_ERROR_CHECK(adc_oneshot_config_channel(adc1_handle, EXAMPLE_ADC1_CHAN1, &config));

ESP_ERROR_CHECK(adc_oneshot_read(adc1_handle, EXAMPLE_ADC1_CHAN0, &adc_raw[0][0]));
ESP_LOGI(TAG, "ADC%d Channel[%d] Raw Data: %d", ADC_UNIT_1 + 1, EXAMPLE_ADC1_CHAN0, adc_raw[0][0]);
ESP_ERROR_CHECK(adc_oneshot_read(adc1_handle, EXAMPLE_ADC1_CHAN1, &adc_raw[0][1]));
ESP_LOGI(TAG, "ADC%d Channel[%d] Raw Data: %d", ADC_UNIT_1 + 1, EXAMPLE_ADC1_CHAN1, adc_raw[0][1]);
}

ESP_Sprite
Posts: 9575
Joined: Thu Nov 26, 2015 4:08 am

Re: assert failed: adc_oneshot_ll_set_output_bits

Postby ESP_Sprite » Thu Oct 26, 2023 5:53 am

You're creating a handle, then immediately deleting it.

ligteltelecom
Posts: 11
Joined: Wed Oct 25, 2023 10:37 pm

Re: assert failed: adc_oneshot_ll_set_output_bits

Postby ligteltelecom » Thu Oct 26, 2023 11:00 am

ESP_Sprite wrote:
Thu Oct 26, 2023 5:53 am
You're creating a handle, then immediately deleting it.
Thank you! My problem was solved!

Who is online

Users browsing this forum: No registered users and 113 guests