current E5 PWM implementation is LIMITED (was 'broken')
bombasticbob opened this issue · 7 comments
work in progress.
there seems to be an interaction of some kind where pins PC4 through pC7 have half the frequency of pins PC0 through PC3. This is probalby the waveform generator module [it needs to be disabled in the startup code, probably]. PD0 though PD3 won't be able to have PWM. PD4 through PD7 work fine, but if PD6 and PD7 are used for serial, there won't be any PWM out.
Still working on PWM for E series.
Randomly ran across this comment when looking for E5 PWM examples. One thing that might explain why PC4 and PC5 might not behave the same is that the REMAP pin docs state that OCA and OCB will be OR-modulated between TCC4 and TCC5. No idea if that's what you're seeing, but thought I'd mention it as a possibile debugging path.
thanks, will do
a few observations:
a) assigning FFH to WEXC_OUTOVDIS disables PWM output on port C only. When assigned to zero (the default value), PWM "almost works" on port C.
b) port C pins 0-5 work as expected except 4 and 5 have half the output freq
c) port D pins 6 and 7 do not work (header file defs for timer 5 suggest only CCA and CCB are used)
d) consistently for timers 4 and 5, pins 6 and 7 aren't working [something else affects them?]
using 'NORMAL' vs 'SINGLE SLOPE PWM' seems to help correct the problems with bit-select and signal output. however, 'NORMAL' only does one pulse per count overflow, so you get symmetrical 1khz output instead of PWM 2khz output (but it works correctly on all pins when selected).
it appears that timer 5 PWM timer output on pins 6 and 7 basically doesn't happen, and similarly the output from timer 4 isn't being used on pins 4-7 on the E series. modes for the waveform extension affect PWM output directly. In short, there are only 6 usable PWM outputs for TC4 and TD5.
In the interrim, the default 32E5 mapping will only support PWM on the following pins:
3 - port D pin 4
4 - port D pin 5
8 - port C pin 2
9 - port C pin 3
16 - port C pin 0 (also SDA)
17 - port C pin 1 (also SCL)