AnsweredAssumed Answered

input capture _ DMA request

Question asked by IN on Aug 25, 2015
Latest reply on Aug 27, 2015 by IN
Hi,
Please i have to capture an input signal  and read it's frequency value with a DMA request but i can't find any ressources.
I know the other solution with interreupt but i insist on this method with DMA, i need it.
i did the configuration required but the buffer of destination shows always value=0 !
here is my code:

uint32_t TIM1CapturedValue_u32[2];


void CaptureDMA(void)
{
  DMA_DeInit(DMA1_Channel2);                                            //    Time1_ch1<-->DMA1_ch2          
  
  DMA_InitStructure.DMA_PeripheralBaseAddr = TIM_DMABase_CCR1;          //    Time1-->CCR1        
  DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)TIM1CapturedValue_u32[0];
  DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
  DMA_InitStructure.DMA_BufferSize =2;
  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
  DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;                       
  DMA_InitStructure.DMA_Priority = DMA_Priority_High;
  DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
  
  DMA_Init(DMA1_Channel2, &DMA_InitStructure);
  
  //Enable DMA1 channel2 
  DMA_Cmd(DMA1_Channel2, ENABLE);  
  
  
   TIM_TimeBaseStructure.TIM_Prescaler = 0; // Counter Clk = 72M
   TIM_TimeBaseStructure.TIM_Period = 0XFFFF;
   TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
   TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure);
    
   TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising;
   TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI;
   TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1; 
   TIM_ICInitStructure.TIM_ICFilter = 0x00;
   TIM_ICInitStructure.TIM_Channel = TIM_Channel_1; 
   TIM_ICInit(TIM1, &TIM_ICInitStructure); 
    
   /* Enable the TIMER CAPTURE DMA requests */
     TIM_SelectCCDMA(TIM1, ENABLE);
     TIM_DMACmd(TIM1, TIM_DMA_CC1, ENABLE);   
    
    // TIM1 enable counter 
    TIM_Cmd(TIM1,ENABLE); 
}

Outcomes