cancel
Showing results for 
Search instead for 
Did you mean: 

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

KHarb.1
Senior

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?

1 ACCEPTED SOLUTION

Accepted Solutions
KHarb.1
Senior

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

View solution in original post

3 REPLIES 3
Imen.D
ST Employee

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!

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

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
Senior

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