Shop OBEX P1 Docs P2 Docs Learn Events
Connecting RX/TX to another MCU — Parallax Forums

Connecting RX/TX to another MCU

I want to connect a Sparkfun ESP8266 Thing Dev module to a Quickstart module and want to make sure I don't fry anything. I'm powering the Quickstart from the +5V output of the ESP8266 module and that seems to work fine. However, I also need to connect the Propeller TX, RX, and RESn pins to GPIO pins on the ESP8266. I'd like to use a series resistor to prevent issues if I for some reason end up driving the connection from both ends at the same time. (My programs never work correctly the first time!) What value resistor should I use?

Comments

  • They both run at 3.3V so even if you connected them up incorrectly and both tried to drive the line in opposite directions it is still unlikely that you would fry anything. You can however use 220R or 1k etc in series in each line. I very much doubt that anything under 10k would ever be a problem.
  • Heater.Heater. Posts: 21,230
    I have used 220 ohms in the Rx and TX lines when connecting Props to Raspberry Pi or MIPS routers.

    On the totally unscientific basis that it will limit current to 15mA and that ought to be good enough to prevent damage.

    What is the max output current of an ESP8266 pin?

    No resistor in series on the RESn pin.
  • I don't think there is a datasheet available for the ESP8266, at least I haven't found one. Not sure how much current it can output.
  • Okay, I guess I'm wrong. There is this:

    https://nurdspace.nl/ESP8266#Specifications

    It says that the maximum current is 12mA.
  • Anyway, thanks for your advice. I'll try 220 ohm resistors.
  • kwinnkwinn Posts: 8,697
    David Betz wrote: »
    Anyway, thanks for your advice. I'll try 220 ohm resistors.

    After going through the "what resistor to use for 5V inputs" discussion several times on the forum I have gone from 1K to 2.7K, 3.3K, 3.9K, and am now using 4.7K. I have never damaged a pin using the lower values but that may just be luck. The 4.7K (and occasionally 10K when I was out of 4.7K) have worked quite well for interfacing propeller, Pi, Odroid, and various interface hardware up to 2.5MHz clock speed.

  • kwinn wrote: »
    David Betz wrote: »
    Anyway, thanks for your advice. I'll try 220 ohm resistors.

    After going through the "what resistor to use for 5V inputs" discussion several times on the forum I have gone from 1K to 2.7K, 3.3K, 3.9K, and am now using 4.7K. I have never damaged a pin using the lower values but that may just be luck. The 4.7K (and occasionally 10K when I was out of 4.7K) have worked quite well for interfacing propeller, Pi, Odroid, and various interface hardware up to 2.5MHz clock speed.
    Thanks but the ESP8266 and the Propeller both use 3.3v as far as I know.

  • kwinnkwinn Posts: 8,697
    David Betz wrote: »
    kwinn wrote: »
    David Betz wrote: »
    Anyway, thanks for your advice. I'll try 220 ohm resistors.

    After going through the "what resistor to use for 5V inputs" discussion several times on the forum I have gone from 1K to 2.7K, 3.3K, 3.9K, and am now using 4.7K. I have never damaged a pin using the lower values but that may just be luck. The 4.7K (and occasionally 10K when I was out of 4.7K) have worked quite well for interfacing propeller, Pi, Odroid, and various interface hardware up to 2.5MHz clock speed.
    Thanks but the ESP8266 and the Propeller both use 3.3v as far as I know.

    True, but 4.7K also works for 5V <> 3.3V and 3.3V <> 2.5V as well, and with lower currents through the clamping diodes, which is always a good thing. Also reduces the number of components I need to stock.
  • kwinn wrote: »
    David Betz wrote: »
    kwinn wrote: »
    David Betz wrote: »
    Anyway, thanks for your advice. I'll try 220 ohm resistors.

    After going through the "what resistor to use for 5V inputs" discussion several times on the forum I have gone from 1K to 2.7K, 3.3K, 3.9K, and am now using 4.7K. I have never damaged a pin using the lower values but that may just be luck. The 4.7K (and occasionally 10K when I was out of 4.7K) have worked quite well for interfacing propeller, Pi, Odroid, and various interface hardware up to 2.5MHz clock speed.
    Thanks but the ESP8266 and the Propeller both use 3.3v as far as I know.

    True, but 4.7K also works for 5V <> 3.3V and 3.3V <> 2.5V as well, and with lower currents through the clamping diodes, which is always a good thing. Also reduces the number of components I need to stock.
    So are you saying that 220 ohms is too low?

  • Heater.Heater. Posts: 21,230
    edited 2015-12-24 14:58
    Depends.

    The idea here is that if both ends of the line are being driven, one high and one low, we want to limit the resulting current between them so that nothing blows. If we know what the pins in question can safely sink/source then Ohms law tells us what we need.

    Example, 3.3v devices, max 10ma, R = V / I = 330 ohms.

    As that is the max current then that is the minimum resistor value we would use.

    One could err on the side of caution and decide that 5ma is the worst we want to see. Then 680 ohms would be the choice. Or 1ma and 3.3K ohms.

    But, get too cautious and all that resistance is going to cause communications to fail, especially at high frequencies. How high would the resistance be to cause a problem? No idea. Never pushed it up that way.

    Things are different when mixing 3.3 an 5 volt devices. Then we have to worry about the 5v device pushing current through the input protection diodes of the 3.3v device and popping them. Anyway we certainly don't want the 5v input overcoming the 3.3v devices power supply and effectively powering it with 5v through the pin.

    I have never heard a hard and fast rule for series resistor selection. There is a wide range that will do the job. Too low does nothing, too high and comms might start to fail. Except we know there is a hard limit on the low value end of the range.

    Normally it comes down to whatever is to hand at the time :)
  • kwinnkwinn Posts: 8,697
    What heater said, plus, one has to take into consideration the distance the signal must travel. For signals that are traveling a few inches between chips on a single board or between two interconnected stacked boards a 4.7K resistor has worked fine up to 2.5MHz for me. YMMV
  • Heater.Heater. Posts: 21,230
    Yep. For long connections and high data rates it's time to start looking at reflections, impedance matching, transmission line theory. Time to use proper line drivers for RS485 or whatever.
Sign In or Register to comment.