Jump to content
  • 0

3.3V to 5V Level Shifter Circuit for Open-Source data line to be used with Digital Discovery pattern generator and logic analyzer


s4fq7

Question

Hello,

I'm attempting to use the digital discovery to debug a circuit by listening and injecting data on a signal.

The signal appears to be pulled down to 0V typically but then pulled up to 5V to transfer data.

I've configured everything in Waveforms such that the pattern generator is outputting as open source and this appears to be generating the correct effect on the bus as monitored with an oscilliscope, however it is only achieving 3.3V (as that is all the digital discovery is designed for).

injected_signal_with_no_level_shift_circuit_open_source_floating.thumb.png.01e5f8abf205c72144db7576bdc1eba0.png

Unfortunately this is insufficient for the receiving ends to detect and respond too.

I've attempted to use a mosfet based bi-directional level shifter exactly as described here

https://scienceprog.com/simulating-mosfet-based-bidirectional-3-3v-to-5v-logic-level-shifter/

However it doesn't play well with the fact the bus is normally pulled down.

But this level shifter circuit causes both the 3.3v and 5v side to now be pulled up all the time (and doesn't play well with the bus I'm trying to work with).

3_3v_side_with_level_shift_circuit_everything_gets_pulled_up_when_floating.thumb.png.fd82966c7bf5d2acb018fbf4c02cdd5e.png

5v_side_with_level_shift_circuit_everything_gets_pulled_up_when_floating.thumb.png.d02ff291c4b80323c79c51ffefb90f61.png

 

If I change the patter generator from open source and floating to push pull and normally 0 I can now get it to send a proper signal on the bus,

but the response is pulled down way to low by the level shifter circuit to the point I can't capture it with the logic analyzer.

3_3v_side_with_level_shift_circuit_when_set_to_pull_down_response_is_half_required_voltage.thumb.png.1c7f36c5369a6a96d03716fcfa07c851.png

5v_side_with_level_shift_circuit_when_set_to_pull_down_response_is_half_required_voltage.thumb.png.59c382fa318564dad683eb664bf5fb5a.png

 

I'm relatively confident a circuit can be easily built to allow for a levelshifter that will function with the "open source" bus I am trying to monitor and communicate with but it is going to be different than the one I linked above. It will probably need a p-mosfet and some diodes.

Unfortunately I'm not familiar enough with the correct terminology to know what such a level shifter circuit would be called.

If anyone can direct me to some resources that explain how to make a level shifter that can perform bi-directional shifting of a bus which is typically pulled down and then pulled up to communicate I would very much appreciate it.

If I invert the pattern to be the opposite signal and then feed it to a p-mosfet I figure I can get a 5V output signal, but this might mean I'de need to use one pin to generate the signal and another pin to capture with the logic analyzer. I'de really prefer if there was a level shifting circuit I could make so I could use one pin for logic analyzing and pattern generation.

Here is a link to my attempt to reverse engineer the circuit between the external connection on the bus and the microcontroller.

https://crcit.net/c/003faefa673e4e8789dddcd1646bedd3

I'm not sure if this is a level shifter or just a diode protection circuit to protect from static and bad polarity but I'm starting to think it may be both. I identified both p-channel mosfets (https://pdf1.alldatasheet.net/datasheet-pdf/view-marking/1241407/YANGJIE/BSS84.html) and n-channel mosfets (https://www.jscj-elec.com/gallery//file/2N7002KLW  SOT-323 V1.pdf) as well as diodes.

Hopefully this looks familiar to someone. Perhaps the resistance values can help inform someone on what might be appropriate resistance values to use in a level shifter circuit to ensure the pull down resistors on the bus are still effective. (I don't know the capacitance values)

 

Thanks for any help you can provide.

 

EDIT: I found the following stack exchange article https://electronics.stackexchange.com/questions/162398/bi-directional-level-shifter-circuit-with-pull-down-resistors

Unfortunately no answer was provided that worked besides buying a custom IC by TI.

On page 12 of that IC there is a block diagram which somewhat resembles the circuit I reversed from the PCB https://www.ti.com/lit/ds/symlink/txb0101.pdf

 

EDIT 2: After familiarizing myself with the datahset for the TXB0101 I'm not sure it will work in my situation. It says it is ideally designed to work in cases where push pull cmos logic is used. It can function in cases where pull-up or pull-down resistors are used but they should be greater than 50kOhm to function decenty. Based on my reversed circuit from the PCB, it seems that perhaps the pull-down resistors (if indeed they are pull-down resistors) on the bus are in the order of 5kOhm-10kOhm which would be too low for the TXB0101 to function properly. For I2C style pull-up type buses TI also offers the TXS0101 but if I do have a pull-down type bus(?) it wouldn't work for me. I will buy one to try anyways but it will take afew weeks to arrive.

If anyone has any tips or comments on possible level-shift circuit solutions I would still very much be interested. I'm also perfectly happy to purchase a pre-built IC if one exists that would work with the pull-down resistor values on the bus (if that's what they actually are). I don't know how to properly measure the pull-down resistance of the bus, but if anyone can tell me how I will gladly do it.

I've also posted a similar question on stack-exchange for anyone who might read this in the future and is interested.

https://electronics.stackexchange.com/questions/625974/designing-a-bi-directional-level-shifter-for-3-3v-5v-that-works-with-pulldow

 

Edited by s4fq7
improved circuit diagram of potential level shifter on pcb
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hey Atilla, thanks so much for your reply! After much trial and error I think I've decided that the TXB0101 should work as the bus appears to be push-pull and not pull down only. I realized my attempt to reverse the driver circuit had missed that the gate of the p-mosfet was actually attached to a second pin on the micro-controller. So it looks like they are using one pin to read and another pin to write with a push pull configuration using diodes and mosfets. https://crcit.net/c/bbe5bc1e41bf4d05bf6772c45e16e1a0

As such I'm going to just give the TXB0101 a shot and this question can be marked as closed.

Link to comment
Share on other sites

  • 0

Hey @attila, totally unrelated to my original question but I had one suggestion for a feature improvement. (or maybe it's already a feature and just I don't know how to use it). When you are creating a pattern generator pattern of type custom. You can import data. I was trying to import data that included tri-state values but no matter what I typed in the csv file <empty>, "Z", "z", "?" It always seemed to import them as 0. I could easily change all the 0's into "z" by typing "z" and pressing tab, and that worked in the end, but it would be good to document what value to type into the csv so when you import it as a pattern it will show up as the tristate z value. I appologize if I'm missing something obvious. I wanted to congratulate you guys on an awesome piece of kit. I make use of both the analog discovery 2 and digital discovery all the time and they have helped me learn a lot, and as of yet I haven't had any issues with them :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...