I'm trying to dynamically update the destination address on an eDMA channel to switch page buffers.
I am using the K64F Freedom board to read an ADC channel. The eDMA channel writes to a circular buffer using a modulo of 1024 (1 of 4 pages). I also use the Hardware Compare Mode of the ADC to fire if the ADC value is below a threshold. As a rule, the ADC can fire prior to filling up the buffer and/or overflowing the modulo. When this happens, I want to switch buffer pages.
Everything works except updating the eDMA DADDR register for the channel. After I update register with another page address, the channel goes back to the previous buffer (it appears to continue where it left off before the
update). I have read the Reference Manual, Section: 22.5.7 Dynamic programming. Also, in Section: 188.8.131.52 Reading the transfer descriptors of active channels, it appears that the TCDn_SADDR, TCDn_DADDR, and TCDn_NBYTES registers are kept within the eDMA engine while the channel is active. Does this mean that updating the hardware registers dynamically, won't actually change the DADDR that is in process?
What is a work-around that I can use? I tried clearing all of the registers for the channel. I could use driver function that cancels the current transfer, but I have other channels operating on other things and it doesn't appear there is a way to cancel the transfer of a specific channel.