AnsweredAssumed Answered

DMA issue - transfer error flag TEIF

Question asked by ml.michal on Aug 7, 2013
Latest reply on Apr 23, 2018 by Clive One
Hi all,

i'm having issue with DMA on STM32F417, i have configuration DMA1_Stream1 is having trigger updates from TIM6_UP (Channel7),
i get after start TIM6 error TEIF1 :-(

my source code was functional with configuration:
DMA2_Stream1 Channel7 + TIM8_UP :-(

please could you review my sources: ?

#define ADC_READ_DMA_TIM_UP TIM6
#define ADC_READ_DMA DMA1_Stream1

static __IO uint8_t ADC_Buffer1[20002];

RCC_APB1PeriphClockCmd( RCC_APB1Periph_TIM6, ENABLE);
RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_DMA1, ENABLE);

TIM_Cmd( ADC_READ_DMA_TIM_UP, DISABLE);
DMA_DeInit( ADC_READ_DMA );

DMA_InitTypeDef DMA_InitStructure;

DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;

DMA_InitStructure.DMA_Channel = DMA_Channel_7;
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)(&GPIOE->IDR)+0;
DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)ADC_Buffer1;

DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
DMA_InitStructure.DMA_BufferSize = 20000;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_High; // VeryHigh
DMA_Init(ADC_READ_DMA, &DMA_InitStructure);

TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
TIM_TimeBaseStructure.TIM_Period=9;
TIM_TimeBaseStructure.TIM_Prescaler = 0x0000;
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInit( ADC_READ_DMA_TIM_UP, &TIM_TimeBaseStructure);

TIM_UpdateRequestConfig( ADC_READ_DMA_TIM_UP, TIM_UpdateSource_Regular );
TIM_DMACmd( ADC_READ_DMA_TIM_UP, TIM_DMA_Update, ENABLE);

DMA_ITConfig( ADC_READ_DMA, DMA_IT_TC, ENABLE);

DMA_Cmd( ADC_READ_DMA, ENABLE);
DMA_ClearFlag( ADC_READ_DMA, DMA_FLAG_TCIF1 | DMA_FLAG_TEIF1 );

USARTdebug_puthex_32bit( DMA1->LISR );

TIM_Cmd( ADC_READ_DMA_TIM_UP, ENABLE);
Delay(0xaff);

USARTdebug_puthex_32bit( DMA1->LISR );
USARTdebug_puthex_32bit( DMA_GetCurrDataCounter(ADC_READ_DMA) );

output is:
00000000 00000200 00004e1f

Thanks for all replies,
Kind regards,

Outcomes