cancel
Showing results for 
Search instead for 
Did you mean: 

When giving a Comparator a continuous signal and a sine (or sawtooth) the output isn't a clean PWM

JLaba.1
Associate II

Hello,

I am trying to use a NUCLEO - STM32G474RE to dirve a buck converter in current mode. For this I need to use a comparator, and when I test it the outcome isn't what I expected.

To verify its normal behaviour, I chose Vref/2 as INM and I plugged a sine generator on INP. Hence, as I enabled an external output, I expected to see a PWM with a duty cycle of approximately 50% but instead I got the following oscillogram.

0693W00000Ba1C4QAJ.pngThe input is in yellow, the output of the comparator is green and the theoritical value of the ither input of the comparator is the dotted blue line.

I precise that the comp is configured as follow :

No trigger mode

No Hysteresis

No blanking source

Output is inverted

Maximum output speed of the pin : very fast.

The output of the comparator doesn't depend on the frequency of the input (I tried from 100Hz to 200kHz and I get the same figure).

The comparator seems to work when I give continuous voltage to both inputs.

I also checked Vref on a external pin and got 3.3V as expected

Does anybody know how to fix this kind of problem?

3 REPLIES 3

Maybe conflict of the COMP output with some onboard of off-board circuitry?

Why is the output of the generator noisy?

JW

JLaba.1
Associate II

I tried to generate the sine with an onboard DAC first then with a dedicated generator but I got the same results. There must be a physical problem because the noise of the Comparator and the source's one have the same period and amplitude and have a 180° phase shift. So I guess this weird output generates a current draw that affects the input. But I can't figure out why the comparator behaves so weirdly, it doesn't even shift when the signal goes below the reference.

Short between comparator input and output? Short to some other track on the board? As I've hinted above, comparator output (or input) connected to some other on-board resource?

JW