cancel
Showing results for 
Search instead for 
Did you mean: 

DMA Stream Handler

officialkesh
Associate III
Posted on May 29, 2015 at 12:46

I am novice to ST family. I have added DMA1_Stream5 Handler in keil example. When I put breakpoint over there ,it is not executing .

Here is my code .

int main(void)

{

              GPIO_InitTypeDef GPIO_InitStructure;

              NVIC_InitTypeDef dmaNvic;

              GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13;

              GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

              GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

             

GPIO_Init(GPIOD, &GPIO_InitStructure);      

    /* Enable DMA Half & Complete interrupts */

    DMA_ITConfig(DMA1_Stream5, DMA_IT_TC | DMA_IT_HT, ENABLE);

    /* Enable the DMA Stream IRQ Channel */

    dmaNvic.NVIC_IRQChannel = DMA1_Stream5_IRQn;

    dmaNvic.NVIC_IRQChannelPreemptionPriority = 0;

    dmaNvic.NVIC_IRQChannelSubPriority = 1;

    dmaNvic.NVIC_IRQChannelCmd = ENABLE;

    NVIC_Init(&dmaNvic);

  /* DMA1 clock and GPIOA clock enable (to be used with DAC) */

  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1 | RCC_AHB1Periph_GPIOA, ENABLE);

  /* DAC Periph clock enable */

  RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);

  /* DAC channel 1 & 2 (DAC_OUT1 = PA.4)(DAC_OUT2 = PA.5) configuration */

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;

  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

  GPIO_Init(GPIOA, &GPIO_InitStructure);

  /* TIM6 Configuration ------------------------------------------------------*/

  TIM6_Config();  

 

  /* Configures User Button */

  STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_EXTI);

 

  while (1)

  {  

      DAC_DeInit();

      /* Escalator Wave generator ------------------------------------------*/

      DAC_Ch1_EscalatorConfig();

      /* Sine Wave generator -----------------------------------------------*/

      DAC_Ch2_SineWaveConfig();  

}

}

void DMA1_Stream5_IRQHandler()

{

    /* The DMA buffer is half empty. Fill 'er up! */

    if(DMA_GetITStatus(DMA1_Stream5, DMA_IT_HTIF5) != RESET)

    {

        GPIO_SetBits(GPIOD, GPIO_Pin_12);

        DMA_ClearITPendingBit(DMA1_Stream5, DMA_IT_HTIF5);

    }

    /* The DMA buffer's second half is empty. Top up! */

    if(DMA_GetITStatus(DMA1_Stream5, DMA_IT_TCIF5) != RESET)

    {

        GPIO_SetBits(GPIOD, GPIO_Pin_13);

        DMA_ClearITPendingBit(DMA1_Stream5, DMA_IT_TCIF5);

    }

}

Thanks in Advance,

- Pinkesh

#dac-+-dma
2 REPLIES 2
Posted on May 29, 2015 at 14:29

Nothing in your presented code drives any DMA requests or configures the DMA.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
officialkesh
Associate III