-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
So it seems that calls to the DAC take quite a bit of time so I would like to implement DMA transfers.
I tried my hand to use your DMA library but I cant seem to get it to fire. My code will complile but nothing happens :/
DMA feeding DAC code:
#include "stm32l4_dma.h"
stm32l4_dma_t stm32l4_DAC_DMA;
static int DACresolution = 12;
uint32_t i;
uint32_t DAC_DMA_OPTION = DMA_OPTION_MEMORY_TO_PERIPHERAL |
DMA_OPTION_PERIPHERAL_DATA_SIZE_32 |
DMA_OPTION_MEMORY_DATA_SIZE_32 |
DMA_OPTION_MEMORY_DATA_INCREMENT |
DMA_OPTION_PRIORITY_MEDIUM ;
void setup() {
Serial.begin(9600);
while (!Serial) {}
analogWriteResolution(DACresolution);
analogWrite(PIN_DAC0, i);
analogWrite(PIN_DAC1, i);
DAC->CR = (uint32_t) DAC->CR | 0x3000; //enable DAC DMA and underrun
stm32l4_dma_create(&stm32l4_DAC_DMA, DMA_CHANNEL_DMA1_CH3_DAC1, DMA_OPTION_PRIORITY_LOW);
stm32l4_dma_enable(&stm32l4_DAC_DMA, NULL, NULL);
}
void loop() {
i = (i + 64) & DAC_DHR12R1_DACC1DHR;
stm32l4_dma_start(&stm32l4_DAC_DMA, (uint32_t)&DAC->DHR12R1,(uint32_t)i, 1, DAC_DMA_OPTION); //This should trigger a DMA trandfer to the DAC->DHR12R1 register.
}
Metadata
Metadata
Assignees
Labels
No labels