Shop OBEX P1 Docs P2 Docs Learn Events
3.3 volt TTL I/O with BS2P — Parallax Forums

3.3 volt TTL I/O with BS2P

MicheleMichele Posts: 23
edited 2010-09-14 22:01 in BASIC Stamp
I got my Netburner SB70-LC board running as a replacement for my PINK that expired. I can communicate with it over the net, but not from my BS2P. I'm using UART0 on the SB and flashed it with the latest Parallax firmware.

All I can think of is that the SB70-LC is a 3.3 volt device and the BS2P is 5 volts. I was under the impression that the logic threshold for High was 2.0 volts for both 5 and 3.3 v. TTL so it should just work.

So is this true and I have some other problem going on? If the BS2P won't recognize a 3.3 volt input as high, what's the easiest way to get my BS2P and SB70-LC talking to each other? Any help would be greatly appreciated.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-09-14 11:02
    You can't just connect 3.3V devices with 5V devices. The danger is that the 5V outputs of the Stamp can damage the 3.3V inputs of the Netburner unless the Netburner inputs are "5V tolerant". Going the other way should work since the 3V high outputs are well above the 2.5V threshold of the Stamp.

    When the Stamp outputs are at 5V (4.7V usually), this is well above the threshold for the static protection diodes on 3.3V inputs, these will conduct and something downstream will be damaged.

    When connecting 3.3V inputs to 5V outputs, you normally use a 1K or 2.2K series resistor to limit the fault current to something the 3.3V inputs can handle.
  • MicheleMichele Posts: 23
    edited 2010-09-14 11:20
    OK, so then I should connect a resistor between the Stamp's output pin and the SB70's 3.3 volt input? And then what about connecting the SB70's 3.3 volt output to the Stamp's input? Will the Stamp read that directly or do I need a pull-up resistor or something? (I hope I haven't already cooked something). Thanks.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-09-14 11:24
    You don't have to have a resistor between a 3.3V output and a Stamp's 5V input, but it's commonly used because the 3.3V output might be an input before the SB70 initializes it properly and the Stamp's input might accidentally be made an output due to a bug in your program.
  • MicheleMichele Posts: 23
    edited 2010-09-14 11:33
    So basically then just a 2.2K resistor between each pin on the two devices?
  • Mike GreenMike Green Posts: 23,101
    edited 2010-09-14 12:01
    That's what I do. There are other situations where you may need some kind of interface hardware, but a 2.2K resistor works most of the time.

    There's a permanent thread in the Propeller forum that discusses this issue. Have a look here.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2010-09-14 13:41
    Mike,
    I usually use a voltage divider circuit to drop the voltage. Are there some guide lines as to which way is best? Does it depend on whether it is signal versus a load?

    Thanks,
    Ron
  • Mike GreenMike Green Posts: 23,101
    edited 2010-09-14 15:51
    A voltage divider reduces the voltage applied to the 3.3V input, but requires 2 parts. It requires a high impedance input otherwise the voltage drop is higher. A series resistor depends on the internal protective diode to draw enough current for the resistor to drop the voltage below 3.3V. Both schemes work.
  • MicheleMichele Posts: 23
    edited 2010-09-14 17:56
    Well I just tried it out. I inserted a 1K resistor between the Stamp and the SB70LC in each direction (ie. Stamp -> 1K -> SB70LC). At first nothing happened - I still couldn't read or write. So I moved the wires from UART0 on the SB70LC to UART1 and tried it again. Now it's working great. I can now read and write variables in the SB70LC directly from the Stamp just like with my former PINK module.

    So I don't know if I cooked UART0 from my first try where I was running without the resistors or if the SB70LC was configured to respond to UART1 rather than 0 all along. And I can't find a copy of the original Netburner firmware that let me set various parameters of those two ports. So I guess I'll just continue using UART1 and consider myself lucky. Plus I got a nice lesson in 5 <-> 3.3 volt interconnectivity. And the Propeller thread on this subject was great. Thanks Mike for the pointer and for all your help.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2010-09-14 19:18
    Michele,
    I believe the PINK firmware only supports UART1. The Parallax PDF shows the proper connections using pins 3 and 4 (Debug port)

    I think I saw that somewhere on the NetBurner web site.

    EDIT: It might be selectable with the IPSETUP program - see DOC
  • MicheleMichele Posts: 23
    edited 2010-09-14 22:01
    Yes, you're right. I had been using pins 3 and 4, called "Serial port 1", on my PINK. I guess I was confused because the Parallax documentation lists port 1 as the "debug port" but the Netburner docs list port 0 as the debug port.

    So, bottom line is no harm done, and I was able to replace my old 5 volt SB70 with a 3.3 volt SB70LC (which is $20 cheaper) running the latest Parallax firmware. All I needed was an LM317T regulator to get the 3.3 v. Vcc and two 1K resistors between the serial lines. Hopefully this thread may be of use to someone else trying to use the SB70LC.
Sign In or Register to comment.