2015-05-29 03:46 AM
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-+-dma2015-05-29 05:29 AM
Nothing in your presented code drives any DMA requests or configures the DMA.
2015-06-09 04:08 AM
I have attached the file . Please go through it.
DMA has been configured in DAC_Ch2_SinewaveConfig() function . Thanks in Advance ________________ Attachments : main.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I192&d=%2Fa%2F0X0000000bke%2Fxwm7oCafZT5eo61FrzUYCqBe3nUMC0zeumeLqkzyNDY&asPdf=falsestm32f4xx_it.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I1Ak&d=%2Fa%2F0X0000000bkf%2FTRrFy003e85XcDov6z30f0tgPyaUcCJXBFjf.mLn8n8&asPdf=false