AnsweredAssumed Answered

STM32F446 DAC won't drive to zero

Question asked by Snyder.Joe.001 on Dec 7, 2015
Latest reply on May 23, 2017 by AvaTar
I have the DAC output of my STM32F44 feeding into a non-inverting op amp.  Everything is working, but not real great.  The problem is at the lower end, and gets worse the closer you get to zero. 

For instance, my AVREF is 3.00V.  If I write 4095 to the DAC, I get 3.00V out.  If I write zero to the DAC, I'm seeing about 80mV.  The problem seems to be linear - writing 2048 gives about 1.69V (about .04 above the expected 50% level).

I disconnected the op amp portion because I thought it might be interfering.  With the DAC pin floating, I see the same issue.  I tied it to ground through a 10K, and same issue.

I can account for the non-linearity in code, but not being able to drive to zero is a problem.  I can't find anything in the data sheet or reference manual about it being non-linear. 

The CubeMX DAC code is:

/* DAC init function */
void MX_DAC_Init(void)
  DAC_ChannelConfTypeDef sConfig;
    /**DAC Initialization
  hdac.Instance = DAC;
    /**DAC channel OUT1 config
  sConfig.DAC_Trigger = DAC_TRIGGER_NONE;
  HAL_DAC_ConfigChannel(&hdac, &sConfig, DAC_CHANNEL_1);
    /**DAC channel OUT2 config
  HAL_DAC_ConfigChannel(&hdac, &sConfig, DAC_CHANNEL_2);

Then I'm calling it using:

HAL_DAC_SetValue(&hdac, DAC_CHANNEL_1, DAC_ALIGN_12B_R, 0x0);
HAL_DAC_Start(&hdac, DAC_CHANNEL_1);