Shop OBEX P1 Docs P2 Docs Learn Events
RS-232 to Prop Questions — Parallax Forums

RS-232 to Prop Questions

Kevin HortonKevin Horton Posts: 21
edited 2010-03-14 01:17 in Propeller 1
I'm a Prop and electronics newbie, so don't make any assumptions about my knowledge.

I need to receive data from an RS-232 device. I don't need to transmit from the Prop to the device - this is a receive only application. Comms are at 115,200 baud. I don't know what the voltage of the RS-232 is, as the RS-232 output is a seldom used aspect of this device, and the device specs don't provide the voltage, nor do I have an oscilloscope. I suspect the voltage is between 12 and 16v. I've got 3.3v and 5v available on the board to supply devices.

What is the simplest means to interface RS-232 with the Prop? My searching so far points at the MAX232. If I use a MAX232, given that I only need to receive from a single device, do I need all the capacitors that are shown in the datasheet, or can I leave some of them off the board? I assume that if my device is on channel 1 (pins 8, 10, 11 and 13), that I don't the capacitor on channel 2 (pins 4 and 5). What about the ones on the VS+ and VS- lines (pins 2 and 6). I surmise the capacitors are used for a charge pump to create the 30V that the device is rated to supply. If I am not transmitting to an RS-232 device, do I need any capacitors at all?

Given that I am only using a tiny subset of the MAX232's capabiities, is there a smaller, cheaper device I should consider instead?

Thanks for your advice.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Kevin Horton
Ottawa, Canada

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-02-28 02:45
    Skip the MAX232 as the receivers are little better than an NPN transistor. The simplest way to do it and one that I have used too is to simply use a series resistor of around 100K with a pull-down of 10K on the RS-232 side. So it doesn't matter then that the voltage swing is 0 to 3V of +/-12V as the current is limited by the resistor and clamped by the Prop's I/O structure. The serial objects usually have a mode which you can set to say that the input is "inverted" so that the line normally idles low rather than high.

    As I said I have used this method and in fact many of my RS232 products implement the extra inputs this way and these inputs have been retasked as extra serial inputs without any problems. There is always the possibility that having too high a resistance can limit the speed that you can use due to the RC filter (very small C) that is formed but even 115.2K is still considered very low speeds for digital signals.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • LeonLeon Posts: 7,620
    edited 2010-02-28 05:13
    You should be using the MAX3232 anyway, the MAX232 is only intended for 5V operation. That said, I have used the 5V MAX202 at 3.3V without any problems when I haven't had a MAX3232 handy. The 3232 and 202 have the advantage that they use 100nF capacitors.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2010-02-28 05:14
    If you do go with the max232, you do need all 4 capacitors regardless if you are only using one of the 4 gates.

    Max232 = series 1k resistor to the prop to do the 5V to 3V translation
    Max3232 = no 1k needed

    Peter's solution works too. I've used that a lot with Picaxe chips, though with 22k rather than 100k. Just watch which side the 10k pulldown goes and maybe post here a schematic or a photo.

    If you use the two resistor solution, the polarity is inverted, but the propeller can handle that.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.smarthome.viviti.com/propeller
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-02-28 12:19
    MAX232 style chips (not the brand) are way way overrated, they don't implement RS-232 properly by the standard anyway which is why I said they are little better than an NPN for reception. Plus the only reason for an NPN is to invert the signal to work with standard UARTs but the Prop does all this in software, so why bother with all these redundant bits?

    Anyway, here is a circuit and the actual readings for that circuit. This was interfaced to a PC which actually has higher output levels than a MAX232 type chip. The Propeller's rails are at 3.3V the whole time and if you look at the RESISTIVE RS232 circuit you see the maximum current was less than 100ua. I had a batch of units that needed extra RS232 receive inputs and I only had a single DB9 RS-232 connector although all the pins were connected to the Propeller with three inputs using resistors alone (see RS232 DTE). I could not have done this with any other processor but as we know the Propeller chip is very flexible so I was able to create the extra serial inputs on what are normally handshake lines. These are and have been working perfectly in 24/7 environment (Digital Radio) without a hitch (or glitch). There are many other applications that I use this type of circuit in all without problems. The switching threshold of the Prop and of MAX style chips are very similar.

    The rise and fall times to threshold were less than 250ns which means I could use a 1M resistor instead and still be good for 115.2K baud easily, how about that!

    BTW, I use a MAX232 style chip in my circuit for COMPLIANCE reasons only but many of my non-commercial circuits don't even bother.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
    695 x 453 - 15K
    767 x 423 - 16K
  • Kevin HortonKevin Horton Posts: 21
    edited 2010-02-28 13:05
    Thanks everyone for the info. I like Peter's suggestion, as I can implement it with the stuff I already have, rather than wait a week or more until I can get a MAX 232 or 3232. I also like that it will take up less space on the board.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Kevin Horton
    Ottawa, Canada
  • Kevin HortonKevin Horton Posts: 21
    edited 2010-03-14 01:17
    I was on the road quite a bit in the last two weeks, and other priorities got in the way of this project. Today I finally found some time to connect the serial device to the Prop, using the two resistor method suggested by Peter. I am very happy to report that I am receiving data that matches the published specs for the device, so it is clear that this simple method is working.

    Thanks everyone for the advice and assistance.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Kevin Horton
    Ottawa, Canada
Sign In or Register to comment.