brantb
Joined: 23 Mar 2015 Posts: 18
|
Posted: Wed Aug 10, 2016 3:54 am Post subject: XMEGA - DMA from Program Flash - possible? |
|
|
Hi Everyone,
I have been searching and searching, and I just cannot seem to find this question answered elsewhere already. I have been all over the datasheet and the manual for the Xmega A (ATxmega128A4U, in this particular case), and if the answer is in there, I will humbly make an appointment with my eye doctor for a new set of glasses . (Mind you, I have been putting in some long hours recently, so it really is possible that I have missed it several times )
Is it possible to set the source address for a DMA transfer to be a starting point in Program memory?
Think of it this way - instead of doing a Restore (to a set of Data statements), and then doing a loop to Read bytes one at a time and do something with them (eg. output to a DAC, or a UART, etc.) ...
Code: | Restore My_data
For I = 1 to 10
Read My_byte
Print My_byte;
Next I |
... wouldn't it be great to set up DMA to go directly to the UART, instead (for instance)?
The datasheet shows a total of 3 registers (24bits) for the DMA source address (and also the destination address), so I think that the entire memory map should be "open season" for it - right? And, of course, I know that it would be useless to try to DMA to the Flash memory - I am only hoping to be able to DMA from it.
My first thought was to use SADR = Loadlabel(My_data) when setting up the Config Dmach0 statement - however, I realized that the Loadlabel command only works on <=64K chips (and mine is 128K).
So ... that leaves me wondering if I might have to do the usual Restore My_data statement, then immediately transfer the values of RAMPZ:R9:R8 into SRCADDR0, SRCADDR1, and SRCADDR2, respectively (after the normal Config Dmach0)? Or ... is there a BASCOM command which is the 24bit equivalent of Loadlabel? (If so, I would much rather use it right on the Config Dmach0 line). Other thoughts?
I have successfully done some simple DMA work already, and I am quite comfortable with Assembly and registers etc. ... but I would not say that I am at a point (yet) where I am intimately familiar with DMA and could do it in my sleep without giving it a second thought. So, I am just looking for a bit of guidance/wisdom from some of the experts here.
Cheers!
Brant
(BASCOM-AVR version : 2.0.7.8 ) |
|