2021-12-28 04:53 AM
I configure STM32F767I(G-I)Tx via CubeMX.
I enabled ADC_IN4 and DAC_OUT2 on dual-channel DAC.
ADC_IN4 shares pin with DAC_OUT1. Even though DAC_OUT1 was not enabled in CubeMX I can see it applies voltage on the pin breaking ADC reading,
This can be solved by adding
sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_DISABLE;
HAL_DAC_ConfigChannel(&hdac, &sConfig, DAC_CHANNEL_1);
to MX_DAC_Init().
Which means CubeMX enables DAC channel which was not configured/enabled in GUI.
IMO, it's better to be fixed at CubeMX level than adding user code which disables unused DAC channel.
2022-01-06 06:09 AM
Hello @EHabi.1 ,
Thanks for your feedback,
Which CubeMX version are you using ? and does your code contain the following lines in DAC init when DAC_OUT1 is Disabled in CubeMX GUI ?
sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE;
if (HAL_DAC_ConfigChannel(&hdac, &sConfig, DAC_CHANNEL_1) != HAL_OK)
{
Error_Handler();
}
Thanks,
Sara.
2022-01-08 10:43 PM
Hi Sara,
I'm on CubeMX 6.3.0 and my DAC init does not contain DAC_OUTPUTBUFFER_ENABLE
for channel 1 (I also checked the whole application code). So it looks like if it's not disabled it will be enabled by default.
2022-01-13 05:32 AM
Hello @EHabi.1 ,
I don't think that this issue is related to CubeMX, there is no lead in the generated code nor in the graphical user interface that points to this issue so I am adding @Imen DAHMEN to the loop for review and provide a status update about this issue.
Sara.