Fixing ESP32 incorrect PWM frequency and UART rubbish characters (XTAL Frequency)
If you have ESP32-C2 (ESP8284) or other developing board and use VSCode IDE and ESP-IDF extension might have problems with debug terminal (UART), which is most likely related to the default configurations and can be easily fixed.
๐บ Issue Description
UART | PWM (ledc) |
| Strange symbols instead of characters (looks like baud rate problem). | Signal frequency is lower, that defined in code (should be 5kHz, but 3.25kHz in reality). |
![]() | ![]() |
![]() |
โ Causing
Most likely on the your board installed crystal with frequency another from specified in the configs. Typically it's 26MHz or 40MHz, so you don't need to remove metal shielding to check the actual value of the XTAL:
![]() | ![]() |
๐ง Issue Fix
Press on gear icon to Open SDK Configuration Editor:
Type freq in search field and find Main XTAL Config section, where you can choose XTAL (crystal) frequency:
- 26 MHz
- 40 MHz
Just change it to a different one than it was before.
โ Fixed
UART | PWM (ledc) |
| Now all debug information is correctly showing. | Now frequency the same, as defined in code (5KHz) |
![]() | ![]() |










Great. Thanks!