cancel
Showing results for 
Search instead for 
Did you mean: 

Voltage with DACs unstable

FTrom
Associate II

I'm using the DACs of STM32F303K8.

The max voltage of the DAC1 is 3.3V but the second is 3V.

I don't find any explanation for it and it looks like also quite strange.

PS. To my nucleo is not. Connected to any Vref. It is necessary?

Anyone can help me?

This discussion is locked. Please start a new topic to ask your question.
18 REPLIES 18
Peter BENSCH
ST Employee

What is your DAC configuration (with/without buffer), what load is connected to the DACs?

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
FTrom
Associate II

Hi Peter

In the file .ioc the DAC2 (connected to PA6 ) is OUT1 Configuration "DAC Output switch Enable".

In the DAC1 (connected to PA4) the OUT2 Configuration is Disable.

Following the initialization in the program:

static void MX_DAC1_Init(void)
 
{
 
 
 
 /* USER CODE BEGIN DAC1_Init 0 */
 
 
 
 /* USER CODE END DAC1_Init 0 */
 
 
 
 DAC_ChannelConfTypeDef sConfig = {0};
 
 
 
 /* USER CODE BEGIN DAC1_Init 1 */
 
 
 
 /* USER CODE END DAC1_Init 1 */
 
 /** DAC Initialization
 
 */
 
 hdac1.Instance = DAC1;
 
 if (HAL_DAC_Init(&hdac1) != HAL_OK)
 
 {
 
  Error_Handler();
 
 }
 
 /** DAC channel OUT1 config
 
 */
 
 sConfig.DAC_Trigger = DAC_TRIGGER_NONE;
 
 sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE;
 
 if (HAL_DAC_ConfigChannel(&hdac1, &sConfig, DAC_CHANNEL_1) != HAL_OK)
 
 {
 
  Error_Handler();
 
 }
 
 /* USER CODE BEGIN DAC1_Init 2 */
 
 
 
 /* USER CODE END DAC1_Init 2 */
 
 
 
}

static void MX_DAC2_Init(void)
{
 
  /* USER CODE BEGIN DAC2_Init 0 */
 
  /* USER CODE END DAC2_Init 0 */
 
  DAC_ChannelConfTypeDef sConfig = {0};
 
  /* USER CODE BEGIN DAC2_Init 1 */
 
  /* USER CODE END DAC2_Init 1 */
  /** DAC Initialization
  */
  hdac2.Instance = DAC2;
  if (HAL_DAC_Init(&hdac2) != HAL_OK)
  {
    Error_Handler();
  }
  /** DAC channel OUT1 config
  */
  sConfig.DAC_Trigger = DAC_TRIGGER_NONE;
  sConfig.DAC_OutputSwitch = DAC_OUTPUTSWITCH_ENABLE;
  if (HAL_DAC_ConfigChannel(&hdac2, &sConfig, DAC_CHANNEL_1) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN DAC2_Init 2 */
 
  /* USER CODE END DAC2_Init 2 */
 
}

So the configuration looks identical.

What about my 2nd question: what load is connected to the DACs?

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

it is a high impedance of the ADC input of a Motor Driver. Each DAC drives with an analog signal the motor drivers. But the motor driver are identical.

PS I don't use any Vref so far.

Hmm, I missed something: DAC1_OUT1 is buffered and DAC2_OUT1 is unbuffered, which in connection with the following load could explain the voltage drop. How many systems does the problem occur on?

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Peter,

"DAC1_OUT1 is buffered and DAC2_OUT1 is unbuffered": maybe but usually there is a voltage drop either when there is a low resistance or the power supply is not enough, which is not my case because I use an external power supply of 5V and circa 1 A.

sorry but I don't get your question: "How many systems does the problem occur on?"

What do you mean for system?

Thanks in advance

Fausto

S.Ma
Principal

Cut the dac outputs and measure. In debug mode, manually inspect the Dac registers too. Then continue digging.

FTrom
Associate II

I did some deep measures and are not nice:

without any External Power supply of 5V but only the USB and the DACs without any load.

DAC1 is good: at 0 digits the voltage I measure 0 V, at 4095 digits I measure 3.287 V.

DAC2 not good: at 0 digits the voltage I measure 0.1 V, at 4095 digits I measure 3.6 V.

with External Power supply supply of 5V and the DACs without any load

DAC1 is good: at 0 digits the voltage I measure 0 V, at 4095 digits I measure 3.288 V.

DAC2 not good: at 0 digits the voltage I measure 0.610 V, at 4095 digits I measure 3.6 V.

Maybe I forgot to say: I'm using a Nucleo STM32F303K8

Thanks

Fausto

waclawek.jan
Super User

Have you disconnected all onboard connections to the DAC pin (maybe SB16)?

JW