Hi Xianjun,
Thank you for your suggestion in the past about using the link channel feature of the DMA on the MWCT1013A.
We were able to up update duty cycles every 2MHz frame by utilizing all four DMA channels on PWMA channel 2.
We used DMA channel 2 to write to the associated PWMA channel 2 registers (so that the PWM duty cycles could update every 2MHz). Then we used DMA channel 0 to clear DMA channel 2's done bit; then DMA channel 1 to reset DMA channel 2's BCR value; then finally DMA channel 3 to re-enable peripheral requests in DMA channel 2's DCR register.
So basically the following chain:
- DMA 2 -> PWMA Channel 2 registers
- DMA 0 -> DMA2 clear bit (DCR)
3 DMA 1 -> DMA2 set BCR
4 DMA3 -> DMA2 set DREQ (DCR)
All DMAs are setup for 32-bit transfers.
BCR value for DMA channel 2 is set to 32 bytes.
BCR values for DMA channel 0, 1 and 3 are set to 0xFFFFFC (16777212) bytes which is the maximum possible value I could put to keep the circular flow going as long as possible without intervention from the core.
This works pretty well except for when the DMA channel 0 BCR exhausts and we need to utilize the interrupt to go in and reset the BCR values for DMA channel 0, 1, 3.
The DMA channel 0 interrupt is setup as a fast interrupt; there is no other application level code that is running other than a while(1) loop.
What we've noticed is that when the program enters the DMA channel 0 interrupt, there is one PWMA channel 2 duty cycle pulse that is repeated for one frame. In the interrupt we have to disable the (PWM) peripheral interrupt request to DMA CH2 then update all the BCR values for DMA CH 0, 1, 2, 3 and re-enable the DMA CH2 (PWM) peripheral requests.
Unfortunately the system being developed is extremely sensitive to incorrect PWM pulses so we'd like to figure out how to avoid this type of glitch if at all possible with this micro.
It'd be ideal if no manual intervention was required to reset the BCR so that the DMA-PWM data transfers could occur completely autonomously. We've tried to forgo the interrupt option to update the BCRs and just update the value every so often in the main application level while loop but that really throws things off as it has to work to access the peripheral bus and update DMA registers while the DMAs are already running. In this scenario, many PWM pulses are effected which is extremely undesirable.
Based on the reference manual, it doesn't look like there are any options available to get past this issue but if there are, please advise.
It doesn't look like the MWCT1011 would be any better for us as it has the same number of DMA channels (4). We literally need one more DMA channel it seems to be able to reset the DMA CH 0, 1, 3 BCRs.
We were looking at the MWCT101xSF.pdf and these micros look like it could be a good solution as there are 16 DMA channels and 8 flex timers that we can utilize for the PWM functionality desired.
Please advise.
Thanks!