cancel
Showing results for 
Search instead for 
Did you mean: 

If I set offset and amplitude with the function generator and input the signal, it doubles and outputs each

jiwon
Associate

STM32G431RB is in use. If you add frequency: 100KHz, offset: 1V, amplitude: 1V as a function generator and proceed with ADC using MATLAB, the signal is output in offset: 2V and amplitude 2V.

 

jiwon_1-1721179252107.pngjiwon_3-1721179351729.png

 

 

 

It's a picture of the function generator parameter settings, and when I ran it, I extracted the graph from the matlab like the picture on the right.
If you look at the ADC, FFT graph, the waveform does not fluctuate at 1V, but it fluctuates at 2V, and even though Vpp = 1V, it fluctuates as if Vpp = 2V.

I don't know the cause, can you tell me?

 

1 REPLY 1
tjaekel
Lead

So, just to understand: you use an external signal generator. You use MATLAB in order to let generate the FW for your MCU, right? The ADC is from the MCU FW (FW generated via Matlab? Or how is Matlab here involved?).
You try to feed a sine signals, 100KHz, with 1Vpp and offset of 1V and you see this as result?

"hmmm", seems to be more a question about "how to setup the signal generator?" (not related to STM32 and MCU).

  • What is the signal generator you use?
  • Is the signal generator set up to generate a "symmetrical" signal (around GND, plus and minus)?
    If your signal generator generates a signal as 1Vpp but as "unbalanced" signal (with only positive amplitudes, GND is reference as value for "lowest sine value)":
    than it is obvious what you get:
    - sine wave, only positive values (referenced as unbalanced to GND), with 1Vpp = 2V swing around 1V zero level, plus 1V offset: results in what you get.
    - it looks to me, the signal generator is set to generate a sine with positive values only (in relation to GND)

I think, your signal generator is not set properly (not generating a signal as + and - around GND = balanced, instead just all as + from GND, unbalanced), not a GND symmetrical signal, instead "GND referenced" for lowest (negative) value).

Check your setup of the signal generator (and make sure your STM32 can take negative voltages as input).