STM32F303CBT6 DAC not working with DMA
Dear all,
I'm trying to generate a waveform using DAC OUT1.
I configured pin PA4 as analog (works)
I configured DAC1 without DMA and it works
I configured TIM6 and it works
Then I configured DAC with DMA, configured DMA, but output never changes.
Where can I check?
I enclose the minimun configuration code:
/* DAC Configuration */
if(!(RCC->APB1ENR & RCC_APB1ENR_DAC1EN)) RCC->APB1ENR |= RCC_APB1ENR_DAC1EN; // Enable DAC clock
DAC1->CR |= DAC_CR_DMAEN1 | DAC_CR_MAMP1_3 | DAC_CR_EN1; // DMA1 enable | Amplitude 511 |Wave generation disabled | Timer6 TRGO event | Trigger enable | Buffer enable | DAC1_OUT1 enable
/* DAC Timer */
if(!(RCC->APB1ENR & RCC_APB1ENR_TIM6EN)) RCC->APB1ENR |= RCC_APB1ENR_TIM6EN; // Enable TIM6 clock
TIM6->CR2 |= TIM_CR2_MMS_2; // The update event is selected as a trigger output (TRGO).
TIM6->DIER |= TIM_DIER_UIE | TIM_DIER_UDE; //Enable interrupt | Enable DMA request
TIM6->EGR = TIM_EGR_UG; // Re-initializes the timer counter and generates an update of the registers
TIM6->CR1 |= TIM_CR1_CEN; // Enable TIM6
/* DAC DMA */
if(!(RCC->AHBENR & RCC_AHBENR_DMA1EN)) RCC->AHBENR |= RCC_AHBENR_DMA1EN; // Enable DMA1 clock
SYSCFG->CFGR1 |= SYSCFG_CFGR1_TIM6DAC1Ch1_DMA_RMP;
DMA1_Channel3->CCR |= DMA_CCR_PL_0 | DMA_CCR_MSIZE_0 | DMA_CCR_PSIZE_0 | DMA_CCR_MINC | DMA_CCR_CIRC | DMA_CCR_DIR | DMA_CCR_TCIE; // Medium priority | size 16 bit both mem and periph | mem increment | circular | mem to periph | Transfer complete interrupt
DMA1_Channel3->CNDTR = 100; // Data to be transfered
DMA1_Channel3->CPAR = (uint32_t) &(DAC1->DHR12R1); // Peripheral address
DMA1_Channel3->CMAR = (uint32_t) &sen[0]; // Memory address
DMA1_Channel3->CCR |= DMA_CCR_EN; // Enable DMA
Both TIM6_DAC_IRQn and DMA1_Channel3_IRQn are enabled.
I tried to find also some examples or AN documents, but I faild.
Any hint would be appreciated.
Thank you
Freya
