cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H563VIT6 DAC1 Output Unexpected

mccabehm
Associate III

Driving DAC1 channel 1 with

 

 

 

 

HAL_DAC_Start(&hdac1, DAC_CHANNEL_1);
...
while (1) {
  HAL_DAC_SetValue(&hdac1, DAC_CHANNEL_1, DAC_ALIGN_12B_R, 4095UL);
  HAL_Delay(100UL);
  HAL_DAC_SetValue(&hdac1, DAC_CHANNEL_1, DAC_ALIGN_12B_R, 0UL);
  HAL_Delay(100UL);
}

 

 

 

 

to generate 5 Hz, 50% duty cycle, 0 - 2.5v. Amplitude as expected but frequency varies from 1 - 4s and duty cycle varies from 20 - 80%: not expected. DAC1 configured like

mccabehm_1-1738710940044.png

DAC1 clocked at 65 MHz. When I step into HAL_DAC_SetValue() I see where the 0 - 4095 value is written to data register (12-bit, right-aligned). But sometimes after writing 4095 the output pin reads zero; and sometimes after writing zero the output pin reads 2.5v. I can't explain why this happens. DAC Instance following write looks like

mccabehm_2-1738711213554.png

I am the only writer on the data register.

0 REPLIES 0