2021-08-25 4:44 AM
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?
2021-08-25 5:06 AM
What is your DAC configuration (with/without buffer), what load is connected to the DACs?
Regards
/Peter
2021-08-25 5:46 AM
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 */
}
2021-08-25 6:20 AM
So the configuration looks identical.
What about my 2nd question: what load is connected to the DACs?
Regards
/Peter
2021-08-25 6:28 AM
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.
2021-08-25 6:47 AM
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
2021-09-04 11:52 AM
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
2021-09-04 6:53 PM
Cut the dac outputs and measure. In debug mode, manually inspect the Dac registers too. Then continue digging.
2021-09-09 12:51 AM
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
2021-09-09 1:36 AM
Have you disconnected all onboard connections to the DAC pin (maybe SB16)?
JW