AnsweredAssumed Answered

Signal generation with dac and DMA problem

Question asked by Oliver Trajkovski on Jul 7, 2018
Latest reply on Jul 9, 2018 by AvaTar

So i am using stm32f469NI processor on discovery development board 

I already generated signals with processor , but that is not good since it doesn't allow for anything else to happen while the signal is being generated .

So i want to use dma .

I have been trying for 2 days now but i can't get it to work.

I can't seem to find good tutorials or documentation and my code is spaghetti.

I found a code snippet that works directly with the registers and not with hal or CubeMx

__HAL_RCC_TIM6_CLK_ENABLE();
__HAL_RCC_DMA1_CLK_ENABLE();
TIM6 -> DIER |= TIM_DIER_UDE;
TIM6 -> PSC = 5;
TIM6 -> ARR = 5;
TIM6 -> CR2 |= TIM_CR2_MMS_1;

DAC1 -> CR = DAC_CR_DMAEN1 | DAC_SR_DMAUDR1 | DAC_CR_TEN1 | DAC_CR_BOFF1;
DAC1 -> CR |= DAC_CR_EN1;

DMA1_Stream7 -> NDTR |= 1024;
DMA1_Stream7 -> PAR = (uint32_t)(DAC -> DHR12R1);
DMA1_Stream7 -> M0AR = (uint32_t)(sinTable);
DMA1_Stream7 -> CR = (DMA_SxCR_TEIE | DMA_SxCR_CHSEL | DMA_SxCR_CIRC | DMA_SxCR_DIR_0 | DMA_SxCR_EN | DMA_SxCR_PSIZE_0 | DMA_SxCR_MSIZE_0 | DMA_SxCR_MINC | DMA_SxCR_PL_0);

TIM6 -> CR1 |= TIM_CR1_CEN;

But it does't work.

Generating the code with CubeMx isn't an option because I have an existing project . 

There are like 50 datasheets for this board , I am confused and frustrated .

Any help is appreciated 

Outcomes