DMA stops working

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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_SRC_BASE (CYDEV_PERIPH_BASE)

   

#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);

   

}</p>

0 Likes
3 Replies
Anonymous
Not applicable

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

   

And of course many thanks in advance!

0 Likes
Anonymous
Not applicable

 Hi!

   

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.

   

Cheers,

   

David

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

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)

0 Likes