Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

bisak
Copy link

@bisak bisak commented Sep 30, 2025

Hi, quick PR here.

This was the only way I was able to make this board work -> https://www.espboards.dev/esp32/esp32-c3-super-mini-plus/

No matter which pins I used, I was intermittently 3 out of 5 boots getting the following error:

EP32-DRV: Configuring 3PWM
EP32-DRV: 3PWM setup in group: 0
E (290) ledc: ledc_channel_config(847): sleep_mode argument is invalid
EP32-DRV: ERROR - Failed to attach channel:0
EP32-DRV: ERROR - Failed to configure pin:1

This PR fixes it. I don't know if this is a good solution, but works bulletproof for the C3 board in quesiton.

Open to discuss. Thanks.

@askuric
Copy link
Member

askuric commented Oct 8, 2025

Thanks for reporting/solving this. Espressif guys are making our life difficult recently. They are introducing braking changes to their low level api very often, almost every few months.

Which version of the arduino-esp32 package are you using?

@askuric
Copy link
Member

askuric commented Oct 14, 2025

@uLipe do you maybe have some thoughts on this?

We've had a couple of these changes recently that are braking our compilation.
It seems like in the last versions of IDF there are a couple of new attributes added to the ledc and/or mcpwm drivers.
Do you have some insight if there is a way to be a bit more future proof, so that we don't have to release a new version of the library on each arduino-esp32 package release :D

@uLipe
Copy link

uLipe commented Oct 14, 2025

Hello @askuric @bisak , I agree with the solution proposed, it is the best way for fixing it.

Why this causes an error:

  • The IDF has a very complex low power framework that is system wide.
  • But this framework is aware that some peripherals may need to be enabled even in battery saving scenarios.
  • The solution is to use a giant lock called PM_LOCKS which are spread over the drivers, if the driver instance takes it, it cannot be put in sleep mode by the IDF system component.

So telling this driver will be ALIVE during its initialization flow will resulting on taking this driver PM_LOCK and never releasing it which signals the IDF system telling: don't put this peripheral in sleep mode, so this solution is perfect to avoid bad-operation of the LEDC in runtime.

BTW C3 is far more aggressive on its low power framework, that is probably behind the error happens right after you initialize it.

Copy link

@uLipe uLipe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the IDF perspective, LGTM.

@uLipe
Copy link

uLipe commented Oct 14, 2025

Regarding the future proof, this started to become a concern on the latest versions of IDF 5, but before that, the rule of thumb is, if a particular component is developed under the same major number of IDF it should not break, but when it targets a new IDF (from 4 to 5) it will break.

For the next releases the IDF is being more smooth between these versions, by making an API deprecated before removing it.

What I suggest is still the ugly solution, read the IDF version of the particular arduino core, and add remove code based on it,

cc: @askuric

@runger1101001 runger1101001 added this to the 2.3.6_Release milestone Oct 14, 2025
@runger1101001 runger1101001 added the bug Something isn't working label Oct 14, 2025
@runger1101001
Copy link
Member

In that case I will merge it, so that we have the fix in the next release.

Thank you @bisak for this PR, and thank you @uLipe for your insights on it!

@runger1101001 runger1101001 merged commit 46f543f into simplefoc:dev Oct 14, 2025
28 checks passed
@bisak
Copy link
Author

bisak commented Oct 14, 2025

Huge thank you for merging this!
Just for the record I was using master of pioarduino, so esp-idf 5.5.1 at present.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.