nodemcu / nodemcu-firmware

Lua based interactive firmware for ESP8266, ESP8285 and ESP32
https://nodemcu.readthedocs.io
MIT License
7.65k stars 3.12k forks source link

ledc module doesn't work (esp32-idf4) #3558

Closed serg3295 closed 1 year ago

serg3295 commented 1 year ago

Actual behavior

When I try to create a channel object using the ledc.newChannel method ESP throws an error

assert failed: ledc_clk_cfg_to_global_clk ledc.c:446 (false)

and then ESP restarts.

When I applied the pull request setting results in automatic clock selection ledc module began to work correctly.

Could you merge this pull request into the esp32-idf4 branch?

Test code

myChannel = ledc.newChannel({
  gpio=5,
  bits=ledc.TIMER_13_BIT,
  mode=ledc.HIGH_SPEED,
  timer=ledc.TIMER_0,
  channel=ledc.CHANNEL_0,
  frequency=1,
  duty=4096
})

NodeMCU startup banner

I (29) boot: ESP-IDF v4.4.2 2nd stage bootloader
I (29) boot: compile time 15:17:31
I (29) boot: chip revision: 1
I (32) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (39) boot.esp32: SPI Speed      : 40MHz
I (43) boot.esp32: SPI Mode       : DIO
I (48) boot.esp32: SPI Flash Size : 4MB
I (52) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (61) boot: ## Label            Usage          Type ST Offset   Length
I (69) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (76) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (84) boot:  2 factory          factory app      00 00 00010000 00180000
I (91) boot:  3 lfs              unknown          c2 01 00190000 00010000
I (99) boot:  4 storage          Unknown data     01 82 001a0000 00070000
I (106) boot: End of partition table
I (110) boot_comm: chip revision: 1, min. application chip revision: 0
I (118) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=254ech (152812) map
I (181) esp_image: segment 1: paddr=00035514 vaddr=3ffb0000 size=03858h ( 14424) load
I (187) esp_image: segment 2: paddr=00038d74 vaddr=40080000 size=072a4h ( 29348) load
I (200) esp_image: segment 3: paddr=00040020 vaddr=400d0020 size=bc644h (771652) map
I (479) esp_image: segment 4: paddr=000fc66c vaddr=400872a4 size=0f0e0h ( 61664) load
I (505) esp_image: segment 5: paddr=0010b754 vaddr=400c0000 size=00064h (   100) load
I (505) esp_image: segment 6: paddr=0010b7c0 vaddr=50000000 size=00010h (    16) load
I (521) boot: Loaded app from partition at offset 0x10000
I (521) boot: Disabling RNG early entropy source...
I (533) cpu_start: Pro cpu up.
I (534) cpu_start: Starting app cpu, entry point is 0x400814ac
I (520) cpu_start: App cpu up.
I (550) cpu_start: Pro cpu start user code
I (550) cpu_start: cpu freq: 160000000
I (550) cpu_start: Application information:
I (555) cpu_start: Project name:     nodemcu
I (560) cpu_start: App version:      1.4.0-master_20151229-858-ge388
I (567) cpu_start: Compile time:     Nov 10 2022 17:28:30
I (573) cpu_start: ELF file SHA256:  d4c07028fdfd64b5...
I (579) cpu_start: ESP-IDF:          v4.4.2
I (584) heap_init: Initializing. RAM available for dynamic allocation:
I (591) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (597) heap_init: At 3FFB7AE8 len 00028518 (161 KiB): DRAM
I (603) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (609) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (616) heap_init: At 40096384 len 00009C7C (39 KiB): IRAM
I (623) spi_flash: detected chip: generic
I (627) spi_flash: flash io: dio
I (632) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (642) uart: queue free spaces: 3

LFS image loaded
I (762) wifi:wifi driver task: 3ffc78f0, prio:23, stack:6656, core=0
I (762) system_api: Base MAC address is not set
I (762) system_api: read default base MAC address from EFUSE
I (782) wifi:wifi firmware version: eeaa27d
I (782) wifi:wifi certification version: v7.0
I (782) wifi:config NVS flash: enabled
I (792) wifi:config nano formating: disabled
I (792) wifi:Init data frame dynamic rx buffer num: 32
I (792) wifi:Init management frame dynamic rx buffer num: 32
I (802) wifi:Init management short buffer num: 32
I (802) wifi:Init dynamic tx buffer num: 32
I (812) wifi:Init static rx buffer size: 1600
I (812) wifi:Init static rx buffer num: 10
I (822) wifi:Init dynamic rx buffer num: 32
I (822) wifi_init: rx ba win: 6
I (822) wifi_init: tcpip mbox: 32
I (832) wifi_init: udp mbox: 6
I (832) wifi_init: tcp mbox: 6
I (832) wifi_init: tcp tx win: 5744
I (842) wifi_init: tcp rx win: 5744
I (842) wifi_init: tcp mss: 1436
I (852) wifi_init: WiFi IRAM OP enabled
I (852) wifi_init: WiFi RX IRAM OP enabled

NodeMCU ESP32 build unspecified powered by Lua 5.3.5 [5.3-int32-singlefp] on IDF v4.4.2

Hardware

ESP32 Devkitc_v4

jmattsson commented 1 year ago

Apologies for the huge delay. The fix has now been merged.

serg3295 commented 1 year ago

Thank you!