EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Problem with swinging Atmel AVR comparator

Started by Unknown August 1, 2005
Hello,

I am developing a BLDC-Controller with the ATMEGA88. For
Zero-Crossing-Detection I use the AVR build in Comparator. But I have a
problem with the stability of the comparator output. It seems, that the
Comparator-Output-signal is very instable and tends to swing.
Who have the same experience and can tell to improve the behaviour of
the comparator?

Best regards

Wolfgang

Hello Wolfgang,

Your name and the word "swinging" makes me believe you could be German. 
Anyway, you probably meant oscillation (swinging sounds nicer...). Can 
you post more information?

When comparators are run as zero crossers and there is no hysteresis 
their output will be pretty wild. It depends a bit on the offset of the 
particular chip or uC. Normally it should look like random noise on the 
scope. Do you see a real oscillation, like a certain more or less fixed 
frequency? If yes, then the input could somehow "see" the output or 
couple into it inductively. Traces too close etc. Remember that the gain 
of a comparator is huge. It's basically an opamp with no feedback so 
80dB and more would not be be a surprise.

Is anything connected to its output or is that used inside the uC only?

Gruesse, Joerg

http://www.analogconsultants.com
No, there is no oszillation with a definite frequency. It seem, that
the comparator could very easyly disturbed. Therefor I=B4m searching for
someone with experience with the ATMEGA88 controller.

Best regards

Wolfgang

Hello Wolfgang,

> No, there is no oszillation with a definite frequency. It seem, that > the comparator could very easyly disturbed. Therefor I�m searching for > someone with experience with the ATMEGA88 controller. >
Well, maybe there is an expert on that uC here who can shed some light. Anyway, comparators without a hysteresis (resistor for positive feedback) are bound to be "wild". How wild? Depends on the offset. There will be a spec on the data sheet that says how much that can be and it varies between batches of chips. So one uC's comparator might be kind of quiet because it has a large offset. Another might produce lots of noise because it happens to be very low in offset. The noisy one is actually the better one, more sensitive. Regards, Joerg http://www.analogconsultants.com

Memfault Beyond the Launch