Skip to content

Conversation

@gregmatthewcrossley
Copy link

This commit expands the PWM driver to support 5 simultaneous PWM channels (up from 3), utilizing both TIMER0 and TIMER1 hardware peripherals.

Changes:

  • Increased max_pwm_channels from 3 to 5 in pwm.h
  • Implemented 2-timer allocation strategy in pwm.cpp:
    • Channels 0-2 use TIMER0 (CC0, CC1, CC2)
    • Channels 3-4 use TIMER1 (CC0, CC1)
  • Added helper methods get_timer_for_channel() and get_cc_channel_for_pwm_channel()
  • All channels share the same frequency (GSDK constraint) with independent duty cycles
  • Updated test_sketch.ino to test all 5 PWM channels
  • Added pwm_multi_channel example demonstrating 5-channel usage

Hardware tested on Arduino Nano Matter (EFR32xG24) with oscilloscope verification of 4 channels (the limit of my oscilloscope) operating simultaneously with different duty cycles.

All 28 automated build tests pass.
scope-measurement

This commit expands the PWM driver to support 5 simultaneous PWM channels (up from 3), utilizing both TIMER0 and TIMER1 hardware peripherals.

Changes:
- Increased max_pwm_channels from 3 to 5 in pwm.h
- Implemented 2-timer allocation strategy in pwm.cpp:
  * Channels 0-2 use TIMER0 (CC0, CC1, CC2)
  * Channels 3-4 use TIMER1 (CC0, CC1)
- Added helper methods get_timer_for_channel() and get_cc_channel_for_pwm_channel()
- All channels share the same frequency (GSDK constraint) with independent duty cycles
- Updated test_sketch.ino to test all 5 PWM channels
- Added pwm_multi_channel example demonstrating 5-channel usage

Hardware tested on Arduino Nano Matter (EFR32xG24) with oscilloscope verification of 4 channels (the limit of my oscilloscope) operating simultaneously with different duty cycles.

All 28 automated build tests pass.
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.

1 participant