Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 13 of 13

Thread: Advice for Levelshifting wanted

  1. #1
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679

    Advice for Levelshifting wanted

    Hi,

    ok, I think I need some help here - I tried the Sn74CBTD3861, which looked good at the first sight, but in my application it has the problem, that it produces too high voltages on the 3V side.
    Reproducable, I tried two chips.
    I think, the problem is, that I added 1K as pull-up - resitors on the 5V side.

    Ok, more details:
    I need level-shifting for (minimum) two busses: Commodore IEC and PS2 (Keyboard, 5V 2x Datalines)

    IEC is :
    1 x 5V -> Teensy input
    1 x Teensy output -> 5V
    3 x 5V <--> teensy bidirectional.

    The speed is not high - absolute maximum is around 300kBIT / second.

    The solution should be small, I don't want masses of transistors and resistors, and I try to use a minimum amount of SMD parts.

    The problem with integrated circuits is : The serial IEC Bus is quite old. It is a active-low bus ("open collector") with 1K PULL-UPs in every device. It is possible to connect up to 8 devices - so 8*5mA = 40mA per line!! max.
    But it is very unlikely that all all lines will be driven low at the same time.

    Transistors + resistors take much room ... and is a lot to solder.

    Does anyone have any hints for me ?

    Edit: + I need a solution for the PS2 Keyboard which is 5V, too.
    Edit2: Later, I want to add the "UserPort" wich adds >10 more 5 Volt signals, bidirectional (but without the pullup resitors on board) "open collector"
    Edit3: Worst case, I can reduce the amount of allowed devices to one, two, or three..
    Edit4: I have NO direction signal for the bidirectional lines.
    Last edited by Frank B; 10-17-2017 at 06:52 AM.

  2. #2
    Senior Member bmillier's Avatar
    Join Date
    Apr 2016
    Location
    Halifax, N.S. Canada
    Posts
    146
    HI Frank. What about the adafruit ID 757 ? These shift between 5 v and 3.3v and are bidirectional. Your freq requirements are much lower than these are rated for. I've used a Sparkfun equivalent to this for SD card (3.3v) SPI bus to 5 v MCUs at 4 MHz SPI clock rate.
    That TI part is odd. The datasheet indicates it should work, especially looking at Figure 2. But in the description they say that there is a diode to Vcc to limit output to 3 volts, but Vcc is specified as 5 v . So, I don't know how that would work.

  3. #3
    Senior Member
    Join Date
    Feb 2015
    Location
    Finland
    Posts
    120
    Quote Originally Posted by Frank B View Post
    I need level-shifting for (minimum) two busses: Commodore IEC and PS2 (Keyboard, 5V 2x Datalines)
    TXB0104 or TXS0104E? You should be able to have five devices per bus (25mA max per bit, 4 per chip = 100mA, which the chips should handle through GND or VCCs). I haven't used either, though, just considered them for my own use. (Ended up going unidirectional, SN74LVC1T45 per bit.)

  4. #4
    Senior Member Epyon's Avatar
    Join Date
    Apr 2013
    Location
    Belgium
    Posts
    443
    The TXB level shifters don't work well with pull-ups and open drain, and are generally a bad idea in almost any use case (and I expect pretty much the same from the TXS). The forum (and that of TI) is full of bad experiences with them.

    Without thinking about it too much, the voltage levels and current drain Frank mentions seem to be in the envelope of an AVR. Maybe use that as a fancy intelligent converter?

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,323
    Since this is an open collector protocol, and your goal is to minimize the number of parts to buy & hand solder, perhaps there's some way to implement it with tri-state buffers. Like connect the input to GND and use the tri-state enable as your signal. Maybe a 74AHCT125 part could do the 3 to 5V and a 74LCX125 part could to the 5 to 3V part?

  6. #6
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,457
    Quote Originally Posted by PaulStoffregen View Post
    Since this is an open collector protocol, and your goal is to minimize the number of parts to buy & hand solder, perhaps there's some way to implement it with tri-state buffers. Like connect the input to GND and use the tri-state enable as your signal. Maybe a 74AHCT125 part could do the 3 to 5V and a 74LCX125 part could to the 5 to 3V part?
    Wow, that's brilliant!

  7. #7
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    @bmillier: thats' almost what i'm doing on my old board, but with a transistor. With trough-hole parts, this needs a lot of room on the board. I would have to test if the bss138 solution is good is this case.. and if i can use the boards.
    @Nominal Animal: these chips don't like pull-up resistors < 50k
    @Epyon: hm, how do i translate the 5 V from AVR to 3.3v?

    @Paul: Great idea - but how would bi-directional work ? I don't get it... I think I need a bit more input :-)

  8. #8
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Click image for larger version. 

Name:	lvlshift125.png 
Views:	92 
Size:	3.5 KB 
ID:	11816
    like this ? (of course different ICs - ignore the"IC1")

  9. #9
    Senior Member bmillier's Avatar
    Join Date
    Apr 2016
    Location
    Halifax, N.S. Canada
    Posts
    146
    @Frank. The Adafruit boards are tiny- 4 channels in about 0.6" X 0.6" package. I've used them, but not with O.C. Configuration with the max pull down current of 40 ma that you quote, worst case.
    Paul's idea is fine for unidirectional, but, like you, I can't off the top of my head figure out how you could use it for a bidirectional line, lacking a direction control pin which you say you don't have.

  10. #10
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,068
    I have also been following this thread, as I am also interested in playing with a board that supports two different types of servos:
    Dynamixel - Half duplex I was using two chips for this 74LVC..126 and a ... 125. Will mostly go at 1mbs

    But I may also support a servo by XYZ which has 4 wires full duplex. Spec says 5v... Not sure if 3.3v will work. So was thinking BSS138 on both RX and TX. Probably could go with other unidirectional converter but if I don't use these servos maybe want the +5v signals for other purposes. With the XYZ servos look like fastest baud is 115200

    So again very interested in ideas for different level shifters.

  11. #11
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Quote Originally Posted by bmillier View Post
    @Frank. The Adafruit boards are tiny- 4 channels in about 0.6" X 0.6" package. I've used them, but not with O.C. Configuration with the max pull down current of 40 ma that you quote, worst case.
    Paul's idea is fine for unidirectional, but, like you, I can't off the top of my head figure out how you could use it for a bidirectional line, lacking a direction control pin which you say you don't have.
    Hi,

    yes, i've verified this. I found a I2C levelshifter like this in my stock, removed both pullups and measured with external resistors. Looks like, the pull-up on the 3V side is not needed, if I use INPUT_PULLUP on the teensy.
    So only two parts - the bss and one 1k pullup on the 5V side. 40mA is OK. I thought about using the boards - the ones you mentioned are a bit expensive.. i'd need two of them for my boards. On alixxpress, they are much cheaper, but take weeks to arrieve and all are different sizes.

    - Is there a bss138 equivalent as through-hole part ?

    If not, I'll use just SMD bss138 + resistors... not nice, but I *really* want to finish it now. I've spend too much time with this..

    Edit: oops..still have to measure the speed - will do that asap.
    Edit:With 1K (on 5V side) ~313ns , with 0.5k 167ns, 0.25k 83ns (rising edge) , falling edge 41ns -thats OK
    Last edited by Frank B; 10-20-2017 at 04:59 PM.

  12. #12
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    @Kurt: This is a simple bidirectional levelshift with a npn (almost all will work - great, because it likely that all needed parts are already in your stock) : https://www.mikrocontroller.net/topic/92447#792742 (German - but the schematic is clear) - this works great. I've used this schematic on the c64-ILI9341-board (you have one)

    This is an interesting document with some new (for me) ideas: http://www.microchip.com/stellent/gr...c/en026368.pdf
    Last edited by Frank B; 10-20-2017 at 04:38 PM.

  13. #13
    Senior Member
    Join Date
    Feb 2015
    Location
    Finland
    Posts
    120
    Quote Originally Posted by Frank B View Post
    Is there a bss138 equivalent as through-hole part ?
    Farnell sells IRLD014, which isn't equivalent, but might be close enough.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •