I'm trying to get autoreload working for a TCPWM counter cc0 & cc registers in a cyt4bb.
I'm using a TCPMW0 group0 counter in PWM up-counter mode, with the control register set to 0x84000003. (The bottom two bits of this should be enabling autoreload for cc0 and cc1.)
The counter is working fine & generating a PWM output.
But the cc0_buff / cc1_buff registers never get copied into cc0 / cc1 (& so my PWM duty cycle never changes). Logging the values of these registers, I see cc0 and cc1 staying forever at the values I initialized them to, even though cc0_buff / cc1_buff get updated with different values.
* Have I misunderstood autoreload? I was expecting to see the registers get copied when the counter rolls-over. * Is there something else I need to do to get autoreload working? * Do all three counter groups support autoreload and both CC regs?
Ok, it turns out "auto reload" still needs a capture0 trigger to take effect. What is the timing of the capture0 trigger?
Does it swap the cc0 & cc0_buff etc. immediately (in which case I would need to set up a loopback trigger on the terminal-count), or does the swap happen at the next reload (in which case I can just trigger the capture0 from my interrupt handler by writing the TR_CMD register).