cancel
Showing results for 
Search instead for 
Did you mean: 

Problem using DAC with DMA

FRDUPING
Associate II

Hi,

I'm writing a post because I have a problem with the utilization of my DAC on my STM32F410RB.

I'm using the DAC with the DMA to not surcharge the CPU but it seems not working every time.

In fact when I'm triggering the DAC at high frequency 6 MHz for example, the signal is correctly generated but the rest of my code is unexecuted.

If I trigger the DAC with a low frequency like 730 kHz for example, the rest of my code is correctly executed.

int main(void)
{
  HAL_Init();
  SystemClock_Config();
 
  MX_GPIO_Init();
  MX_USART2_UART_Init();
  MX_TIM5_Init();
  MX_DMA_Init();
  MX_DAC_Init();
 
  HAL_DAC_Start_DMA(&hdac, DAC_CHANNEL_1, (uint32_t*)LUT_Sine, 8, DAC_ALIGN_12B_R);
  HAL_TIM_Base_Start_IT(&htim5);
 
  while (1)
  {
	  if(HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_13) == GPIO_PIN_RESET){
		  GPIOA->ODR ^= GPIO_PIN_6;
		  HAL_Delay(1000);
	  }
  }
}

I don't understand why this happening and how to resolve it ...

Thanks, if you can help me.

(Sorry for my bad english)

4 REPLIES 4
Piranha
Chief II

Most likely you are using DMA TC/HT interrupts and those are consuming all of the CPU time.

S.Ma
Principal

Make the timer as physical output pin, then connect to dac physical input pin to monitor what is happening, and even replace timer with square wave generator. Max out your cpu speed and if the selected parr has it, use different memory bank for code data and dma. If it has ccm ram memory, that one is only for core to reduce congestion.

Hi,

Thanks for your answer:

As you can see, I'm using HAL functions so I have no ideas if DMA TC/HT interrupts are used.

If you thinks it's the case, how can I do without ?

Hi,

Thanks for your answer:

I have show the timer and it is correct.

I have max my CPU speed to 100 MHz, but the problem is here again. It just appears in higher frequencies ...

My STM don't have a CCM RAM memory

.