The issue
idf.py set target esp32c3
idf.py menuconfig
idf.py flash monitor -p /dev/ttyACM0
Which SDK are you using?
esp-idf
Which version of SDK are you using?
ESP-IDF v5.5.3-dirty
Which build target have you used?
Component causing the issue
dht
Anything in the logs that might be useful for us?
I (15) boot: ESP-IDF v5.5.3-dirty 2nd stage bootloader
I (15) boot: compile time May 25 2026 12:05:11
I (16) boot: chip revision: v0.3
I (16) boot: efuse block revision: v1.1
I (20) boot.esp32c3: SPI Speed : 80MHz
I (23) boot.esp32c3: SPI Mode : DIO
I (27) boot.esp32c3: SPI Flash Size : 2MB
I (31) boot: Enabling RNG early entropy source...
I (35) boot: Partition Table:
I (38) boot: ## Label Usage Type ST Offset Length
I (44) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (51) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (57) boot: 2 factory factory app 00 00 00010000 00100000
I (64) boot: End of partition table
I (67) esp_image: segment 0: paddr=00010020 vaddr=3c020020 size=088b4h ( 34996) map
I (80) esp_image: segment 1: paddr=000188dc vaddr=3fc8ba00 size=01788h ( 6024) load
I (83) esp_image: segment 2: paddr=0001a06c vaddr=40380000 size=05fach ( 24492) load
I (94) esp_image: segment 3: paddr=00020020 vaddr=42000020 size=13c20h ( 80928) map
I (109) esp_image: segment 4: paddr=00033c48 vaddr=40385fac size=05980h ( 22912) load
I (114) esp_image: segment 5: paddr=000395d0 vaddr=50000000 size=00020h ( 32) load
I (118) boot: Loaded app from partition at offset 0x10000
I (118) boot: Disabling RNG early entropy source...
I (134) cpu_start: Unicore app
I (143) cpu_start: GPIO 20 and 21 are used as console UART I/O pins
I (143) cpu_start: Pro cpu start user code
I (143) cpu_start: cpu freq: 160000000 Hz
I (145) app_init: Application information:
I (149) app_init: Project name: example-dht
I (153) app_init: App version: 1.2.0-2-gf26b936-dirty
I (158) app_init: Compile time: May 25 2026 12:05:07
I (163) app_init: ELF file SHA256: 44783b132...
I (168) app_init: ESP-IDF: v5.5.3-dirty
I (172) efuse_init: Min chip rev: v0.3
I (176) efuse_init: Max chip rev: v1.99
I (180) efuse_init: Chip rev: v0.3
I (184) heap_init: Initializing. RAM available for dynamic allocation:
I (190) heap_init: At 3FC8E050 len 00031FB0 (199 KiB): RAM
I (195) heap_init: At 3FCC0000 len 0001C710 (113 KiB): Retention RAM
I (201) heap_init: At 3FCDC710 len 00002950 (10 KiB): Retention RAM
I (207) heap_init: At 50000020 len 00001FC8 (7 KiB): RTCRAM
I (213) spi_flash: detected chip: th
I (216) spi_flash: flash io: dio
W (219) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (231) sleep_gpio: Configure to isolate all GPIO pins in sleep state
I (237) sleep_gpio: Enable automatic switching of GPIO sleep configuration
I (244) main_task: Started on CPU0
I (244) main_task: Calling app_main()
E (254) dht: Initialization error, problem in phase 'C'
Could not read data from sensor
I (254) main_task: Returned from app_main()
E (22474) dht: Initialization error, problem in phase 'C'
Could not read data from sensor
Additional information or context
On ESP32C3.
I (244) main_task: Started on CPU0
I (244) main_task: Calling app_main()
E (254) dht: Initialization error, problem in phase 'C'
Could not read data from sensor
I (254) main_task: Returned from app_main()
E (22474) dht: Initialization error, problem in phase 'C'
Could not read data from sensor
On ESP32
I (267) main_task: Started on CPU0
I (277) main_task: Calling app_main()
Humidity: 35.0% Temp: 26.0C
I (297) main_task: Returned from app_main()
Humidity: 35.0% Temp: 26.0C
Humidity: 35.0% Temp: 26.0C
Humidity: 35.0% Temp: 26.0C
The critical section is having some kind of impact.
However, I don't know what caused it.
https://github.com/esp-idf-lib/dht/blob ... #L213-L216
This will get it working on ESP32C3.
#if 0
PORT_ENTER_CRITICAL();
#endif
esp_err_t result = dht_fetch_data(sensor_type, pin, data);
#if 0
if (result == ESP_OK)
PORT_EXIT_CRITICAL();
#endif
Confirmation
The issue
Which SDK are you using?
esp-idf
Which version of SDK are you using?
ESP-IDF v5.5.3-dirty
Which build target have you used?
Component causing the issue
dht
Anything in the logs that might be useful for us?
Additional information or context
On ESP32C3.
On ESP32
The critical section is having some kind of impact.
However, I don't know what caused it.
https://github.com/esp-idf-lib/dht/blob ... #L213-L216
This will get it working on ESP32C3.
Confirmation