Skip to content

Conversation

@cjwhoishe
Copy link

Description

The pwm_stream example was not working at all for both the ESP32C3 AND the ESP32C6.
ensuring that these processor variants were included for any processor specific selective code got them working but the ESP32C was 'garbled'.
Investigation found that setting the frame rate to 1/2 of what it actually was in the function pwm_stream_set_clk() would clear this up. This pointed to clock selection issues.
The code uses the define APB_CLK_FREQ for all subsequent timer clock calculations.
for the ESP32C6 this is defined as 40M which causes incorrect timer settings to be calculated when the 80MHZ PLL clock was selected.

Related

Testing

I have tried the same code on an ESP32, ESP32S2, ESP32C3 and ESP32C6 which now all work.

The clock changes for the ESP32C6 will effect a user who has used the ledc_set_timer_div() function, noticed that it actually sets it up wrongly and compensates for it in there own code. Like I nearly chose to fix it by 'tweaking' the frame rate as mentioned above.


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@CLAassistant
Copy link

CLAassistant commented Aug 5, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot changed the title Update pwm_stream.c to support ESP32C3 and ESP32C6 Update pwm_stream.c to support ESP32C3 and ESP32C6 (AUD-6603) Aug 5, 2025
@cjwhoishe
Copy link
Author

The second set of commits were made to allow for the sample rate etc to be changed without having to 'teardown' and rebuild the pipeline this was in to do it. This occurs if a new source is selected (in my case a different URI) for an internet stream which has different mp3 encoding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants