cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F303k8 DMA Underrun on channel3 to DAC

Matthew Philyaw
Associate
Posted on August 30, 2017 at 06:19

I'm using a

http://www.st.com/en/evaluation-tools/nucleo-f303k8.html

 board, and trying to get a LL dac example running that was targeting the STM32F334R8-Nucleo board that was provided in the STM32Cube_FW_F3_V1.9.0. It's the STM32Cube_FW_F3_V1.9.0/Projects/STM32F334R8-Nucleo/Examples_LL/DAC/DAC_GenerateWaveform_TriggerHW project that I'm working with. 

Here is a

https://gist.github.com/matthewphilyaw/e4fa418e6ebc43b76414e9d61b6841d2

to a github gist with the important files with my code specifically - I did take out the user buttons in my case so that it just starts the conversions etc. My issue is that I get no dac output on PA4, which is A3 on the smaller nucleo board and instead the DAC under run interrupt fires and starts to blink the led. The code sets up DAC1 CH1 to be triggered by TIM 6, and to use DMA1 Channel 3 to transfer from the buffer to the dac. I believe in this setup the DAC issues the DMA request when TIM6 triggers the conversion.

I have debugged through the code, checked the registers, which seem fine. I have enabled the timer 6 update event and handled it to ensure the timer was indeed firing which it seems to be doing at about 16Khz. I even removed samples from the sinewave buffer so that the timer was running at a lower 1Khz to see if it would at least output something.

I at one point enabled the DMA TC, and HT interrupts to see if I get a transfer complete or a half transfer which would turn on LED (also set break points here, and looked at it on a scope in case it was a fast toggle) none of those seem to fire, nor does it ever trigger a DMA error interrupt. 

When debugging I check the DOR1 register for DAC1 one and it never changes, and the under run seems to happen on the first request, but I can't reliable detect that, other than there is never any output from the DAC.

The only registers I couldn't probe to check seem to be the SYSCFG->CFGR1 register it reports all zeros in the debugger (using the SystemWork bench IDE for STM 32, and using open ocd). I'm pretty sure this a bad read, or protected or something. So the only thing I can't verify is the DMA remap of DAC Ch1 to DMA1 Channel 3. The data sheet for the processor says this must always be set to 1 as there is no DMA2.

Just to ensure DAC1 Ch1 was working on PA 4, I did set it up for software trigger and manually triggered conversion and the DAC DID output on the pin. So it feels like I have something setup wrong in the DMA config, or timer one. TImer seems to be in order and all of this is basically the provided example for the STMF334 board, so I'm not sure why the under run is happening. 

Any thoughts?

#stm32-f3 #dma #channel3 #underrun #dac1
0 REPLIES 0