DMA question

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User5327
Level 4
Level 4
Hi all,

my problem:
I have PWM with period 1s and duty 50%.

and I need neverending loop where in each compare match (0,5s; 1,5s; 2,5s; ...) will be set some value (0x0000 - 0xFFFF) to 16bit variable.
and in each period match (1s; 2s; 3s; ...) will automaticaly starts DMA (no by SW in interrupt .... interupt have to be called directly by HW - period match - without CPU) which only transfer this 16bit value to port P1 (ie address 0x0x48028100)

Is it possible with app DMA002 or DMA003 or DMA004 or with else?
How can I do it?

Regards

Koumak
0 Likes
3 Replies
Not applicable
Hi Koumak,

My question is why you don't directly write to port P1 in compare match ISR?
If you really want to use DMA, you need to use software trigger since this is memory-to-memory transfer (refer to Pg231 of xmc4500_rm_v1+2_2012_12_). You can use either DMA002 (using linked list to create an infinite loop) or DMA003 (need to reenable the DMA channel in CCU ISR).

Best regards,
Sophia
0 Likes
User5327
Level 4
Level 4
Hi sophia,
Thanks for advices.

My reason is, that I need to control another device at precise time intervals - and this is not possible with sw interrupt (in sw interrupt is not possible to guarantee precise time when it will be done).

Now I tried to use DMA003 which I set following:
173.attach 174.attach
But in this way I can update P1 4000 times and then I must reload config.
And interesting is that I must set transfer as "Periphera-Memory" - only in this case it functions correct (as I want).
(and in addition - this solve maybe is not quite good)

Sophia I am not sure, that I understand your advice well - I think some example would be more helpful.
Or can you little more describe how to set apps for case as you say...


Or someone have better idea, how to solve this problem?

Thanks.
Best regards
Koumak
0 Likes
Not applicable
Hi Koumak,

Glad to know that you got the function you wanted. To avoid reloading, you can use DMA002 for multi-block transfers, select "Auto-reload multi-block transfer" for "Transfer Type".
At the same time, thank you very much your feedback. We will try to provide more examples in future.

Best regards,
Sophia
0 Likes