Puzzled by comparator LT1017

Thread Starter

Kossi Nouwakpo

Joined Jul 23, 2017
11
Trying to convert a 3v3 pulse to a 5v pulse. Decided to use a lt1017 (see attached schematics). What I found intriguing is that the LT1017 output only shifts when the inverted or non-inverted inputs are connected to 3v3 (schematics c and d). When I use a 1.67v reference (a and b), the output is either 5v constant (a) or GND (b).
My question is: What am I missing?

Thanks for your inputs.for-lt1017.png
 

tindel

Joined Sep 16, 2012
936
Hmmm. Something is certainly not right. Have you checked (and double checked) all of your connections? That's my guess. a) and b) should work well, but c) and d) should have unknown states when both inputs are 3.3V - Maybe it works, maybe it doesn't. Also acceptable common-mode input voltage is something to double check as well. The 1017 is a older part - so I can't quite recall right off hand, but older parts are not always as "ideal".

Are the grounds from your 5V supply and 3.3V supply tied together?

Also be sure to include decoupling caps, and most applications also have a positive feed back resistor - something in the range of 1M to keep the output from oscillating.
 

Thread Starter

Kossi Nouwakpo

Joined Jul 23, 2017
11
Hmmm. Something is certainly not right. Have you checked (and double checked) all of your connections? That's my guess. a) and b) should work well, but c) and d) should have unknown states when both inputs are 3.3V - Maybe it works, maybe it doesn't. Also acceptable common-mode input voltage is something to double check as well. The 1017 is a older part - so I can't quite recall right off hand, but older parts are not always as "ideal".

Are the grounds from your 5V supply and 3.3V supply tied together?

Also be sure to include decoupling caps, and most applications also have a positive feed back resistor - something in the range of 1M to keep the output from oscillating.
I will give it another look tomorrow. I was also surprised by the behavior.
Yes the 5v and 3v3 share the same ground. The datasheet I have is pretty vague but indicates "Differential input range" of 40v which is well above the 3v3 range in my case.
I have a few decoupling caps on the board but none by the LT1017. Will add one to see if anything changes. Will also try the feedback resistor, but wouldn't this produce a hysteresis?

Thanks for the help.
 

Thread Starter

Kossi Nouwakpo

Joined Jul 23, 2017
11
Hmmm. Something is certainly not right. Have you checked (and double checked) all of your connections? That's my guess. a) and b) should work well, but c) and d) should have unknown states when both inputs are 3.3V - Maybe it works, maybe it doesn't. Also acceptable common-mode input voltage is something to double check as well. The 1017 is a older part - so I can't quite recall right off hand, but older parts are not always as "ideal".

Are the grounds from your 5V supply and 3.3V supply tied together?

Also be sure to include decoupling caps, and most applications also have a positive feed back resistor - something in the range of 1M to keep the output from oscillating.
I have to mention that the 3v3 signal is coming straight from an avr microcontroller. Now I wonder if I need a load on the signal first.
 

Thread Starter

Kossi Nouwakpo

Joined Jul 23, 2017
11
How fast does the signal need to toggle?
Thanks dl324,
The signal is a short pulse of a few <<1ms in width (never really measured its actual width) that occurs every 2 seconds. The signal is being picked up in schematics c and d but it seems for the wrong reasons. So I am suspecting it is not a speed issue.
Thoughts?
 

Alec_t

Joined Sep 17, 2013
14,329
For the comparator to change state, one input must change from being above the other to below the other. Whether or not that happens in the c and d configurations depends on the input offset of the comparator.
 

tindel

Joined Sep 16, 2012
936
Thanks dl324,
The signal is a short pulse of a few <<1ms in width (never really measured its actual width)
Thoughts?
The propagation delay of the LT1017 is poor (it's a old comparator, as I mentioned before). It takes about 5.3us to fall and 8.3us to rise with large amounts of overdrive, which you have (see "Output Delay" graph for more details). If your pulse width is 'much less than 1ms' than I'm guessing your pulse is just too fast for the comparator to keep up with. You either need to increase your pulse width, use a faster comparator (sacrificing power, usually), or go with a different solution all together - dl324 suggested a common solution (though not my favorite). A simple transistor switch may work as well (TL;DR: http://www.electronicshub.org/transistor-as-switch/)

Remember pulse widths coming out of micros can be very short - 10's of ns - depending on the clock speed. You need a very fast switch with bandwidths of ~100MHz to keep up. Good layout is also critical.
 

Thread Starter

Kossi Nouwakpo

Joined Jul 23, 2017
11
Problem solved! My problem was that the input line was coming straight out of the AVR chip which was supposed to be setting the corresponding bit high or low. A watchdog timer interrupt that was supposed to drop the pin low never ran and the avr would reset each time making it look like it was going low during reset on the oscilloscope. I am assuming that it goes undefined and floats during reset for a brief amount of time. I believe this results in the input going from high to undefined (floating) so could not be compared to the reference input in this undefined state. The quick fix was a pull down resistor on the AVR pin. The better fix still to come is fixing the AVR code to run the interrupt on watchdog timeout.
Still puzzled by why c and d worked though. Alec_t' s point makes sense but how can a floating yield such a result?

Thanks
 

tindel

Joined Sep 16, 2012
936
Glad you figured it out. Just curious, what is your pulse width? Why would you use a WDT to turn off a signal? Why not a normal timer? Seems strange - but this is certainly your project and you can do whatever you want as far as I'm concerned.
 

Thread Starter

Kossi Nouwakpo

Joined Jul 23, 2017
11
Glad you figured it out. Just curious, what is your pulse width? Why would you use a WDT to turn off a signal? Why not a normal timer? Seems strange - but this is certainly your project and you can do whatever you want as far as I'm concerned.
WDT because I was executing some power save / sleep functions and needed a wake by WDT so it was convenient to build some of the ON/OFF signals into the WDT interrupt. Plus 2 of the timers were already busy doing some crucial input captures so did not want to interfere with that process. The Atmega328 which is the microcontroller I am using has a 3rd timer that I could consider but was hoping for a more compact code.
Thanks
 

tindel

Joined Sep 16, 2012
936
WDT because I was executing some power save / sleep functions and needed a wake by WDT so it was convenient to build some of the ON/OFF signals into the WDT interrupt. Plus 2 of the timers were already busy doing some crucial input captures so did not want to interfere with that process. The Atmega328 which is the microcontroller I am using has a 3rd timer that I could consider but was hoping for a more compact code.
Thanks

How is the WDT reinitialize the entire device more compact than servicing an interrupt to change the state of an I/O output? If you have the code space - use it. You certainly have a 3rd timer. Using WDT to clear a GPIO signal is very poor technique.*

*Again - it's your project do whatever you want.
 

Thread Starter

Kossi Nouwakpo

Joined Jul 23, 2017
11
How is the WDT reinitialize the entire device more compact than servicing an interrupt to change the state of an I/O output? If you have the code space - use it. You certainly have a 3rd timer. Using WDT to clear a GPIO signal is very poor technique.*

*Again - it's your project do whatever you want.
tindel,
WDT is useful to wake sleeping devices and to force system reset in case of program hangs / bugs. It's always a good practice to use them for robust applications. The interrupt routine was not supposed to reinitialize the device, that was an oversight on my part. May use the 3rd timer if needed. Thanks for your input.
 
Top