Fixing ESP32 incorrect PWM frequency and UART rubbish characters (XTAL Frequency)

Image

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).
ImageImage
Image

โ” 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:

ImageImage

๐Ÿ”ง Issue Fix

Press on gear icon to Open SDK Configuration Editor:

Image

Type freq in search field and find Main XTAL Config section, where you can choose XTAL (crystal) frequency:

  • 26 MHz
  • 40 MHz

Image

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)
ImageImage
135
No comments yet. Be the first to add a comment!
Cookies?