cancel
Showing results for 
Search instead for 
Did you mean: 

Strange DAC behaviour on STM32H743VIT6 Hi to community! I have a strange problem with DAC. Whatever settings (buffer on/off, dma mode, data format or allignment, speed, etc) i am not getting simple output results that are expected. Thanks in advance!

Mixer
Associate II

Code is too simple, else is initiated by CubeMx, using latest CubeIde. Board is DevEBox.

#define buf_size 512

uint16_t data[buf_size]={};

for(uint8_t i=0;i<(buf_size/4);i++)data[i]=4095;

HAL_TIM_Base_Start(&htim6);

HAL_DAC_Start_DMA(&hdac1, DAC_CHANNEL_1, (uint32_t*)data, (uint32_t)buf_size, DAC_ALIGN_12B_R);

Whatever data is in the buffer, whenever it's byte or 12 bits, output doesn't have any meaningful value. Included are pictures of output and setup.

VREF+,VSSA and VDDA are all connected to same supply as stm32.

1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Principal III

Shouldn't the DMA be half word --> half word here?

hth

KnarfB

View solution in original post

4 REPLIES 4
KnarfB
Principal III

Shouldn't the DMA be half word --> half word here?

hth

KnarfB

Mixer
Associate II

YES, yes it should be!

Thank you very much KnarfB !

Completely overlooked that mistake... Now works perfectly with multiple waveform shapes!

Thanks again!

MM..1
Chief III

I dont understand your question. First scope image seems perfectly filled your array /4 of uint16

but play call in DMA Start buffsize is in bytes i mean then used is only half buff and result is your scoped signal.

Scope is showing half of data in "high" state, although if you take a look, that high level of signal is having square wave inside it that has wanted resolution from timer.

As KnarfB pointed out, mistake was in setting up the DMA transfer, it should be Half Word to Half word.

Included is the right output from DAC when there is only /4 of buffer in 0xFFF (4095) or 12bit high state.0693W00000JNoEKQA1.jpg