Shop OBEX P1 Docs P2 Docs Learn Events
RS232 for Propeller — Parallax Forums

RS232 for Propeller

Steve AndruesSteve Andrues Posts: 29
edited 2014-08-01 11:00 in Propeller 1
I have a Propeller Professional Development Board (which looks remarkably similar to my Basic Stamp Professional Development Board) both of which are populated with everything to make an RS-232 interface work. Does anyone have a clue on how to make a Propeller speak RS-232? It seems simple enough until you get to the bit-bashing. I cannot find any online help. The basic assumption seems to be that this is so easy to implement that it does not require any further discussion or documentation. Help would be greatly appreciated.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-06-06 22:56
    Check out the FullDuplexSerial object in the Spin library that's included with the Propeller Tool IDE.

    -Phil
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-06-06 23:33
    The main point here is that one doesn't have to recreate PASM from scratch, the OBEX provides perfectly good objects for you to use. And when you load the Propeller Tool, there is a full set of objects and examples that have proven most stable and useful... including your RS232 interface. (There is also a tutorial and documentation.)

    It is worth taking a bit of time to acquaint yourself with where all the provided resources are.

    'Bit-bashing' is optional. .. You can use C or Forth or Basic.... even SPIN. But somebody does the 'bit-bashing' in just about any platform, OS, and language to get the i/o to work for you. Even in C, under its hood -- in the libraries -- are segments of 'bit-bashed' code that make it all work so well.

    In other words, it is a skill that adds value to any programmer's resume. Parallax includes the ability to learn it as an opportunity, not a burden.

    http://www.parallax.com/downloads/propeller-tool-software
  • Steve AndruesSteve Andrues Posts: 29
    edited 2014-06-07 19:43
    Check out the FullDuplexSerial object in the Spin library that's included with the Propeller Tool IDE.

    -Phil

    I have used FullDuplexSerial.Spin in a number of projects and it works very well. The problem I am having is implementing an RS232 port with the Propeller. The Propeller Professional Developers Board has a DB-9 connector on it. It has Rx, Tx, CTS, and RTS connections on it. How do I connect these to the Propeller such that FullDuplexSerial.Spin will talk to it? FullDuplexSerial.Spin has arguments for RxPin and TxPin which are straight forward. What do I do with CTS and RTS to make the handshaking work? In my perfect world the Propeller would be able to send data to the host PC when it was not interrogated, i.e. emergency announcement; the communication ability needs to be bidirectional. How do I physically implement the RS232 port? What does the code look like for handshaking?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-06-07 19:52
    There's a MAX3232E chip onboard the does the RS232 conversion. There's also an adjacent header with TX and RX clearly marked. These connect to the MAX3232E. Connect the Prop pins to those, and you will be good to go.

    -Phil
  • Mike GreenMike Green Posts: 23,101
    edited 2014-06-07 19:59
    You have to be careful what you mean by RS232 other than Rx, Tx, and Gnd. Do you mean just CTS and RTS? Do you mean DTR, DCD and DSR as well? How about RI? Back in the days of slow modems, all were used.

    If you're referring just to Rx, Tx, Gnd, CTS, and RTS as implemented on the PPDB's DB-9 connector, a number of serial I/O drivers other than FullDuplexSerial implement the handshaking lines (CTS and RTS). See this one.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-06-07 20:57
    I have used FullDuplexSerial.Spin in a number of projects and it works very well. The problem I am having is implementing an RS232 port with the Propeller. The Propeller Professional Developers Board has a DB-9 connector on it. It has Rx, Tx, CTS, and RTS connections on it. How do I connect these to the Propeller such that FullDuplexSerial.Spin will talk to it? FullDuplexSerial.Spin has arguments for RxPin and TxPin which are straight forward. What do I do with CTS and RTS to make the handshaking work? In my perfect world the Propeller would be able to send data to the host PC when it was not interrogated, i.e. emergency announcement; the communication ability needs to be bidirectional. How do I physically implement the RS232 port? What does the code look like for handshaking?

    CTS RTS are not required normally and the FIFOs on serial ports normally buffer any data until the PC gets around to using. If your serial connection is only a few metres then I would try running the txd straight from the Prop pin via a 220R series resistor. You could do the same for the txd from the PC by just using a 100K series resistor and a pulldown on the 232 side of the same value. Just set the mode for inverted rx/tx in FDS. If you have 5V available you could boost the Prop's txd up to 5V with a simple gate but there's no real need as RS232 port thresholds are around 1.2V low and 1.8V high.

    Another suggestion is just connect to the PC's USB port with a FT232 chip and skip the physical RS232 port. The FIFOs in these chips are quite large.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-06-07 21:06
    Peter,

    He's got a PPDB that's already pre-wired with a MAX3232. All he has to do is connect TX and RX for a minimal RS232 conneciton -- no resistors or inverted protocol required.

    -Phil
  • edited 2014-08-01 11:00
    So for a complete newb like me, what 4 pins on the Propeller Professional Development board Propeller bus should be connected to the RS-232 port RTS, TSX, CTS and RX pins. As a reminder, the pro board is not like the regular Board of Education with labeled com ports.
    I am trying to read the Parallax Serial terminal.spin and the FullDuplexSerial.spin. code. I can see where they are called out long, but what are the numerical values?
    Kind Regards,
    Steve
Sign In or Register to comment.