3 Replies Latest reply on Jul 23, 2013 5:06 AM by HeLi_263931

    DMA stops working

      Hi all!


      I'm using DMA to transfer data from an ADC to a buffer. First of all: Everything works and I can work with the buffered Data, but then...


      After a time of about 230 seconds the pulse on the 'nrq' output of the DMA component stops and therefore the ISR isn't entered.


      The ADC is working with 182250 SPS at 8 bit resolution and I'm saving 50 bytes.


      A DMA_release and reinitializing didn't help. The only solution I have so far is reseting the device.


      Attached find the TopDesign part of the DMA. I'm meassuring on 'ADC_eoc' to check for the pulse.




      The DMA Configuration looks as follows: 


      <p>void DMA_ADC_Buffer(void)




      #define DMA_ADC_Buffer_BYTES_PER_BURST 1


      #define DMA_ADC_Buffer_REQUEST_PER_BURST 1




      #define DMA_ADC_Buffer_DST_BASE (CYDEV_SRAM_BASE)


      uint8 DMA_ADC_Buffer_Chan;


      uint8 DMA_ADC_Buffer_TD[1];


      DMA_ADC_Buffer_Chan = DMA_ADC_Buffer_DmaInitialize(DMA_ADC_Buffer_BYTES_PER_BURST,DMA_ADC_Buffer_REQUEST_PER_BURST,    HI16(DMA_ADC_Buffer_SRC_BASE), HI16(DMA_ADC_Buffer_DST_BASE));


      DMA_ADC_Buffer_TD[0] = CyDmaTdAllocate();


      CyDmaTdSetConfiguration(DMA_ADC_Buffer_TD[0], 50, DMA_DISABLE_TD, DMA_ADC_Buffer__TD_TERMOUT_EN | TD_INC_DST_ADR);


      CyDmaTdSetAddress(DMA_ADC_Buffer_TD[0], LO16((uint32)Rx_ADC_DEC_SAMP_PTR), LO16((uint32)ADC_Buffer));


      CyDmaChSetInitialTd(DMA_ADC_Buffer_Chan, DMA_ADC_Buffer_TD[0]);


      CyDmaChEnable(DMA_ADC_Buffer_Chan, 1);



        • 1. Re: DMA stops working

           I'm sorry for the layout. The code was supposed to be displayed as code.


          And of course many thanks in advance!

          • 2. Re: DMA stops working



            I found the solution!


            I don't know if it's an internal bug with the memory mapping but it seems like it.


            After checking every possible source and reading tons of paper about the DMA, I still couldn't find any solution. I couldn't explain why it stopped after 230 seconds and why it stopped at all.


            My idea was, that the DMA isn't able to map the destianation address properly and therefore hangs after some time. Maybe it's in the memory nirvana and doesn't find a way out. 


            I then tried to change the SPS from the ADC into a by-8-devidable figure. I changed it from 182250 to 182248. And these two little samples solved my problem! Maybe there are more, who experienced a similar problem and didn't know how to fix it.





            • 3. Re: DMA stops working

              When you observe this 'stop' condition, does the ADC still generate end-of-conversion pulses?


              What do you do in the IRQ handler which gets triggered when the 50 bytes are read? Do you re-start the DMA then? (the DMA configuration doesn't loop the TD to itself, so it will stop after 50 bytes)