Interfacing 3V3 signals to 5V chips.

Thread Starter

daba1955

Joined Apr 27, 2019
188
I have built a Teensy 3.2 circuit to replace the rather crappy "Sound-To-Light" circuit built into my DMX Stage Lighting Controller. There's a thread all about in the forum Analog & Mixed-Signal Design, called "LM358 circuit help needed"

I am outputting a digital pin (3V3 High) on my Teensy, going low on the beats for 5mS, which better than replicates what the original analog circuit does, and that feeds into pin 31 of the DMX controller chip, which is a MEGAWIN MA805-24AD44 mcu, running off 5V

I suspect that pin will have an internal pullup enabled, but can't get at the code to determine that.

My question is simple, will a 1K resistor in series suffice to drive that input pin, or would I be better off using a 3V3 to 5V logic level shifter which I already have some of.

I have used the simple resistor idea before when interfacing 3V3 to 5V chips, e.g. a DFRobot Mini MP3 Player's "Ready" pin to an Arduino 5V input with Pullup enabled, with no problems.

Open to suggestions please...
 

danadak

Joined Mar 10, 2018
4,057
I cannot find an English datasheet for the MA805-24AD44, but your concern
is logic noise margin, eg. the high level spec for the input pin being driven.
I am assuming the 3MA805-24AD44 part is unidirectionaly driving the 5V part
input only pin.

A pull up adds a small amount of noise margin, from 3V part to 5V, by effectively
going above the 3V rail by ~ .3 - .7 V, eg. turning on parasitic diodes.

Try it and look at level vs spec, you should be OK if environment is relatively
noise free.

Regards, Dana.
 

Thread Starter

daba1955

Joined Apr 27, 2019
188
Thanks for your response Dana.

I also had problems finding an English spec for the MA805-24AD44, so a bit like working in the dark. I know its supply is 5V, and I've just looked at the DMX board, there is no external pullup on pin 31, I am measuring 15M to the 5V rail.

Post #25 in the other thread is the circuit I am replacing, and I don't think that final LM358 stage was hitting the top rail, I think it was about 4V if I remember correctly (I was more concerned with what the pulse width was, to replicate it). Typical input thresholds of mcu's is about 2.4V isn't it? That's what I've always believed, so the 3V3 should be sufficient.

So you think it safe to try with just a resistor ? If anything blows it will be the Teensy, not the MA805, which would be irreplaceable (for me anyway), and I'd have to buy another controller.
 

danadak

Joined Mar 10, 2018
4,057
I am going to correct myself.

The only other consideration is also the MA805 input totem pole drawing
current in its Vdd to Vss rails because the input hangs in the threshold region
of both Nand P MOS transistors in the totem pole.



Normally the above is not an issue at CMOS input because size of
N & P MOS transistors used limits current.

But back to the I/O interface problem.

The Vihmin of a 5V CMOS input is .7 x Vcc, assuming 5V, thats 3.5V.
So in retrospect I change my mind, the pullup will leave no noise
margin worst case 3V and 5V supplies. 10% supplies means ~3V
and 5.5V worst case, and at .7 Vsupply of min Vih 5V part thats 3.85V,
outside range any benefit a pullup will have clamped by output parasitic
diodes in 3V part. The ~3V + Vdiode =~ 3.7V. 185 mV of noise margin
simply not advisable.

If you had 1%, even 5% supplies that would help, but its a thin solution.

You will need a buffer to do this properly.

http://www.ti.com/lit/an/slaa148a/slaa148a.pdf


Regards, Dana.
 
Last edited:

Thread Starter

daba1955

Joined Apr 27, 2019
188
The only other consideration is also the MA805 input totem pole drawing
current ......
Yes, I noticed the totem-pole input arrangement in the chinese datasheet, and the upper transistor had the word "Strong" next to it.

So it looks like I've got to hit both rails to make the input switch on and off.

I'll put one of my Bi-Directional Logic Level Shifters on it and see how it goes. A job for tomorrow now, as I have to go out.
 

Thread Starter

daba1955

Joined Apr 27, 2019
188
I managed to put my level shifter onto the board, and then mounted it into the DMX controller.

I carefully isolated the output of the original op-amp trigger circuit, and connected my 5V level pulse to pin 31 of the MA803 mcu.

After it didn't work, I stripped my Teensy board out again, re-connected the original op-amp trigger circuit, and that didn't work either. I think I may have fried something, as the controller was used in a live performance last night, and some of the chases and scenes weren't as I programmed them, giving me some random and weird effects !

I have ordered a new DMX controller, so can get to play about with this one without compromising another controller, but in the meantime I am going to do testing with my 5V signal feeding a cheap Nano input. Much less expensive if I fry one of those. I have had issues before with some of these level shifters, and I might have used a "bad" one that slipped past the "file under bin" procedures.
 

danadak

Joined Mar 10, 2018
4,057
A safe way of checking a I/O interface, thats not hi speed, insert a 1K ohm R in series
with output to input, That way if you are ovewr driving an input outside its operating
range current is limited when the parasitic diodes in CMOS turn on.






Regards, Dana.
 

Thread Starter

daba1955

Joined Apr 27, 2019
188
This is the circuit driving the MA805, the LM358 running off (like the MA805) a single 5V supply, so I don't think it possible that my circuit can give it any higher voltage than that, as it too runs off a single 5V supply, and anyway I used the MA805 %V rail for the "HV" on my level shifter.

The diagram from the MA805 datasheet is, I believe, the full schematic of the I/O pins, but I am having trouble understanding it, and I can't read Chinese. I have to assume the pin is configured as an input, since it goes nowhere else than the output of the LM358 op-amp. It looks to me that when the Input is high (5V), the internal weak pullup transistor is turned off by the inverter ? Is that how you see it ?

2019-05-12_122915.jpg
 

dendad

Joined Feb 20, 2016
4,479
I would drive an optoisolator from the Teensy, then have the opto's output switch the DMX input. Then there is no way you can kill the input. MIDI things do this very well. Do you need info on how to impliment that?

I often use optos as a convenient level shift device, even when no isolation is needed.
 

danadak

Joined Mar 10, 2018
4,057
It looks to me that when the Input is high (5V), the internal weak pullup transistor is turned off by the inverter ? Is that how you see it ?
Yes, agree.

dendad recommendation pretty compelling.


Regards, Dana.
 
Last edited:

danadak

Joined Mar 10, 2018
4,057
daba1955, I just caught the fact the 802 chip Vih is 2.0V for all inputs
except Reset, which is classic CMOS .7 x Vdd.

So take that into consideration on worst case calculations.


Regards, Dana.
 

danadak

Joined Mar 10, 2018
4,057
Vil max = .8V

Yes, the drive would have been adequate from 3V3 supply. My mistake was
not getting CMOs levels out of my head rather than TTL levels which chip has,
except for reset pin.


Regards, Dana.
 

Thread Starter

daba1955

Joined Apr 27, 2019
188
I would drive an optoisolator from the Teensy, then have the opto's output switch the DMX input. Then there is no way you can kill the input. MIDI things do this very well. Do you need info on how to impliment that?

I often use optos as a convenient level shift device, even when no isolation is needed.
I genuinely don't think there is need for opto-isolation, nor indeed a level shifter, since we are going 3v3 output to 5v input, and as danadak notes the VinL threshold is 2.0V, so a 3v3 signal should gives us a good margin.

At this moment I'm trying to get the original board back as it was before attempting to interface my Teensy, and see if I can re-measure the pulse widths, amplitudes etc., but I fear I may have killed the electret microphone due to excessive heat. They haven't done thermal relief on the ground connection, and soldering it back in has stopped it working.

I spent hours the other week going through all the user-created footprints in my PCB software, making sure that all pins are set to thermal relief to copper areas. Just makes life sooooo much easier. I will replace it, but for the ground connection I will leave the lead longer, fold it over to a scraped away region of the ground-plane, and quickly tack the end on. I have acres of ground-plane space in that area. It's been years since I needed them, but I'm hoping I can find my thermal forceps which I can clamp on nearer the MIC.
 

Thread Starter

daba1955

Joined Apr 27, 2019
188
I've not had much time to tinker with this recently, had some clients PLC software to modify for an up-coming extension....

Anyway, I've captured a chase step trigger pulse from a NEW controller, and I have now put that back together so I can play with the old one.

The trigger pulse is very short, at 64uS, so I've shortened my output pulse to reflect that. (see pic)



The original dual op-amp circuit that drives the DMX controller's MCU is here, and I want to replace the output signal of that circuit with the output signal of my Teensy Beat Detector circuit, which I have to says works exceptionally well.... The Teensy circuit produces a pulse (high-to-low) output, same as the original op-amp circuit.

Interfacing to the DMX MCU (supply = 5V) input is via a logic level shifter, where the "HV" side is from the DMX board, common ground connection. I did not want to load the DMX 5V regulator any more, so my circuit derives its own 5V from the DMX controller's 12V input supply.

If I'm supply HV for the level shifter from the DMX board (which is the same supply the MCU is running on), can anyone see any issues with this interface strategy....
 

Attachments

Phil-S

Joined Dec 4, 2015
238
Resistors sometimes work, but a chip will always be cleaner. Use a 4050 for high to low or a two-way level translator for either direction. Sparkfun do a two-way BOB with FETs, the cheapest and easiest way, or down and dirty with some Texas small outline chips to test your soldering skills
 
Top