An ESP32-S3 uses LEDC for an indicator and a small fan. The first channel uses the source derived from the external 40 MHz surface-mount crystal and meets its dimming needs. Firmware tries a different source for the second channel to obtain finer duty control. There are multiple timers, but on this device they share one source selection. An unsupported combination can fail to configure, and changing the global source can affect a working channel. Trace the board reference, peripheral source, and individual timer settings together.
Separate the board crystal from the peripheral source selection
Espressif's ESP32-S3 clock tree takes XTAL_CLK from an external 40 MHz crystal. This example concerns an existing two-terminal crystal oscillator circuit. It does not establish a direct external CMOS oscillator connection. The LEDC guide lists the 40 MHz XTAL source, an 80 MHz APB source, and a roughly 20 MHz RC_FAST source. ESP32-S3 LEDC timers share one source. They can have different divider and counting settings while drawing on that shared choice. Check the driver result first to distinguish a changed first channel from a second channel that never initialized.
Two application drivers may each configure a timer without knowing the other driver's clock requirement. Capture the resulting settings after both initialize. If the application manages processor frequency dynamically, also check the relationship between that transition and the peripheral source. Espressif identifies XTAL as compatible with dynamic frequency scaling. That characteristic does not establish that both desired PWM setups fit within the same clock choice.
Estimate the available duty resolution at a shared frequency
Suppose both outputs need 20 kHz, a 50 microsecond period. With the 40 MHz crystal-derived source, each period spans 2000 raw clock intervals. An eleven-bit count needs 2048 states, which already exceeds that raw total. Ten bits require 1024 states, giving an ideal divider of 1.953125. At 80 MHz there are 4000 raw intervals per period, so eleven bits fit geometrically, also with an ideal divider of 1.953125. These calculations rule out combinations before programming. Verify that the actual driver and divider support the chosen settings and measure the output.
At 20 kHz, a full ten-bit counter gives a nominal time step of about 48.83 ns. Compare both loads before increasing resolution on either. The driver includes a helper to find a suitable resolution from the source and target PWM frequency. That ten-bit step changes when frequency changes. A lower PWM rate may provide more intervals, provided the driven load remains suitable at that rate.
Qualify the output policy during light sleep
The ESP-IDF guide says that continued output during Light-sleep requires the keep-alive channel strategy and a timer source compatible with that mode. RC_FAST is listed as compatible and the driver calibrates it. Moving to RC_FAST requires rechecking both channels' frequency and resolution, as well as power in the real mode. A keep-alive request alone does not establish that the selected clock and power domain will remain available. If the application permits PWM to pause, verify the first acceptable pulse on restart instead.
Run both outputs with the same test firmware. Capture their periods and widths at low, middle, and high duty settings, then repeat through the applicable frequency and sleep transitions. A replacement 40 MHz surface-mount crystal also requires verification of the existing oscillator circuit and received frequency. On a module, establish whether the installed crystal is accessible as a board part at all. Record the clock selection with evidence from both outputs.
If the two loads need incompatible clock and sleep conditions, an independently clocked peripheral can be evaluated for one load. Recheck startup, stop and restart timing after the change. This keeps two paths that are individually valid from becoming unreliable when the system changes modes.
When the problem occurs only as the second channel initializes, save the waveform around that operation. Under the same supply conditions, initialize it once with the existing source and once with an incompatible request. Compare the driver's result, the first channel's next period, and whether a second output appears. This separates a rejected configuration from software that proceeds after an error. Include zero, near-full, and fully on duty cases. Espressif describes a maximum-resolution duty-value limit, so verify the intended boundary behavior before testing retention during sleep.
