2025-06-30 1:27 PM
I've been working on this for a few days now, I can't seem to get the DAC to work with the DMA. I can get the DMA to work with ADC easily, I can use the DAC without DMA easily, but the DAC doesn't feel like working with the DMA. I set up the DMA to work with the DAC channel 1 using DMA1 channel 3. I set up the interrupt to be timer 6. My code for setting things up is
HAL_TIM_Base_Start(&htim6);
HAL_DAC_Start_DMA(&hdac1, DAC_CHANNEL_1, (uint32_t*) &dma_buffer, 2*DMA_BUFFER_SIZE, DAC_ALIGN_12B_R);
This code is put outside of the while loop in the main function. I also checked for error codes using
uint32_t result = HAL_DAC_GetError(&hdac1);
and
uint32_t result = HAL_DMA_GetError(&hdma_dac_ch1);
which both returned 0 in the result when debugging. I put an incrementing variable in the half and full
complete callbacks for debugging as well, and these interrupts appear to never fire because the variables
never increment. I followed a guide on setting up the DMA with DAC very carefully so
my lack of knowledge would be out of the question but still it doesn't work. I know the DAC and
DMA both work so why would they not work together?