3.3v <> 5v interfacing @ 15Mhz

If your want a working solution, use level translation IC. They will work up to 30+MHz and easily available from catalog suppliers like Digikey and Mouser.

SN74LVC04A @ 3.3Vcc Use two inverters in series as a 5V tolerant non-inverting buffer.

SN74LVC3G34 @ 3.3Vcc - three non-inverting buffer.

Reply to
Yuriy K.
Loading thread data ...

tnx :-)

The reason why I believed that a 3.3v '1' would register as a '1' on a CMOS dsPIC port is that there are quite a few examples on the net that say it works... That was my mistake, believing what I read on the Internet.

"It will work, but isn't within spec' so it's unreliable. It's reliable at a few Mhz at very most, when the parts are designed to go upto about 30Mhz."

"dsPIC parts CANNOT be directly interfaced to 3.3v devices!"

Alison

Reply to
Alison

Hi Yuriy,

..

thanks :-) apologies for missing you out.

All of this I'm logging.

Alison

Reply to
Alison

The DO to SPI IN will only work the buffer is powered from 5 volts or the output can be pulled up to 5 volts with a resistor. The signals in the other direction don't need buffers at all, the resistors should work just fine.

Alison, you have the transistors in your bin, right? They should do the job fine. Go ahead and try them. If they don't work, then something else is wrong.

Reply to
rickman

Hi Rickman,

Here's the outcome. With the circuit it fails at 7.5Mhz. If the circuit is bypassed, it fails when switching to 15Mhz.

I've tried it with; two BC547C, two BC548, and two 2N3904.

Checking the circuit on the meter all is fine, it chucks out 5v. It just seems to be passing out at higher speeds when the circuit is used.

What does that tell us? If the board fails at 15Mhz without the circuit, and the board fails at 7.5Mhz with the circuit?

The transistors here are good for 100Mhz. They are only 100mA though?

This R&S CP/M logic analyser with a 'storage' scope add-in board thing that I have here, I'll try to use it tomorrow if I can figure out how to trigger it, as I don't think I can use an external trigger which I would otherwise set in software on another pin when switching Mhz to capture what's going on.

Just wondering why I'm getting faster speeds without the circuit. Oh don't worry (I'm sure you're not) I'm not criticising at all, very grateful for the help tbh :-) It should be more reliable with.

Alison

Reply to
Alison

I am starting to think the voltage issue is a red herring. Where did you get your code to configure and operate the SPI port on the PIC? The basic operation of the SPI port has four possible configurations which differ in the polarity of the clock and the edge that is used to clock in the data. There actually is no spec on the SPI bus. It was invented by Motorola (now Freescale but that may have changed again) when they came out with one of their many MCUs, perhaps the HC11.

If your code was from scratch, then I would suggest that you work on making sure this is right. If the code is from a reliable source that has verified the correct configuration in this chip, then I still say verify it yourself! I'll try a couple of ascii drawings.

Sel ___|--------------------------------- Clk ______|---|___|---|___|---|___|---|__ Data __X=======X=======X=======X=======X=

Sel ___|--------------------------------- Clk __|---|___|---|___|---|___|---|___|-- Data __X=======X=======X=======X=======X=

This will look right if you view it in a fixed width font. You may need to copy it to a text editor and view it in a font like "Terminal" in Notepad. The first configuration has data changing on the falling edge of Clk. The second configuraton is using the rising edge of the clock to shift the data out. In each case, the data should be read into the PIC on the opposite edge. This gives you the most setup and hold time. If you try to sample it on the same edge that shifts out the data, you will be reading it when it is changing.

The clock can also be inverted in polarity, but that also changes the edge the data is shifted on so it will be the same problem. You can try changing the two configuration parameters in the software and see which ones work best. Then you should verify all this with the scope when you get it.

So maybe you don't need the voltage buffers anyway. But it would be a good idea to keep them in as the voltage problem can get worse if the temperature of the circuit gets extreme one way or the other. Voltage thresholds are very sensitive to temperature.

Reply to
rickman

Check datasheet for the HCT/AHCT series. Strangely enough, VinH >= 2.0V, VinL The signals in

Yeah, right. Especially at 10+ MHz.

If the goal is to solve the problem, use an appropriate components. In this particular case use IC with voltage translation capability.

If the goal is to entertain yourself, try different combinations of discrete components. Some of them might even work.

Which way to choose depends on what the *real* goal is.

--
WBR, Yuriy.
"Resistance is futile"
Reply to
Yuriy K.

dsPIC I/O port VinH requirement is 0.8*Vcc. At 5V it gives us VinH >= 4.0V. It's a little high for 3.3V circuit, isn't it?

--
WBR, Yuriy.
"Resistance is futile"
Reply to
Yuriy K.

Hi Alison,

While the transistors may have an ft of 100Mhz their switching response can be quite poor. You could try one in common base mode. Emitter to DO of the 3v3, 2k2 from base to 3v3 and the collector to DI of the PIC with a 1K0 pullup to +5V.

While VIH is specced at 0.8 * Vsupply the parts with CMOS inputs will generally switch at about 2.5 volts. The 0.2*VDD for VIL and 0.8*VDD for VIH are the guaranteed levels.

Regarding your driving the 3v3 inputs from the PIC. The input capacitance your SPI device could be 'thumb-sucked' at about 20pF. Your

1K8 and 3K3 gives a node impedance of about 1k1 which when combined with the 20pF gives a delay of about 20nsec. The gap between clock edges at 15Mhz is only 33nsec. Combined with logic propagation delays this could easily cause data corruption.

A way to get around this would be to fit a cap of about 33pF across the

1K8 resistor - the idea is the same as used on the 10megohm scope probe inputs. The cap may have to be bigger or smaller depending on the actual input capacitance of the device, but I would guess that the 33pF would probably fix it.

Regards Rocky

Reply to
Rocky

Haven't you been reading the thread? We discussed that and Alison added transistor buffers that should have fixed the problem and instead made it worse. That says to me that although driving from 3.3 may not be meeting the spec, it is working in her case and she has another issue.

Reply to
rickman

Hi Rickman,

It's working :-) I made up a small board of solid copper, and am using a fixed 2k/1k divider to give 3.33v.

Have a look at this picture to save 1000 words;

formatting link

Not something I'd want to leave on my car seat at an airport!! Most of the wires are now redundant. The little upright board has a MAX232 on it. Your transistor circuit is over there on the lower right. The upper right are those awful dividers from before.

Even the two most troublesome cards I have are working (they're about

3-years old).

What does that tell us in the end? That breadboards are seriously problematic.

Our DATA OUT signal from the SD card is now directly connected to the SPI-IN port on the pick.

Alison

Reply to
Alison

Hey Yuiry!! :-)

I'm going to order a few of those ICs you suggested, as to be honest I like the right way of doing things. And resistor dividers don't seem to be the

100% reliable tool for the job.

If there's an IC specifically for 3.3v/5v bidirectional comms, then I think it's good practice to use it.

That dsPIC is now recognising 3.3v as positive '1' at 15Mhz. It had been spoken of that PICs would work with SD cards directly, yet the datasheets suggest otherwise. So it's sensible to stay within spec.

This will be a data storage device afterall, so nothing can be left to chance.

Thanks again :-)

Alison

Reply to
Alison

[snip]

For 3.3V to 5V Logic...

formatting link

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

Yes, it does look a little rough. I don't think many people still use those push boards just because they can create problem with the speeds of today's circuits. The stuff we do goes directly to PCB. In fact the last board I designed had *no* artwork revisions and the first rev is being shipped to the customer now.

Like you say in your other post, this is clearly not meeting the spec and so you should consider changing it. However, as others have pointed out, circuit delays can add up and be a problem at 15 MHz, especially since the SPI bus is only using half a clock for setup (33 ns). So when you pick a buffer, make sure it is not one of the really slow HC or HCT buffers. Try to pick one with < 5 ns delay which should not be a problem at 5 volts. At 3 volts you may see a bit longer delay, but you should be able to keep it below 10 ns. This should all be spec'd in the data sheet.

Reply to
rickman

Incredible. Designing complicated circuit instead of simply using

74HCT14 / 74HCT04 / zillion other HCT74xx and AHCTxx ICs.
--
WBR, Yuriy.
"Resistance is futile"
Reply to
Yuriy K.

This is exactly what expected from *transistor* buffers at this speed. Duh.

--
WBR, Yuriy.
"Resistance is futile"
Reply to
Yuriy K.

Alison,

I hate to tell you this, but that solderless breadboard is about the worst thing you could be using. With edge rates of 10ns and periods of 33 ns, you are talking serious ringing and ground bounce. This kills data integrity regardless of how good the paper schematic looks. The breadboard will also develop intermittent connections after a while, so you end up spending all your time chasing random problems.

Walt Kester, Analog Devices states:

"Matrix board, Vectorboard, wire-wrap, and plug-in breadboard systems are, without exception, unsuitable for high-performance or high-frequency analog prototyping. The resistance, inductance, and capacitance of these breadboards are too high."

He shows some examples of high-frequency prototyping here, but the photos are too small:

formatting link
(198KB)

Here are some examples of "deadbug" and "solder-mount" prototype circuits:

formatting link
(598KB)

Also look for "Manhattan" (and the incorrectly spelled version, "Manhatten") breadboards.

Terry Ritter has an excellent example at

formatting link

I hope this helps. If you need any more information, please ask.

Regards,

Mike Monett

Antiviral, Antibacterial Silver Solution:

formatting link
SPICE Analysis of Crystal Oscillators:
formatting link
Noise-Rejecting Wideband Sampler:
formatting link

Reply to
Mike Monett

Wow! This is the case when the extra knowledge only harms. Why didn't you use a simple gate of a standard LS or HCT series?

Vladimir Vassilevsky

DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

Hi Mike,

Thanks for the info. Reading through now.

I'm going to try and get the circuit onto PCB in the next week or so. The final design will also switchover to TQFP devices. At the moment it just about serves the purpose of providing a base from which I can develop the firmware for the chip.

To be honest, I hate breadboard!! But am not in a position to create PCBs. The closest I can do is 0.1" pitch, printing out the circuit, drilling the holes through, dalo-ing out the bits I want to keep, and then ferric-ing off the rest. That's just toooooo messy.

Prototype PCBs here in the UK are still astromonically expensive compared to the US.

Thanks again,

Alison

Reply to
Alison

74LS: VoutH >= 2.4V It is actually worse, than 3.3V CMOS.
--
WBR, Yuriy.
"Resistance is futile"
Reply to
Yuriy K.

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.