2022-01-29 03:29 AM
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.
Solved! Go to Solution.
2022-01-29 03:44 AM
2022-01-29 03:44 AM
Shouldn't the DMA be half word --> half word here?
hth
KnarfB
2022-01-29 03:52 AM
YES, yes it should be!
Thank you very much KnarfB !
Completely overlooked that mistake... Now works perfectly with multiple waveform shapes!
Thanks again!
2022-01-29 04:01 AM
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.
2022-01-29 04:13 AM
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.