arduino / arduino/ArduinoCore-mbed
Limited PWM Frequency Range - Cannot Set Below ~500Hz
- Dominant language
- C
- Stars
- 411
- Forks
- 225
- PR merge metrics
- No merged PRs in 30d
Description
### Description:
I’ve encountered a limitation when using PWM on the RP2040 with the Mbed-based Arduino core:
It seems impossible to set a PWM frequency below ~500Hz. This effectively restricts the usable PWM range, which feels very limiting for certain applications (e.g., motor control, LED dimming with long periods, etc.).
This existing Mbed forum thread describes the problem in detail:
🔗 [PWM period is not good on Mbed with Raspberry Pico](https://forums.mbed.com/t/pwm-period-is-not-good-on-mbed-with-raspberry-pico/22151/4)
### Expected Behavior:
Ability to configure PWM to frequencies significantly below 500Hz, as supported by the RP2040 hardware timers.
### Actual Behavior:
Attempts to set periods corresponding to <500Hz frequencies do not work as expected. The resolution appears capped or constrained by the current Mbed layer.
### Proposal:
Consider aligning PWM implementation with what the RP2040 hardware can actually achieve. If Mbed OS’s limitations are the root cause, one possible path forward might be migrating this Arduino core to [mbed-ce (Community Edition)](https://github.com/mbed-ce) instead of the current, now less actively maintained, official Mbed OS branch.
mbed-ce appears to be more actively developed and may offer better flexibility and bug fixes for peripheral handling, including PWM.
Or am I missing something here and there is a way to get PWM below 500Hz?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the PWM period behavior on the RP2040 with the Mbed-based Arduino core and compare it with the linked Mbed forum report. Trace the current PWM implementation and determine whether the limitation comes from the existing Mbed layer or requires the proposed mbed-ce migration; done means reliably configuring frequencies below 500 Hz.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100