Skip to main content
KHarb.1
Senior
April 4, 2024
Solved

I migrated from STM32F373 to STM32G473, and it has a major noise tone on a static DAC value

  • April 4, 2024
  • 2 replies
  • 956 views

I'm using CubeMX. With the new unit, I had to set ENVR and clear HIZ in VREFBUF_CSR in user code in order to use the internal reference.  In this config, I can see the output value change DC level, but with a 700khz noise tone on it that amplifies along with the DC level. It reaches 1v peak to peak when the DAC is outputting the max value.

Are there settings that could end up causing this behavior?

Best answer by KHarb.1

This was isolated a raft of issues, but primarily to improper configuration of voltage references within CubeIDE.

2 replies

Technical Moderator
April 4, 2024

Hello @KHarb.1 ;

Several points should be checked: the trigger source, DAC configuration, clock source.

Is the DAC output buffer enabled?

I advise you to check the following application note which describes the main DAC features and differences on the STM32G4 Series versus the STM32F3 Series devices:

  •  AN5310 Guideline for using analog features of STM32G4 Series versus STM32F3 Series devices:

You can check the configuration in the DAC example provided for STM32CubeG4 MCU package: 

STM32CubeG4/Projects/NUCLEO-G474RE/Examples/DAC/DAC_SignalsGeneration2 at master · STMicroelectronics/STM32CubeG4 · GitHub

Hope this can help you!

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
KHarb.1
KHarb.1Author
Senior
April 4, 2024

No triggering. No DMA.  I'm only trying to output a stable DC voltage.  I found that if I disable the output buffer, the 700khz noise tone is reduced to about 0.1V peak to peak. Any idea what might cause this behavior change?

I see now the noise tone is a fairly well formed triangle wave. I checked to see if the triangle wave feature was defaulted on for some reason and it wasn't. However, as a check, I tried to activate the triangle wave feature and I couldn't. I changed MAMP and WAVEx values and toggled the EN bit and nothing happened.  Is this the right process? 

...if so, it seems like my problem is a misbehaving triangle wave feature.

I attached the IOC file. Below is the user code for VREFBUF and DAC1.

 

//Set VREFBUF to use the internal source. ENVR=1, HIZ=0;
VREFBUF->CSR|=0b01;
VREFBUF->CSR&=0b11101;

//DAC init
uint8_t tx[] ={0};
if (HAL_DAC_Start(&hdac1,DAC_CHANNEL_2)!= HAL_OK){
tx[0]='A';
HAL_UART_Transmit(&huart1,tx,1,1000);
}
else{
tx[0]='B';
HAL_UART_Transmit(&huart1,tx,1,1000);
}

DAC1->DHR12R2 = 0xFFF;

KHarb.1
KHarb.1AuthorBest answer
Senior
June 21, 2024

This was isolated a raft of issues, but primarily to improper configuration of voltage references within CubeIDE.