cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G431KB DAC DMA not working

PBieg.1
Associate II

Trying to get a basic sample DAC1 with DMA, triggered by TIM2 working.

This should be trivial, works fine on SMT32F3. I'm using a Nucleo-32 SMT32G431.

Using Cube IDE. The only non IDE-generated code in main is:

  /* USER CODE BEGIN 2 */
 
  static uint16_t x[4];
  x[0]= 100;
  x[1]= 1000;
  x[2]= 2000;
  x[3]= 3000;
 
  HAL_TIM_Base_Start_IT(&htim2);
  HAL_DAC_Start_DMA(&hdac1, DAC_CHANNEL_1, (uint32_t*)x, 4, DAC_ALIGN_12B_R);
 
  /* USER CODE END 2 */

IOC configuration:

  • DAC with output buffer (verified, works fine in non-DMA mode)
  • circular DMA buffer, 1/2 word
  • trigger: TIM2 update
  • TIM2: set to count up to 500, internal clock (works, verified by reading the clock)

Compared to some DAC/DMA examples - everything seems fine (and works on a Nucleo-32 SMT32F3. Please help - this is extremely frustrating and has held up a a project for 3 days.

test1.ioc and main.c files attached.

Thank you!

Paul

23 REPLIES 23

FOR the STM32G series: I found out what this was. In the GUI you have to make the word size WORD even though its a 12 bit DAC. Strangely there is no error message if you try to use half word AND when you run the code it simply does not start. Subtle one.

That worked for me i.e. changing Half Word to Word. Thanks!

AVoig.1
Associate II

I am having the same problem with STM32G431KBU6. I think this microcontroller don´t work with DMA, to reach the callbacks, i try a lot of ways and nothing. Really bad.

Please don't hijack old threads - start a new one, describing your HW and SW, expected behaviour and how observed one departs from it, and attach readout values from registers of relevant peripherals.

JW