Hi all,
I'm currently working on a project that requires me to PWM a few LEDs at varying duty cycles. I was thinking of using DMA from a static buffer to the target TPM channel value register. The target LED to PWM is dependent on the statemachine of my application. So if there is a change in state, I would need to change the target LED.
I just wanted to confirm, if a DMA transfer is in process while a change in state of my statemachine occurs, do I just need to set the ERQ bit of the DCR register to 0 before I make any further changes to the destination address?
The reason I am asking is because the datasheet mentions that "modifying DMA control registers during a transfer can result in undefined operation". I want to make sure that the procedure I'm thinking of implementing is safe to do so.
Thanks!
Solved! Go to Solution.
Hello Matthew,
If you already start a transfer, the best way would be to set the D_REQ bit in the DCR register and wait until the active transfer is done.
Best Regards,
Alexis Andalon
Hello Matthew,
If you already start a transfer, the best way would be to set the D_REQ bit in the DCR register and wait until the active transfer is done.
Best Regards,
Alexis Andalon