AnsweredAssumed Answered

Running the AFE Rx DMA continuously

Question asked by amf on Apr 9, 2016
Latest reply on Apr 13, 2016 by emoloney

I have combined the examples of AmperometricMeasurement.c with SPItoFTDI.c and want to extend this to running the AFE continuously.  I have modified seq_afe_ampmeas to not reset WAVEGEN_EN to 0.  This allows the AFE to sample forever (as documented on p. 316 of the Hardware Reference Manual).  I've also torn apart adi_AFE_RunSequence and created my own sub-functions in afe.c which execute the initial steps of what adi_AFE_RunSequence does (i.e. I don't shut the AFE down).


I want the AFE RX DMA to continuously send 1024-halfword A/D samples to a double-buffering scheme (two 4096-halfword buffers that consume all of RAM1).  When one 4096-halfword buffer is filled, a callback switches to filling the second one.  Meanwhile, the first 4096-halfword buffer gets shipped out the SPI port via the SPI Tx DMA. 


I use the BASIC transfer mode for or the AFE Rx DMA (as in the AmperometricMeasurement.c example), which can do only a single 1024-halfword transfer at a shot ... so I do 4 in a row to one buffer, then 4 in a row to the second buffer.  In my AFE Rx DMA-done interrupt handler, which gets entered after every 1024-halfword transfer, I fix up the buffer segment pointer to the next location.  The callback gets called every 4th time the AFE Rx DMA-done handler is entered, and the callback switches buffer pointers.


This all works fine ... once.  That is, the AFE Rx DMA transfers 1024 halfwords and enters its dma-done interrupt handler once.


However, I never get the program counter to enter the AFE Rx DMA-done interrupt handler the second time ... even though I can see that the DMA actually did the second 1024-halfword transfer!  It's like the interrupt didn't get re-enabled.  Can you help me figure out how to get the program counter to get into AFE Rx DMA-done interrupt handler more than once?  I've attached a more detailed explanation, along with the project. 


Thank you.