cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with DMA

sanjib
Associate III
Posted on January 23, 2014 at 06:12

The original post was too long to process during our migration. Please click on the attachment to read the original post.
13 REPLIES 13
Posted on January 23, 2014 at 09:02

>  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;        //DMA_PeripheralDataSize_Word;

>   DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word;            //DMA_MemoryDataSize_word

This is oveflowing the buffer, as its elements are uint16_t.

JW
sanjib
Associate III
Posted on January 24, 2014 at 10:39

Posted on January 24, 2014 at 10:59

> Thanks for reply.but I have a doubt ADC_CDR is a 32 bit and I have configured as

> DMA_Mode_2 ,

What is DMA_Mode_2?

>which will make available ADC_CDR[0 to 15] ADC1 converted value and the ADC_CDR[16 to 31] ADC2 converted value.

Okay, then either make the buffer use 32-bit values

__IO uint32_t ADCDualConvertedValues[BUFFERSIZE];

or leave the buffer as it is and make the DMA transfer half the number of items

    DMA_InitStructure.DMA_BufferSize = BUFFERSIZE/2;

> moreover I have also tried with half word but after debegging I am seeing value like

> ADCDualConvertedValues[0] 3012 Suppose to be ADC1 converted value,

> ADCDualConvertedValues[1] 3220 Suppose to be ADC2 converted value,

No, if you set the peripheral size in DMA controller to 16-bit, it will always read the lower part of ADC_CDR register, i.e. always the ADC1 converted value.

JW

sanjib
Associate III
Posted on January 24, 2014 at 11:20

Posted on January 24, 2014 at 11:33

> So how should I configure so that both the channels should be read at same time interval without overflowing.

As I wrote above:

Okay, then either make the buffer use 32-bit values

__IO uint32_t ADCDualConvertedValues[BUFFERSIZE];

or leave the buffer as it is and make the DMA transfer half the number of items

    DMA_InitStructure.DMA_BufferSize = BUFFERSIZE/2;

JW

PS. Don't post below the line, it hides your message as if it was a quote.

sanjib
Associate III
Posted on January 24, 2014 at 11:49

sanjib
Associate III
Posted on January 24, 2014 at 11:55

Posted on January 24, 2014 at 12:17

> One more thing do you think that iir filter operation will complete till my next half buffer is full

This is something you want to determine yourself. See e.g. Clive's post in https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FDuration%20of%20FLOAT%20operations&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=3544

JW

sanjib
Associate III
Posted on January 24, 2014 at 12:25

ok.Thanks a lot.