-
Notifications
You must be signed in to change notification settings - Fork 928
Open
Description
Answers checklist.
- I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- I have searched the issue tracker for a similar issue and not found a similar issue.
IDF version.
v5.5-dev-2182-ga6c3a9cbbb
Espressif SoC revision.
ESP32-S3
Operating System used.
macOS
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
None
Development Kit.
custom board
Power Supply used.
External 5V
What is the expected behavior?
我使用示例代码,只是修改了简单的IO口配置, 编译运行后, 电机启动通过日志看到报了watchdog timeout,我希望无感直流无刷电机能通过adc采样正常运行起来
What is the actual behavior?
通过日志看到报了watchdog timeout,然后系统重启
Steps to reproduce.
只需要运行官方的示例代码即可, 注意需要用ADC采样方式,alignment_mode = ALIGNMENT_ADC; 另外一种比较器的过零采样方式我已经测试了不会出现我说的问题, 另外和板子也无关,我使用买来的开发板,不外接任何东西,也会有同样的错误,经过跟踪,貌似是卡在了adc_oneshot_hal.c 148行(while (!adc_oneshot_ll_get_event(event)) 这里)
Debug Logs.
ELF file SHA256: 6bec0494f
Rebooting...
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40376a7c
#0 0x40376a7c in esp_restart_noos at /Users/wangda/.platformio/packages/framework-espidf/components/esp_system/port/soc/esp32s3/system_internal.c:160
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce2810,len:0x21e8
load:0x403c8700,len:0x4
load:0x403c8704,len:0xeb8
load:0x403cb700,len:0x348c
entry 0x403c8968
I (26) boot: ESP-IDF 5.4.0 2nd stage bootloader
I (26) boot: compile time Mar 6 2025 15:32:43
I (26) boot: Multicore bootloader
D (27) bootloader_flash: non-XMC chip detected by SFDP Read (00), skip.
D (32) bootloader_flash: mmu set block paddr=0x00000000 (was 0xffffffff)
I (39) boot: chip revision: v0.2
I (42) boot: efuse block revision: v1.3
D (45) boot.esp32s3: magic e9
D (48) boot.esp32s3: segments 04
D (51) boot.esp32s3: spi_mode 02
D (54) boot.esp32s3: spi_speed 0f
D (57) boot.esp32s3: spi_size 02
I (60) boot.esp32s3: Boot SPI Speed : 80MHz
I (64) boot.esp32s3: SPI Mode : DIO
I (68) boot.esp32s3: SPI Flash Size : 4MB
D (71) boot: Enabling RTCWDT(9000 ms)
I (75) boot: Enabling RNG early entropy source...
D (79) bootloader_flash: rodata starts from paddr=0x00008000, size=0xc00, will be mapped to vaddr=0x3c000000
V (89) bootloader_flash: after mapping, starting from paddr=0x00000000 and vaddr=0x3c000000, 0x10000 bytes are mapped
D (99) boot: mapped partition table 0x8000 at 0x3c008000
D (104) flash_parts: partition table verified, 6 entries
I (109) boot: Partition Table:
I (112) boot: ## Label Usage Type ST Offset Length
D (118) boot: load partition table entry 0x3c008000
D (123) boot: type=1 subtype=2
I (126) boot: 0 nvs WiFi data 01 02 00009000 00005000
D (132) boot: load partition table entry 0x3c008020
D (137) boot: type=1 subtype=0
I (140) boot: 1 otadata OTA data 01 00 0000e000 00002000
D (146) boot: load partition table entry 0x3c008040
D (151) boot: type=0 subtype=10
I (154) boot: 2 ota_0 OTA app 00 10 00010000 003da000
D (160) boot: load partition table entry 0x3c008060
D (165) boot: type=1 subtype=2
I (168) boot: 3 fctry WiFi data 01 02 003ea000 00006000
D (174) boot: load partition table entry 0x3c008080
D (179) boot: type=1 subtype=3
I (182) boot: 4 coredump Unknown data 01 03 003f0000 00010000
I (188) boot: End of partition table
D (192) boot: OTA data offset 0xe000
D (195) bootloader_flash: rodata starts from paddr=0x0000e000, size=0x2000, will be mapped to vaddr=0x3c000000
V (205) bootloader_flash: after mapping, starting from paddr=0x00000000 and vaddr=0x3c000000, 0x10000 bytes are mapped
D (215) boot: otadata[0]: sequence values 0x00000001
D (220) boot: otadata[1]: sequence values 0xffffffff
D (224) boot_comm: Only otadata[0] is valid
D (228) boot: Active otadata[0]
D (231) boot: Mapping seq 0 -> OTA slot 0
D (235) boot: Trying partition index 0 offs 0x10000 size 0x3da000
D (241) esp_image: reading image header @ 0x10000
D (245) bootloader_flash: mmu set block paddr=0x00010000 (was 0xffffffff)
D (252) esp_image: image header: 0xe9 0x06 0x02 0x02 403760fc
V (257) esp_image: loading segment header 0 at offset 0x10018
V (263) esp_image: segment data length 0x1009c data starts 0x10020
V (268) esp_image: MMU page size 0x10000
V (272) esp_image: segment 0 map_segment 1 segment_data_offs 0x10020 load_addr 0x3c030020
#0 0x3c030020 in ?? at /Users/wangda/.platformio/packages/framework-espidf/components/esp_app_format/esp_app_desc.c:26
I (280) esp_image: segment 0: paddr=00010020 vaddr=3c030020 size=1009ch ( 65692) map
D (287) esp_image: free data page_count 0x00000200
D (292) bootloader_flash: rodata starts from paddr=0x00010020, size=0x1009c, will be mapped to vaddr=0x3c000000
V (302) bootloader_flash: after mapping, starting from paddr=0x00010000 and vaddr=0x3c000000, 0x20000 bytes are mapped
V (324) esp_image: loading segment header 1 at offset 0x200bc
D (324) bootloader_flash: mmu set block paddr=0x00020000 (was 0xffffffff)
V (325) esp_image: segment data length 0x2d40 data starts 0x200c4
V (330) esp_image: MMU page size 0x10000
V (334) esp_image: segment 1 map_segment 0 segment_data_offs 0x200c4 load_addr 0x3fc93400
#0 0x3fc93400 in ?? at managed_components/espressif__button/iot_button.c:22
I (342) esp_image: segment 1: paddr=000200c4 vaddr=3fc93400 size=02d40h ( 11584) load
D (350) esp_image: free data page_count 0x00000200
D (354) bootloader_flash: rodata starts from paddr=0x000200c4, size=0x2d40, will be mapped to vaddr=0x3c000000
V (364) bootloader_flash: after mapping, starting from paddr=0x00020000 and vaddr=0x3c000000, 0x10000 bytes are mapped
V (377) esp_image: loading segment header 2 at offset 0x22e04
D (380) bootloader_flash: mmu set block paddr=0x00020000 (was 0xffffffff)
V (386) esp_image: segment data length 0xd20c data starts 0x22e0c
V (392) esp_image: MMU page size 0x10000
V (396) esp_image: segment 2 map_segment 0 segment_data_offs 0x22e0c load_addr 0x40374000
#0 0x40374000 in _WindowOverflow4 at /Users/wangda/.platformio/packages/framework-espidf/components/xtensa/xtensa_vectors.S:2027
I (404) esp_image: segment 2: paddr=00022e0c vaddr=40374000 size=0d20ch ( 53772) load
D (411) esp_image: free data page_count 0x00000200
D (416) bootloader_flash: rodata starts from paddr=0x00022e0c, size=0xd20c, will be mapped to vaddr=0x3c000000
V (425) bootloader_flash: after mapping, starting from paddr=0x00020000 and vaddr=0x3c000000, 0x20000 bytes are mapped
V (448) esp_image: loading segment header 3 at offset 0x30018
D (448) bootloader_flash: mmu set block paddr=0x00030000 (was 0xffffffff)
V (448) esp_image: segment data length 0x2b1cc data starts 0x30020
V (454) esp_image: MMU page size 0x10000
V (458) esp_image: segment 3 map_segment 1 segment_data_offs 0x30020 load_addr 0x42000020
#0 0x42000020 in _stext at ??:?
I (466) esp_image: segment 3: paddr=00030020 vaddr=42000020 size=2b1cch (176588) map
D (473) esp_image: free data page_count 0x00000200
D (478) bootloader_flash: rodata starts from paddr=0x00030020, size=0x2b1cc, will be mapped to vaddr=0x3c000000
V (488) bootloader_flash: after mapping, starting from paddr=0x00030000 and vaddr=0x3c000000, 0x30000 bytes are mapped
V (529) esp_image: loading segment header 4 at offset 0x5b1ec
D (529) bootloader_flash: mmu set block paddr=0x00050000 (was 0xffffffff)
V (530) esp_image: segment data length 0x2124 data starts 0x5b1f4
V (536) esp_image: MMU page size 0x10000
V (539) esp_image: segment 4 map_segment 0 segment_data_offs 0x5b1f4 load_addr 0x4038120c
#0 0x4038120c in abort at /Users/wangda/.platformio/packages/framework-espidf/components/newlib/abort.c:27
I (547) esp_image: segment 4: paddr=0005b1f4 vaddr=4038120c size=02124h ( 8484) load
D (555) esp_image: free data page_count 0x00000200
D (559) bootloader_flash: rodata starts from paddr=0x0005b1f4, size=0x2124, will be mapped to vaddr=0x3c000000
V (569) bootloader_flash: after mapping, starting from paddr=0x00050000 and vaddr=0x3c000000, 0x10000 bytes are mapped
V (581) esp_image: loading segment header 5 at offset 0x5d318
D (585) bootloader_flash: mmu set block paddr=0x00050000 (was 0xffffffff)
V (591) esp_image: segment data length 0x1c data starts 0x5d320
V (597) esp_image: MMU page size 0x10000
V (601) esp_image: segment 5 map_segment 0 segment_data_offs 0x5d320 load_addr 0x600fe100
#0 0x600fe100 in ?? at /Users/wangda/.platformio/packages/framework-espidf/components/esp_hw_support/sleep_modes.c:288
I (609) esp_image: segment 5: paddr=0005d320 vaddr=600fe100 size=0001ch ( 28) load
D (616) esp_image: free data page_count 0x00000200
D (621) bootloader_flash: rodata starts from paddr=0x0005d320, size=0x1c, will be mapped to vaddr=0x3c000000
V (630) bootloader_flash: after mapping, starting from paddr=0x00050000 and vaddr=0x3c000000, 0x10000 bytes are mapped
V (641) esp_image: image start 0x00010000 end of last section 0x0005d33c
D (647) bootloader_flash: mmu set block paddr=0x00050000 (was 0xffffffff)
D (654) boot: Calculated hash: 8ca60a7279fc8979d7379f337a837e83189d7fd9159e4640eca5e93174f09917
I (668) boot: Loaded app from partition at offset 0x10000
I (668) boot: Disabling RNG early entropy source...
D (672) boot: Mapping segment 0 as DROM
D (675) boot: Mapping segment 3 as IROM
D (679) boot: calling set_cache_and_start_app
D (683) boot: configure drom and irom and start
V (687) boot: rodata starts from paddr=0x00010020, vaddr=0x3c030020, size=0x1009c
V (694) boot: after mapping rodata, starting from paddr=0x00010000 and vaddr=0x3c030000, 0x20000 bytes are mapped
V (704) boot: mapped one page of the rodata, from paddr=0x00010000 and vaddr=0x3dff0000, 0x10000 bytes are mapped
V (714) boot: text starts from paddr=0x00030020, vaddr=0x42000020, size=0x2b1cc
V (721) boot: after mapping text, starting from paddr=0x00030000 and vaddr=0x42000000, 0x30000 bytes are mapped
D (731) boot: start: 0x403760fc
#0 0x403760fc in call_start_cpu0 at /Users/wangda/.platformio/packages/framework-espidf/components/esp_system/port/cpu_start.c:384
I (746) cpu_start: Multicore app
I (755) cpu_start: Pro cpu start user code
I (755) cpu_start: cpu freq: 160000000 Hz
I (755) app_init: Application information:
I (755) app_init: Project name: esp-bldc-fan
I (759) app_init: App version: 1
I (763) app_init: Compile time: Mar 6 2025 16:45:26
I (768) app_init: ELF file SHA256: 6bec0494f...
I (772) app_init: ESP-IDF: 5.4.0
I (776) efuse_init: Min chip rev: v0.0
I (780) efuse_init: Max chip rev: v0.99
I (784) efuse_init: Chip rev: v0.2
I (787) heap_init: Initializing. RAM available for dynamic allocation:
I (794) heap_init: At 3FC96DF8 len 00052918 (330 KiB): RAM
I (799) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM
I (804) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (809) heap_init: At 600FE11C len 00001ECC (7 KiB): RTCRAM
I (816) spi_flash: detected chip: generic
I (818) spi_flash: flash io: dio
I (822) sleep_gpio: Configure to isolate all GPIO pins in sleep state
I (828) sleep_gpio: Enable automatic switching of GPIO sleep configuration
I (834) coexist: coex firmware version: 49a8cdc
I (838) coexist: coexist rom version e7ae62f
I (843) main_task: Started on CPU0
I (853) main_task: Calling app_main()
I (853) gpio: GPIO[10]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1853) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (1853) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (1853) gpio: GPIO[11]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (1863) hal_bldc: wangda test
I (1863) hal_bldc: BLDC_CONTROL_START
Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0).
Core 0 register dump:
PC : 0x4201241e PS : 0x00060434 A0 : 0x82012652 A1 : 0x3fc945f0
A2 : 0x80160000 A3 : 0x00020000 A4 : 0x3fc94610 A5 : 0xfffdffff
A6 : 0x60008800 A7 : 0x00000001 A8 : 0x60008800 A9 : 0x3fc945c0
A10 : 0x000001e0 A11 : 0x00000001 A12 : 0x00000000 A13 : 0x00000007
A14 : 0x00000000 A15 : 0x000000b8 SAR : 0x00000020 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x40056f5c LEND : 0x40056f72 LCOUNT : 0x00000000
Core 0 was running in ISR context:
EPC1 : 0x42027d37 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x4201241e
#0 0x4201241e in adc_oneshot_ll_get_event at /Users/wangda/.platformio/packages/framework-espidf/components/hal/esp32s3/include/hal/adc_ll.h:1006
Backtrace: 0x4201241b:0x3fc945f0 0x4201264f:0x3fc94610 0x42006e6e:0x3fc94640 0x40375305:0x3fc94660 0x4200549f:0x3fc94690 0x40375840:0x3fc946b0 0x403758f5:0x3fc946f0 0x403784c5:0x3fc94710 0x42004b72:0x3fc9a8d0 0x42002057:0x3fc9a8f0 0x420025e9:0x3fc9aa60 0x4202aa37:0x3fc9aa80 0x4037b175:0x3fc9aab0
#0 0x4201241b in adc_oneshot_ll_get_event at /Users/wangda/.platformio/packages/framework-espidf/components/hal/esp32s3/include/hal/adc_ll.h:1006
#1 0x3fc945f0 in _xt_exception_table at ??:?
#2 0x4201264f in adc_oneshot_hal_convert at /Users/wangda/.platformio/packages/framework-espidf/components/hal/adc_oneshot_hal.c:148 (discriminator 1)
#3 0x3fc94610 in _xt_exception_table at ??:?
#4 0x42006e6e in adc_oneshot_read_isr at /Users/wangda/.platformio/packages/framework-espidf/components/esp_adc/adc_oneshot.c:227
#5 0x3fc94640 in _xt_exception_table at ??:?
#6 0x40375305 in bldc_adc_read_isr at managed_components/espressif__esp_sensorless_bldc_control/hardware_driver/bldc_adc.c:61
#7 0x3fc94660 in _xt_exception_table at ??:?
#8 0x4200549f in read_adc_on_full at managed_components/espressif__esp_sensorless_bldc_control/control/bldc_zero_cross_adc.c:32
#9 0x3fc94690 in _xt_exception_table at ??:?
#10 0x40375840 in mcpwm_timer_default_isr at /Users/wangda/.platformio/packages/framework-espidf/components/esp_driver_mcpwm/src/mcpwm_timer.c:399
#11 0x3fc946b0 in _xt_exception_table at ??:?
#12 0x403758f5 in shared_intr_isr at /Users/wangda/.platformio/packages/framework-espidf/components/esp_hw_support/intr_alloc.c:445
#13 0x3fc946f0 in _xt_exception_table at ??:?
#14 0x403784c5 in _xt_lowint1 at /Users/wangda/.platformio/packages/framework-espidf/components/xtensa/xtensa_vectors.S:1240
#15 0x3fc94710 in _xt_exception_table at ??:?
#16 0x42004b72 in bldc_control_start at managed_components/espressif__esp_sensorless_bldc_control/bldc_control.c:254
#17 0x42002057 in hal_bldc_init at src/hal/hal_bldc.c:220
#18 0x420025e9 in app_main at src/main.c:24
#19 0x4202aa37 in main_task at /Users/wangda/.platformio/packages/framework-espidf/components/freertos/app_startup.c:208
#20 0x4037b175 in vPortTaskWrapper at /Users/wangda/.platformio/packages/framework-espidf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139
Core 1 register dump:
PC : 0x40378b8a PS : 0x00060c34 A0 : 0x8200f121 A1 : 0x3fc9b910
A2 : 0x00000000 A3 : 0x0000abab A4 : 0x8037b511 A5 : 0x3fc9c630
A6 : 0x00060023 A7 : 0x00000000 A8 : 0x8200f8ee A9 : 0x3fc9b8d0
A10 : 0x00000000 A11 : 0x00000001 A12 : 0x3fc966d0 A13 : 0x00000001
A14 : 0x3fc966d8 A15 : 0x3fc9badc SAR : 0x00000000 EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
Backtrace: 0x40378b87:0x3fc9b910 0x4200f11e:0x3fc9b930 0x4037c12d:0x3fc9b950 0x4037b175:0x3fc9b970
#0 0x40378b87 in xt_utils_wait_for_intr at /Users/wangda/.platformio/packages/framework-espidf/components/xtensa/include/xt_utils.h:82
(inlined by) esp_cpu_wait_for_intr at /Users/wangda/.platformio/packages/framework-espidf/components/esp_hw_support/cpu.c:55
#1 0x4200f11e in esp_vApplicationIdleHook at /Users/wangda/.platformio/packages/framework-espidf/components/esp_system/freertos_hooks.c:58
#2 0x4037c12d in prvIdleTask at /Users/wangda/.platformio/packages/framework-espidf/components/freertos/FreeRTOS-Kernel/tasks.c:4353 (discriminator 1)
#3 0x4037b175 in vPortTaskWrapper at /Users/wangda/.platformio/packages/framework-espidf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139
More Information.
我的初始化配置
esp_err_t hal_bldc_init(dir_enum_t direction)
{
esp_event_loop_create_default();
ESP_ERROR_CHECK(esp_event_handler_register(BLDC_CONTROL_EVENT, ESP_EVENT_ANY_ID, &bldc_control_event_handler, NULL));
switch_config_t_t upper_switch_config = {
.control_type = CONTROL_TYPE_MCPWM,
.bldc_mcpwm = {
.group_id = 0,
.gpio_num = {UPPER_SWITCH_PIN_U, UPPER_SWITCH_PIN_V, UPPER_SWITCH_PIN_W},
},
};
switch_config_t_t lower_switch_config = {
.control_type = CONTROL_TYPE_GPIO,
.bldc_gpio[0] = {
.gpio_num = LOWER_SWITCH_PIN_U,
.gpio_mode = GPIO_MODE_OUTPUT,
},
.bldc_gpio[1] = {
.gpio_num = LOWER_SWITCH_PIN_V,
.gpio_mode = GPIO_MODE_OUTPUT,
},
.bldc_gpio[2] = {
.gpio_num = LOWER_SWITCH_PIN_W,
.gpio_mode = GPIO_MODE_OUTPUT,
},
};
bldc_zero_cross_adc_config_t zero_cross_adc_config = {
.adc_handle = NULL,
.adc_unit = ADC_UNIT_1,
.chan_cfg = {
.bitwidth = ADC_BITWIDTH_12,
.atten = ADC_ATTEN_DB_0,
},
.adc_channel = {ADC_CHANNEL_3, ADC_CHANNEL_4, ADC_CHANNEL_5, ADC_CHANNEL_0, ADC_CHANNEL_1},
};
bldc_control_config_t config = {
.speed_mode = SPEED_CLOSED_LOOP,
.control_mode = BLDC_SIX_STEP,
.alignment_mode = ALIGNMENT_ADC,
.six_step_config = {
.lower_switch_active_level = 1,
.upper_switch_config = upper_switch_config,
.lower_switch_config = lower_switch_config,
.mos_en_config.has_enable = false,
},
.zero_cross_adc_config = zero_cross_adc_config,
};
gpio_config_t io_sleep = {
.intr_type = GPIO_INTR_DISABLE,
.mode = GPIO_MODE_OUTPUT,
.pin_bit_mask = (1ULL << DRV_SLEEP_PIN),
.pull_down_en = 0,
.pull_up_en = 1,
};
gpio_config(&io_sleep);
gpio_set_level(DRV_SLEEP_PIN, 1);
vTaskDelay(1000 / portTICK_PERIOD_MS);
if (bldc_control_init(&bldc_control_handle, &config) != ESP_OK) {
return ESP_FAIL;
}
if (bldc_control_set_dir(bldc_control_handle, direction) != ESP_OK) {
return ESP_FAIL;
}
ESP_LOGI(TAG, "wangda test");
bldc_control_start(bldc_control_handle, 300);
// if (hal_bldc_button_ctrl_init(GPIO_NUM_0) != ESP_OK) {
// return ESP_FAIL;
// }
// const esp_timer_create_args_t periodic_timer_args = {
// .callback = &hal_bldc_timer_cb,
// .name = "periodic"
// };
// esp_timer_handle_t periodic_bldc_timer;
// if (esp_timer_create(&periodic_timer_args, &periodic_bldc_timer) != ESP_OK) {
// return ESP_FAIL;
// }
// if (esp_timer_start_periodic(periodic_bldc_timer, 1000 * 1000) != ESP_OK) {
// return ESP_FAIL;
// }
return ESP_OK;
}
wangda888