AnsweredAssumed Answered

DMA overwrites rest of memory [solved]

Question asked by julien.staub on Jul 6, 2014
Latest reply on Jul 7, 2014 by julien.staub
I am working on STM32L151ZC. I use DMA to continuously read 28 ADC channels
It seems that the DMA is periodicaly (les often than the "normal operation period") overwriting memory that it shouldn't access directly.
The DMA schould use 448bytes of memory to store data but sometimes it overwrites about 10000 bytes.

Here is an extract of my initialisation code :

#define ADC1_DR_ADDRESS    ((uint32_t)0x40012458)
#define NB_MESURES 8

volatile uint16_t ADC_measures[NB_MESURES][28];

DMA_InitTypeDef DMA_InitStruct;
DMA_InitStruct.DMA_PeripheralBaseAddr = ADC1_DR_ADDRESS;
DMA_InitStruct.DMA_MemoryBaseAddr = (uint32_t) ADC_measures;
DMA_InitStruct.DMA_DIR = DMA_DIR_PeripheralSRC;
DMA_InitStruct.DMA_BufferSize = NB_MESURES * 28;
DMA_InitStruct.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStruct.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStruct.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
DMA_InitStruct.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
DMA_InitStruct.DMA_Mode = DMA_Mode_Circular;
DMA_InitStruct.DMA_Priority = DMA_Priority_High;
DMA_InitStruct.DMA_M2M = DMA_M2M_Disable;
DMA_Init(DMA1_Channel1, &DMA_InitStruct);