My square wave doesn't square - Page 1
Forum section: electronics / beginners

author: brenda
author_rank: Newbie
timestamp: July 20, 2022, 09:31:05 pm
content: So, I need to control a peripheral with my MCU, connected via a ~60cm 12-strand cable, carrying power, some control signals and 3 high-ish frequency signals, which are 1MHz clock, SCK and MOSI. The MCU is 3.3V, the peripheral is 5V, and the HIGH values in the datasheet are pretty tight, so those 3.3 volts are not enough. I'm using a TXB0108 level shifter, which is sitting at the source of my 'transmission line'. So far so good, the level shifter can translate the clock with no problems, at least while measured directly at it's output...As you probably already assume, the signal coming out of the other end of the cable is kinda garbage, since I have no termination at either end of the cable, but this is the question I want to ask.I've read a few things about matching the terminating impedance with the transmission line impedance, but how do I proceed with this while I have no clue what my Z0is? The cable has no datasheet.One thing I've noticed while measuring stuff, which I'm actually curious about the most, is that while having one probe connected to the source of the line, right after the level shifter, and the second one at the end, the waveform at the end looks like I would image it, a little ringing, but still kinda square. But with the first probe disconnected, the signal completely disappears. This works even if the first probe is completely disconnected from the scope, so it's the properties of the probe that do this. Both are set to x10, basic 150Mhz probes.So like, are the properties of the probe the values of the source/target termination I'm looking for? Even tho they are several orders of magnitude different from what I would expect a termination should have? Or did I just miss something in the 'How to measure with scope for dummies' guide?Here are the waveforms, sorry for the way I took them, I have no other way of getting them out of the scope.Both probes connected, CH1 is source, CH2 is targetOnly CH2 connectedBasic schema of what all of this looks like

author: Benta
author_rank: Super Contributor
timestamp: July 20, 2022, 09:43:54 pm
content: Well, if you disconnect one probe, you'll have to tell the other one to do the triggering.What kind of cable is it? If it's just a round bundled cable, you're in deep water.If it's a flat cable, an alternating signal/ground pattern gives around 100...150 ohms.But lots of error sources here.60 cm at 1 MHz is no fun.

author: brenda
author_rank: Newbie
timestamp: July 20, 2022, 09:52:47 pm
content: The triggering is on CH2, even if zoom out or play with the trigger, the signal is just not there.Yeah it's just a random round cable, not twisted nor shielded

author: brenda
author_rank: Newbie
timestamp: July 20, 2022, 10:03:12 pm
content: Lol the cable actually has a datasheetHellaCable®https://www.helukabel.com/opc/workarea/suppliers/STD/documents/pdf/db/1DB_18001_en.pdfIt says Characteristic impedance 78 Ohm (approx. value), but I've already tried these values, serial resistance makes things worse, and parallel pulls me down too much, so I can't use it

author: edavid
author_rank: Super Contributor
timestamp: July 20, 2022, 10:03:23 pm
content: Maybe you are getting lucky and the capacitive load of the scope probe is absorbing enough of the reflected signal to clean things up.Anyway, the first thing to do is to dump the TXB0108. It's a poor choice for unidirectional signals. I would try a 74HCT08/74HCT125 or similar, powered from 5V (this could be at either end of the cable). Or, you could use 74HCT04 at the source end and 74HC14 at the load end as a cheapo line receiver.If there's too much ringing at the load, you could experiment with series termination (50-100ohm?) at the source.

author: Ian.M
author_rank: Super Contributor
timestamp: July 20, 2022, 10:15:37 pm
content: I agree with edavid. ATXB0108is *NOT* a line driver. Like any other auto-direction-sensing level translator it is highly sensitive to glitches induced by other wires in the cable, and may even oscillate! Its telling that its timing is specified into a load of only 15pF || 1Meg. As he said, get rid of it and use appropriate fixed direction level shifters!

author: Nominal Animal
author_rank: Super Contributor
timestamp: July 21, 2022, 01:26:16 pm
content: It turns out somebody at the Teensy forums had a similar problems, and I yesterday recommended they switch to usingTI TXU0304level shifter instead.Now, I am only a hobbyist and know nothing, but TXU0304 looks particularly nice for SPI, because it can handle the translation in one chip, with either end at any Vcc between 1.1 and 5.5V. All you need is a couple of supply bypass capacitors (0.1µF = 100nF) to stabilize the supply to the TXU0304 chip.I do also love the SN74LVC1T45 in SOT-23 (for single unidirectional signal level translation with direction pin), which I've used with UARTs before.

author: MathWizard
author_rank: Super Contributor
timestamp: July 22, 2022, 06:44:38 am
content: Quote from: Benta on July 20, 2022, 09:43:54 pmSo you mean for a square wave, what about in an AM radio, if you sent a 1MHz signal over some long wire , more of a sine wave so no super fast edges, ? Or is it that the only long wire in a radio, that carries MHz signals, would be the antenna/input, and that is already designed to have the correct impedance ?I should try some stuff with my AWG, I don't have any termination connectors, or proper coax and BNC stuff. It's 2ch, so I could compare different wire types and lengths.Also \, what would happen if u tried to make the level shifting circuits with BJT's on a proto-board, would they all have to be matched, and super tight tolerances to get anywhere close to what a modern dedicated IC would do ?

author: brenda
author_rank: Newbie
timestamp: July 27, 2022, 09:09:10 pm
content: Thanks for the tips!I went with the 74HCT125, although the 74HCT04 also worked well.Also changed the line to flat 20core 28AWG, with alternating GND between the three fast lines, with 500ohm series end termination.Now it does square

author: Jeff eelcr
author_rank: Frequent Contributor
timestamp: July 28, 2022, 11:23:15 pm
content: I hope you ment 50 0hm not 500 ohm which is a strange valueto use as a termination however 600 ohm was a common oneyears ago.Jeff

author: Terry Bites
author_rank: Super Contributor
timestamp: July 28, 2022, 11:28:28 pm
content: Theres more wong there than just bad probe use and cable matching. All that noise make me think you've a really poor quality system ground.

author: brenda
author_rank: Newbie
timestamp: July 29, 2022, 01:06:00 pm
content: Quote from: Jeff eelcr on July 28, 2022, 11:23:15 pmNope, I ment 500ohm. Even 330ohm still makes sharp spikes

author: EPAIII
author_rank: Super Contributor
timestamp: July 30, 2022, 09:43:26 am
content: I am not sure I can explain your second scope photo. But here is a quick education on transmission line impedance.Not the only reason for using a properly terminated transmission line but a big one is to prevent reflections of the signal at the two ends. Not just at one end, but at BOTH ends. These reflections can set up standing waves on the line and result in ringing in the received signal at the far end. This ringing can, in the worst cases, very severe and can even exceed the original level of the signal itself.The proper matching of impedance in a transmission line depends on THREE factors, not just two. You talk about the cable's characteristic impedance and about a termination resistor at the destination. But for proper operation a transmission line also needs to have an impedance match at the source end as well.The termination at the destination end often looks like a high impedance (10K Ohms or higher) amplifier input impedance with a termination resistor from that input to ground. The two impedances, the amplifier and the resistor are in parallel and the low value of the resistor overwhelms the higher impedance of the amplifier's input so it is essentially the impedance that the transmission line "sees".On the source end things are a bit different. Depending on what type of line driving circuit is employed, the output impedance there can vary widely. Back in the day, tube type circuits could have medium to high impedances and special techniques were used to match them to the transmission line. For instance, audio circuits often had transformers for this. Transistor amplifier circuits can be designed with medium to low and even very low output impedances. The very low output impedance circuit design is often used with a SERIES resistor leading from it to the transmission line. Unlike the receiving end, these two impedances are in series, not parallel, so their values add together. Thus an amplifier with a 1 Ohm output impedance and a series resistor of 49 Ohms would provide a termination value of 1 + 49 or 50 Ohms as "seen" by the transmission line. Line driver ICs may have this series resistor as an internal component: check the data sheet.