You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using the PWM interface for a bit now and there's some strangeness in it. I just want to make sure I'm not missing anything before I potentially look to create a PR. Currently, I'm using the ATSAMD51J18A chip and trying to drive two PWM outputs on PA04 and PA05 using TC0. I think this should be possible, but running into a number of issues that made me look closer at the HAL implementation. Weird things I think I'm seeing are:
Difference between thumbv6m and thumbv7em: thumbv7em allows you to give it a pin, where thumbv6m doesn't. Seems like thumbv6m should be updated to take a pinout as well (talked about in Add basic support for PWM using TCC on D51/E54 #245).
thumbv7em TCx implements PwmPin and not Pwm: The TCx can control two pins, so I think these should implement Pwm?
Can only give it a single pin: Multiple pins can be driven from a single PWM (is this true for all chips?) so it makes sense that we should be able to give it multiple pins. Right now, I create pinouts for each pin to initialize them, but can only pass one to the PWM.
Not all supported PWM pins are defined in the HAL: So, for what I'm working on now, there is a TC0Pinout defined for PA05, but none for PA04 even though it's supported by the chip.
The text was updated successfully, but these errors were encountered:
@sakian, yes, there are a few APIs in the HAL that could probably use an overhaul. I've notice the inconsistencies in the PWM modules myself.
If you want to tackle this, I would suggest making a mini-RFC first, outlining what you plan to do. I think that would reduce any wasted effort and also make it easier for reviewers to understand the approach without dealing with all the complications of the actual implementation.
More digging has made me realize why only the single channel PwmPin is being used for TCx. It's using the match PWM mode, where it resets when the counter matches CC0, and uses CC1 to drive the PWM output. I think I'll want to use normal PWM mode, where the counter is reset when it hits the max counter value (if using 16-bit counter) and control period using the peripheral clock.
I've been using the PWM interface for a bit now and there's some strangeness in it. I just want to make sure I'm not missing anything before I potentially look to create a PR. Currently, I'm using the ATSAMD51J18A chip and trying to drive two PWM outputs on PA04 and PA05 using TC0. I think this should be possible, but running into a number of issues that made me look closer at the HAL implementation. Weird things I think I'm seeing are:
thumbv6m
andthumbv7em
:thumbv7em
allows you to give it a pin, wherethumbv6m
doesn't. Seems likethumbv6m
should be updated to take a pinout as well (talked about in Add basic support for PWM using TCC on D51/E54 #245).thumbv7em
TCx implementsPwmPin
and notPwm
: The TCx can control two pins, so I think these should implementPwm
?TC0Pinout
defined forPA05
, but none forPA04
even though it's supported by the chip.The text was updated successfully, but these errors were encountered: