High speed comparator with adjustable offset - Page 1
Forum section: electronics / projects

author: NiHaoMike
author_rank: Super Contributor
timestamp: October 12, 2024, 01:12:58 am
content: I'm working on an adapter board for a cheap FX2 logic analyzer to allow it to analyze differential signals up to a few Mbps such as CAN and RS485. The problem I'm trying to solve is how to make the offset adjustable? For example, CAN uses a threshold of about 0.7V while RS485 uses a threshold of near 0V. I could just get a bunch of RS485 receivers and a bunch of CAN receivers and just switch between them, but that seems a bit silly.

author: moffy
author_rank: Super Contributor
timestamp: October 12, 2024, 01:27:08 am
content: There is a problem in that they are DC coupled and at least the RS-485 (+/-12V on the THVD24xxV) can have a fairly wide common mode voltage range, quite different to the CAN bus and its CM voltage of 2.5V.

author: tggzzz
author_rank: Super Contributor
timestamp: October 12, 2024, 11:48:34 am
content: Why not use general purpose analogue comparators?One input would be your signal, the other would be the threshold voltage set by a trimpot etc.

author: NiHaoMike
author_rank: Super Contributor
timestamp: October 12, 2024, 08:50:55 pm
content: Quote from: tggzzz on October 12, 2024, 11:48:34 amFor differential buses like CAN, the threshold is the difference in voltage between the lines that triggers a 1 vs a 0. So a standard comparator won't work.

author: tggzzz
author_rank: Super Contributor
timestamp: October 12, 2024, 09:11:32 pm
content: Quote from: NiHaoMike on October 12, 2024, 08:50:55 pmYou will already have ensured signal integrity using a scope, specifically including a check to see that the differential voltage margin is correct. Now all you have to do is interpret the digital signal based on the known good analogue waveforms.Possibility one: use two comparators with the threshold set to the specified common mode voltage, and combine the difference digitally.Possibility two: use one comparator with inputs connected to the differential inputs, not specifying the common mode voltage, but allowing the comparator to work out which input is higher.Personally I'd start with the latter. The former is more likely to be used in the input pods of a bog-standard logic analyser.

author: NiHaoMike
author_rank: Super Contributor
timestamp: October 12, 2024, 10:05:56 pm
content: Quote from: tggzzz on October 12, 2024, 09:11:32 pmThat won't work for CAN since its 0 voltage is close to 0V difference. A 1 is defined as more than 0.7V difference.

author: tggzzz
author_rank: Super Contributor
timestamp: October 12, 2024, 10:40:38 pm
content: Quote from: NiHaoMike on October 12, 2024, 10:05:56 pmUse a SN65HVD230 3.3V CAN Transceiver with Standby Mode, or similar

author: NiHaoMike
author_rank: Super Contributor
timestamp: October 12, 2024, 10:58:14 pm
content: Quote from: tggzzz on October 12, 2024, 10:40:38 pmHow to support RS485 with that other than with the kludgy hack of using a RS485 receiver in parallel?

author: ejeffrey
author_rank: Super Contributor
timestamp: October 12, 2024, 11:59:36 pm
content: It's probably worth special casing CAN. The vast majority of differential signalling standards have 0 volts differential as the threshold. For CAN, given that as tggzzz has pointed out you have already verified signal integrity, just operate you logic analyzer input in singled ended mode looking only at CAN Hi with the comparator threshold set to 2.5-3V. Since you are presumably going to want to support both signal ended and differential signalling, this is no extra hardware.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: October 13, 2024, 01:16:48 am
content: Quote from: NiHaoMike on October 12, 2024, 01:12:58 amDual solutions are simple to apply and easy to understand or upgrade. It's not really silly or a kludge.Any 'proper' alternative will be tricky : many new parts have wide common mode, and high ESD, and moderately high input resistance.You could get a fast (sub 10ns) rail-rail comparator, and apply differential divider/bias resistors to give you a better common mode range, then inject a small optional offset current for CAN thresholds.The resistors need to be low enough to not compromise MHz, but high enough to not be a lot worse than a standard part.It would need careful layout and tuning.lcsc have interesting parts like MX3501T23_C5359092_Comp_RRIO_SHDN_4p5ns_1mVos_2pA_3p2mA_6mVHyst_80MHz_SOT26_10c

author: Smokey
author_rank: Super Contributor
timestamp: October 13, 2024, 02:21:29 am
content: Put the CAN and RS485 receivers on your board and trigger off the single ended outputs?

author: NiHaoMike
author_rank: Super Contributor
timestamp: October 13, 2024, 02:22:54 am
content: Quote from: ejeffrey on October 12, 2024, 11:59:36 pmSingle ended is done by using the logic analyzer as is. At this point, I'm thinking of 4 channels differential with the other 4 digital channels as passthroughs for when it's necessary to capture single ended signals at the same time as well as an analog passthrough for the one analog channel on those FX2 analyzers. The 4 differential channels should cover the case of SPI over differential lines.

author: moffy
author_rank: Super Contributor
timestamp: October 13, 2024, 02:49:25 am
content: For what it's worth even though I think the circuit is a bit ridiculously complicated it does what you are asking for. The comparator is for illustrative purposes only and not suitable because of limited common mode voltage range. The level of hysteresis is set by controlling the current I1 and the value of the input resistors. Voltages shown are the inputs to the comparator. The signal generator generates a +/-2V square wave with slow edges.Make of it what you will.

author: tggzzz
author_rank: Super Contributor
timestamp: October 13, 2024, 11:13:25 am
content: Quote from: NiHaoMike on October 12, 2024, 10:58:14 pmThe kludgy hack would be to throw something together that does two jobs badly. The clean hack is to to both jobs well.If that means two receivers, sobeit.

author: NiHaoMike
author_rank: Super Contributor
timestamp: October 13, 2024, 01:10:07 pm
content: Another use case I just thought of is "current loop" interfaces, where a twisted pair cable connects to an optoisolator. That is done so that it would not be necessary for a device that uses such an isolated interface to supply power to both sides of the isolator circuit, the remote side would be entirely powered by the signals from the remote device. (Note that only one end of the link would be isolated, the other end just uses common logic signals and resistors.) It would need an offset threshold just like CAN does, but more than 0.7V in the case of an opto-Darlington return channel. At this point, I'm leaving it as a "stretch goal" to be implemented if it doesn't require unreasonable complexity.

author: moffy
author_rank: Super Contributor
timestamp: October 14, 2024, 12:36:46 am
content: Just for completeness, the previous circuit was drawing the current for I1 through the external driver, this circuit doubles the complexity but supplies the current locally so that the drivers don't need to supply the current.