2025-02-17 05:30 PM - edited 2025-02-17 05:58 PM
Hi guys:
My project DAC setting as below:
And my project that initial and code as below, it's works on EVM board (STM32G474RETX), but now works on STM32G474MCT3TR, does anyone encounter this situation?
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_HighFrequency = DAC_HIGH_FREQUENCY_INTERFACE_MODE_AUTOMATIC;
sConfig.DAC_DMADoubleDataMode = DISABLE;
sConfig.DAC_SignedFormat = DISABLE;
sConfig.DAC_SampleAndHold = DAC_SAMPLEANDHOLD_DISABLE;
sConfig.DAC_Trigger = DAC_TRIGGER_NONE;
sConfig.DAC_Trigger2 = DAC_TRIGGER_NONE;
sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE;
sConfig.DAC_ConnectOnChipPeripheral = DAC_CHIPCONNECT_EXTERNAL;
sConfig.DAC_UserTrimming = DAC_TRIMMING_FACTORY;
if (HAL_DAC_ConfigChannel(&hdac1, &sConfig, DAC_CHANNEL_1) != HAL_OK)
{
Error_Handler();
}
/** DAC channel OUT2 config
*/
if (HAL_DAC_ConfigChannel(&hdac1, &sConfig, DAC_CHANNEL_2) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN DAC1_Init 2 */
/* USER CODE END DAC1_Init 2 */
}
uint16_t dac_value=2048;
HAL_DAC_Start(&hdac1, DAC_CHANNEL_1);
HAL_DAC_SetValue(&hdac1, DAC_CHANNEL_1, DAC_ALIGN_12B_R, dac_value);
HAL_DAC_Start(&hdac1, DAC_CHANNEL_2);
HAL_DAC_SetValue(&hdac1, DAC_CHANNEL_2, DAC_ALIGN_12B_R, dac_value);
Thanks a lot
Tony
Solved! Go to Solution.
2025-02-18 09:49 PM
Hi JW:
I change the another PCB Board and it's can DAC output normally.
I think that is hardware issue.
Thanks for your help!
Tony
2025-02-18 01:49 AM
> it's works on EVM board (STM32G474RETX), but now works on STM32G474MCT3TR
So, where's the problem, and what are its exact symptoms?
How is reference (VREF+ pin) set up and what voltage do you measure there?
How are the DAC pins connected? Do you take into consideration their limited output current?
Read out and check/post content of DAC and relevant GPIO registers.
JW
2025-02-18 04:27 AM
The symptoms is that I can't control the DAC output 1.65v for the STM32G474MCT3TR MCU, I measure the VREF = 3.3v, VDDA also 3.3v, but still no DAC output 1.65v. I measure the DAC output by contact the STM32G474MCT3TR MCU' pin PA4 & PA5. Finally I check the DAC registers also correct too.
Is another possible problem of the STM32G474MCT3TR MCU setting or limitation? Clock? (Now system clock is 170MHz for DAC)
Thanks a lot
Tony
2025-02-18 05:54 AM
> Finally I check the DAC registers also correct too
Show. And show also relevant GPIO registers content.
JW
2025-02-18 09:49 PM
Hi JW:
I change the another PCB Board and it's can DAC output normally.
I think that is hardware issue.
Thanks for your help!
Tony