AnsweredAssumed Answered

Is there anaybody that have a TIM triggered DMA working Code?

Question asked by Femol on Dec 1, 2014
Latest reply on Dec 17, 2014 by Femol
I'm stuck on TIM triggered DMA to SPI.
My DMA Code configuration is as follow:
void DMA_Configuration(void)
 {
     DMA_InitTypeDef               DMA_InitStructure;
    
     /* Enable DMA1 clock */
   RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
    
     /* Blank DMA Configuration */
     DMA_DeInit(DMA1_Channel1);      
    
     /* Using the default values at Startup */
     DMA_StructInit(&DMA_InitStructure);            

   /*Changes from the default values */    
     DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)(SPI2->DR);            // Address of peripheral the DMA must map to => SPI2 Data Register
   DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t) TTxBuffer;                // Variable to which received data will be stored
     DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;                           // Direction of transfer Memory to Peripheral =Destinatary
   DMA_InitStructure.DMA_BufferSize = 32;                                       // BufferSize
   DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;             // We don't want to change the SPI2 Data register
   DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;                      // We increment Memory
   DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;      // We define Peripheral Data Size as Byte
   DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;              // We define Memory Data Size as Byte
   DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;                              // Circular Mode define
   DMA_InitStructure.DMA_Priority = DMA_Priority_High;                          // High Priority
   DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;                                 // Memory to Memory Disable
    
      /* Initialize the DMA */
     DMA_Init(DMA1_Channel1, &DMA_InitStructure);           
    
     /* Enable the DMA transfer half and complete interrupt */
     DMA_ITConfig(DMA1_Channel1, DMA_IT_HT, ENABLE);                               // Half Transfer Interrupt Enable
   DMA_ITConfig(DMA1_Channel1, DMA_IT_TC, ENABLE);                                 // Full transfer Interrupt Enable
    
     /* Enable the DMA TIM Triggered */
     TIM_DMACmd(TIM2, TIM_DMA_Trigger, ENABLE);
     TIM_DMACmd(TIM2, TIM_DMA_Update, ENABLE);
    
     /* Enable DMA1 Channel1 */
     DMA_Cmd(DMA1_Channel1, ENABLE);

 }
Looking at DMA_CCR1 gives me 0x2AB7 which is ok.
Looking at the SPI2_DR I found no value ; i.e. 0

Franck

Outcomes