Bare Metal DMA, Changing DMA_DCR destination address during mid transfer

cancel
Showing results for 
Search instead for 
Did you mean: 

Bare Metal DMA, Changing DMA_DCR destination address during mid transfer

Jump to solution
269 Views
matthew5
Contributor I

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!

1 Solution
200 Views
Alexis_A
NXP TechSupport
NXP TechSupport

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

View solution in original post

1 Reply
201 Views
Alexis_A
NXP TechSupport
NXP TechSupport

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

View solution in original post