Shop OBEX P1 Docs P2 Docs Learn Events
serout debugging — Parallax Forums

serout debugging

ArchiverArchiver Posts: 46,084
edited 2001-05-29 02:23 in General Discussion
Hi Brian,

For the SEROUT command to function, the SERIN line must be connected also.
The SEROUT uses the rest voltage of the SERIN line to function.
See stamp manual keyword SERIN and SEROUT.

Greetings peter.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-05-28 23:44
    Thanks Peter!

    I'm not sure how much control I have over the pin connections when using the
    DB-9 on the BOE? Plus, it _does_ work talking to the PC. I'll read about
    those commands more carefully...

    Thanks!

    -Brian

    Original Message
    From: "Peter Verkaik" <peterverkaik@b...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, May 28, 2001 05:51 PM
    Subject: [noparse][[/noparse]basicstamps] RE: serout debugging


    > Hi Brian,
    >
    > For the SEROUT command to function, the SERIN line must be connected also.
    > The SEROUT uses the rest voltage of the SERIN line to function.
    > See stamp manual keyword SERIN and SEROUT.
    >
    > Greetings peter.
    >
    >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-05-29 00:26
    Hi Brian,

    It works with both cables on the PC because the PC's TX and RX pins provides
    the negative rest voltage
    to the Stamp's RX pin and characters are echoed by Stamp on RX pin.

    To be able to send commands to your switch device you need the following
    connections:
    Stamp's TX pin to switch device RX pin
    Stamp's RX pin to switch device TX pin (for the required negative voltage)
    Stamp's GND pin to switch device GND pin
    Check cable for correct connections.

    If your switch device has no TX pin you need to generate a negative voltage
    otherwise.
    (Try connecting Stamp RX to GND, this way Stamp TX swings between GND and
    5V, may work.)
    .
    Greetings peter.
  • ArchiverArchiver Posts: 46,084
    edited 2001-05-29 00:58
    Wow, quick reply! Thanks!

    Forgive my density, but I still don't get it. [noparse]:([/noparse]

    I'm using the stamp's built-in serial capability (Board of Education's DB-9)
    so there is no wiring for me to do. I eventually want to use a different
    pin, but I just want to get the comms working.

    The switch device has TX, RX, and Gnd and works fine connected to the PC via
    a NULL MODEM cable. What do I need to do to the built-in DB-9 to make the
    wiring changes you mention?

    -Brian

    Original Message
    From: "Peter Verkaik" <peterverkaik@b...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, May 28, 2001 07:26 PM
    Subject: [noparse][[/noparse]basicstamps] RE: serout debugging


    > Hi Brian,
    >
    > It works with both cables on the PC because the PC's TX and RX pins
    provides
    > the negative rest voltage
    > to the Stamp's RX pin and characters are echoed by Stamp on RX pin.
    >
    > To be able to send commands to your switch device you need the following
    > connections:
    > Stamp's TX pin to switch device RX pin
    > Stamp's RX pin to switch device TX pin (for the required negative voltage)
    > Stamp's GND pin to switch device GND pin
    > Check cable for correct connections.
    >
    > If your switch device has no TX pin you need to generate a negative
    voltage
    > otherwise.
    > (Try connecting Stamp RX to GND, this way Stamp TX swings between GND and
    > 5V, may work.)
    > .
    > Greetings peter.
    >
    >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-05-29 01:24
    Hi Brian,

    If your switch device has a TX, the problem may be your cabling.
    Assuming you have a null modem cable with 2 DB9 female connectors:

    PC DB9 male switch device DB9 male

    2 (RX)

    (RX) 2
    \ /
    \ /
    X null modem cable
    / \
    / \
    3 (TX)

    (TX) 3
    5 (GND)
    (GND) 5



    PC DB9 male Stamp DB9 female

    2 (RX)
    (TX) 2
    3 (TX)
    (RX) 3
    program cable
    4 (DTR)
    (ATN) 4 only required for
    programming
    5 (GND)
    (GND) 5



    As the null modem cable works between swich device and PC, the switch device
    has a simular pinout as the PC. So to connect the Stamp to the switch device
    you must use the same cable as between stamp and PC, i.e the program cable.



    Switch device DB9 male Stamp DB9 female

    2 (RX)
    (TX) 2
    3 (TX)
    (RX) 3
    program cable
    4 (DTR)
    (ATN) 4 must be disconnected or
    held low
    5 (GND)
    (GND) 5



    Be sure to disconnect the ATN line, keep the switch device DTR low, or place
    a
    capacitor in the ATN line. This prevents the stamp resetting. Best to make a
    3-wire
    cable for connection to switch device to avoid any problems.

    Hope this clearifies the cabling.
    Greetings peter.
  • ArchiverArchiver Posts: 46,084
    edited 2001-05-29 01:46
    That does help - and I have some more data!

    Here's the testing I did.

    I have two cables - the black one that came with the BOE and a grey one I
    know is a NULL modem cable. I also have a NULL modem adapter for testing.

    Connecting the BS2 to the PC, I tried 4 ways:

    'Black' cable direct = comms ok
    'Black' cable w/NULL MODEM = comms ok!
    'grey' cable direct = comms ok
    'grey' cable w/NULL MODEM (makes it a straight-thru) = comms ok!

    That tells me that the DB-9 on the DOE sends on _both_ the TX & RX pins!?
    Perhaps my switch doesn't like that.

    Then I tried another test. I wired up a DB-9 connector with only 2 pins
    connected = pin 5 to Vss (ground) and pin 3 to BS2-pin 15.

    I then connected that DB-9 to the PC:

    'Black' cable direct = No comms.
    'Black' cable w/NULL MODEM = Comms ok!
    'Grey' cable direct = Comms ok!
    'Grey' cable w/NULL MODEM = No comms!

    This is as I would expect and it also tells me that the black cable that
    came with the BOE is a straight-thru.

    Now, on to the switch. Connecting the BS2 to the switch in any of the four
    combinations did not work. From this I have two guesses:

    1. The switch does not like both TX/RX driven at the same time
    and/or...
    2. The switch (make in Europe) does not tolerate the 'non-standard' RS-232
    (0-5V instead of -10 - 10V).

    What do you think? Thanks so much for your patience...

    -Brian

    Original Message
    From: "Peter Verkaik" <peterverkaik@b...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, May 28, 2001 08:24 PM
    Subject: [noparse][[/noparse]basicstamps] RE: serout debugging


    > Hi Brian,
    >
    > If your switch device has a TX, the problem may be your cabling.
    > Assuming you have a null modem cable with 2 DB9 female connectors:
    >
    > PC DB9 male switch device DB9 male
    >
    > 2 (RX)

    (RX) 2
    > \ /
    > \ /
    > X null modem cable
    > / \
    > / \
    > 3 (TX)

    (TX) 3
    > 5 (GND)
    (GND) 5
    >
    >
    >
    > PC DB9 male Stamp DB9 female
    >
    > 2 (RX)
    (TX) 2
    > 3 (TX)
    (RX) 3
    > program cable
    > 4 (DTR)
    (ATN) 4 only required for
    > programming
    > 5 (GND)
    (GND) 5
    >
    >
    >
    > As the null modem cable works between swich device and PC, the switch
    device
    > has a simular pinout as the PC. So to connect the Stamp to the switch
    device
    > you must use the same cable as between stamp and PC, i.e the program
    cable.
    >
    >
    >
    > Switch device DB9 male Stamp DB9 female
    >
    > 2 (RX)
    (TX) 2
    > 3 (TX)
    (RX) 3
    > program cable
    > 4 (DTR)
    (ATN) 4 must be disconnected
    or
    > held low
    > 5 (GND)
    (GND) 5
    >
    >
    >
    > Be sure to disconnect the ATN line, keep the switch device DTR low, or
    place
    > a
    > capacitor in the ATN line. This prevents the stamp resetting. Best to make
    a
    > 3-wire
    > cable for connection to switch device to avoid any problems.
    >
    > Hope this clearifies the cabling.
    > Greetings peter.
    >
    >
    >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-05-29 02:23
    Hi Brian,

    Cabling RS232 can be a real nag..

    >Here's the testing I did.

    >I have two cables - the black one that came with the BOE and a grey one I
    >know is a NULL modem cable. I also have a NULL modem adapter for testing.

    >Connecting the BS2 to the PC, I tried 4 ways:

    >'Black' cable direct = comms ok
    >'Black' cable w/NULL MODEM = comms ok!
    >'grey' cable direct = comms ok
    >'grey' cable w/NULL MODEM (makes it a straight-thru) = comms ok!

    >That tells me that the DB-9 on the DOE sends on _both_ the TX & RX pins!?
    Anything send to the stamp is echoed directly back on the RX. This is how
    the Stamp operates, sadly enough.

    >Perhaps my switch doesn't like that.
    Does your switch send out data through its TX pin?
    This data is echoed onto the RX and thus received by the switch.

    >Then I tried another test. I wired up a DB-9 connector with only 2 pins
    >connected = pin 5 to Vss (ground) and pin 3 to BS2-pin 15.
    Ok, pin5=GND and pin3=TX as seen from the stamp

    >I then connected that DB-9 to the PC:

    >'Black' cable direct = No comms. --> obviously, stamp TX to switch TX
    >'Black' cable w/NULL MODEM = Comms ok! --> TX/RX crossed, stamp TX to
    switch RX
    >'Grey' cable direct = Comms ok! --> TX/RX crossed, same as above
    >'Grey' cable w/NULL MODEM = No comms! --> TX/RX crossed twice, stamp TX to
    switch TX
    It all makes perfectly sense!

    >This is as I would expect and it also tells me that the black cable that
    >came with the BOE is a straight-thru.
    Yes, the program cable is a 1 to 1 cable.

    >Now, on to the switch. Connecting the BS2 to the switch in any of the four
    >combinations did not work. From this I have two guesses:

    >1. The switch does not like both TX/RX driven at the same time
    >and/or...
    >2. The switch (make in Europe) does not tolerate the 'non-standard' RS-232
    >(0-5V instead of -10 - 10V).

    >What do you think? Thanks so much for your patience...
    Both guesses may be true.
    True RS232 requires voltages +3/+10 for a logic 0, and -3/-10V for a logic
    1.
    Therefore you should try the 3-wire connection I advised. It may be
    necessary
    though to add local RTS/CTS and DTR/DSR/DCD connections if your switch
    requires
    handshaking (check docu). So a complete cable should look like:

    Switch device DB9 male Stamp DB9 female

    1 (DCD) ---+
    |
    2 (RX)
    (TX) 2
    |
    3 (TX)
    (RX) 3 must be disconnected if
    switch sends data
    |
    4 (DTR) ---+
    |
    5 (GND)
    (GND) 5
    |
    6 (DSR) ---+
    7 (RTS)----+
    |
    8 (CTS) ---+
    9 (RI)

    However, if the switch sends data out through its TX pin, then you must
    disconnect
    this pin, which then leaves you with the negative voltage problem.
    In that case a 9V battery with + to ground and - to Stamp RX might help.
    (I would add a 1k series resistor to RX for safety).

    Greetings peter.
Sign In or Register to comment.