Skip to content

Commit bb19d7d

Browse files
authored
Update clock handling for ESP32-C5
1 parent 7e9dfef commit bb19d7d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cores/esp32/Esp.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,14 @@ uint8_t EspClass::getFlashClockDivider(void) {
556556
return 1; // 1:1 clock (no divider)
557557
}
558558
return SPI0.clock.clkcnt_n + 1;
559+
#elif CONFIG_IDF_TARGET_ESP32C5
560+
// ESP32-C5: Uses spi_mem_c_clock_reg_t with mem_ prefix
561+
if (SPIMEM0.clock.mem_clk_equ_sysclk) {
562+
return 1; // 1:1 clock (no divider)
563+
}
564+
return SPIMEM0.clock.mem_clkcnt_n + 1;
559565
#else
560-
// All modern chips (S2, S3, C2, C3, C5, C6, H2, P4): Use SPIMEM0 structure
566+
// (S2, S3, C2, C3, C6, H2, P4): Use SPIMEM0 structure without mem_ prefix
561567
if (SPIMEM0.clock.clk_equ_sysclk) {
562568
return 1; // 1:1 clock (no divider)
563569
}

0 commit comments

Comments
 (0)