cancel
Showing results for 
Search instead for 
Did you mean: 

DMA DAC Stream works on STM32L476RG but not G431RB

devinw
Associate III

So, I've got a super basic test program which is example page 289 from Dogan Ibrahim's "Nucleo Boards Programming with STM32 Cube IDE" which outputs a wavetable of 21 entries to the onboard DAC using TIM2 and DMA with cirular buffer. It works perfectly fine on a Nucleo-L431RG (outputs a stairstep wave thing as it should), but I get nothing out of the DAC with a Nucleo-G431RB. Any ideas why this would be the case?? DAC without DMA works perfectly fine on the G431RB board, just not DMA.

 

This is the only thing in the original example (which works fine on L431RG) that kicks off the DMA transfer (below).

 

I know the code is good, and I know the MX config is correct between the 2. There must be something different about the DACs on the G series vs L that makes this not work...but what??

 

HAL_DAC_Init(&hdac1);
HAL_TIM_Base_Start(&htim2);
HAL_DAC_Start_DMA(&hdac1, DAC_CHANNEL_1, (uint32_t*)DACValues, Samples, DAC_ALIGN_12B_R);
 
 
3 REPLIES 3
LCE
Principal

Well, check and compare the HAL files for both types.

Go through the functions and registers.

Maybe it's something simple: another GPIO pin / alternate function, another DAC channel, clock not enabled, ...

Read out and check/post content of TIM, DAC, DMAMUX, DMA and relevant GPIO registers.

JW

devinw
Associate III

Well, it can't be anything super simple like GPIO etc because the DAC works perfectly fine without DMA. It just won't do DMA.

 

I just set a breakpoint and started up and it looks like the DMA error callback is getting called and setting to an error code 4:

 

Screenshot 2024-07-12 at 10.10.04 AM.png