Shop OBEX P1 Docs P2 Docs Learn Events
RS232-connections To a pc — Parallax Forums

RS232-connections To a pc

nomadnomad Posts: 276
edited 2007-02-18 11:16 in Propeller 1
RE: RS232-connections To a pc
hi folks,
i am interesting to build a rs232-connection from a propeller-chip to
a linux laptop and visiversa.
first question (hardware):
is the circuit description found under SerialtoPropeller.pdf
the only one????
or its possible to build the hardware with a
"MAX 3222 CPN - IC" (DIL 18)
(vcc: 3...5.5Volt, and 4 x condensators at 0.1uF)
have you any suggestions and layouts for me???
second question(software):
on the "simple_Serial-spin"
part.............
·code:··
· if lookdown(rxPin : 0..31)··························· ' qualify rx pin
··· sin := rxPin
··· inverted := (baud < 0)····························· ' set inverted flag
··· .....·············································· ' calculate serial bit time
···
· if lookdown(txPin : 0..31)
··· sout := txPin
··· inverted := (baud < 0)····························· ' set inverted flag
its possible insteed of if lookdown(rxPin : 0..31) or
if lookdown(txPin : 0..31)
to do that (that only pseudoCode)
p8·· == rxPin········
sin· := rxPin
p9·· == txPin
sout := txPin

third question:
···· serial.start(0, 1, -9600)
is this statement correct for
·· baud··· : 9600
·· Databits: 8····
·· Paritaet: none
·· stopBits: 1
thanks for all answers
as attachments:
SerialtoPropeller.pdf
simple_Serial-spin
greetings
nomad

Comments

  • ForrestForrest Posts: 1,341
    edited 2007-02-13 11:32
    Here's a 3.3V serial to TTL converter for $11.75 that should do the job www.acroname.com/robotics/parts/S13-SERIAL-INT-CONN.html
  • nomadnomad Posts: 276
    edited 2007-02-13 14:09
    hi forest,

    thanks for your answer.

    but i am living in switzerland and have no connection to this company.

    greetings

    nomad
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-02-13 14:59
    Nomad,
    I have built a serial to propeller circuit using an ST232 - ST microelectronics version of the MAX232 - a 3v capable version.I made a quick schematic for you (attached)·- hope it helps.

    I have also included the PDF of the suitable 232 driver Vcc range from 3v to 5.5v - so its suitable for the 3.3v supply ... and a pdf of a 24lc256 DIP package with a VCC range from 2.5v to 5.5v -·again suitable for 3.3v operation.

    Might also be worth while reading the following thread ...
    http://forums.parallax.com/showthread.php?p=626362

    Have now named the transistor Q1 correctly in my sample ! - also added some app nortes...Rgds,Quattro

    Post Edited (QuattroRS4) : 2/13/2007 3:58:18 PM GMT
  • nomadnomad Posts: 276
    edited 2007-02-13 16:24
    hi quadro,

    first excuse, i have read first your PM, and don't found the attachments.

    now its all ok.

    thank you for your help.

    regards

    nomad
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-02-13 16:26
    Hope it helps you out ..... thats what this forum is all about ...

    Rgds,
    Quattro
  • ForrestForrest Posts: 1,341
    edited 2007-02-13 17:29
    It's not clear from your original post whether or not you want to PROGRAM the propeller with a Linux PC, or merely COMMUNICATE to the propeller with a Linux PC. PROGRAMMING requires a connection to the RSTn pin on the Propeller - as shown Quatro's Nomad_Sample.pdf. COMMUNICATION can use a simpler circuit using a MAX3232 and (4) 0.1uF capacitors to shift the voltages to/from RS232 to TTL.
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-02-13 17:49
    Forrest,
    I wasn't sure either so the example I gave can be used to program AND communicate ...

    After the device is programmed a simple 3 wire cable can be used for communication i.e. rx,tx,gnd if someone so wished. This gives the option to use it for both - I also attached a link in an earlier post where by I ran serial tx from prop to hyperterminal without any 232 support i.c - just a 4.7K resistor ... not really ideal but works as a test .


    http://forums.parallax.com/showthread.php?p=626362



    here I posted:




    Quattro
    QuattroRS4 said...
    squidx

    Personally I would prefer to use a 232 driver - but further to your query -


    I ran a trial just now for you - using a demo board - to a laptop which has a third party usb to serial device as its serial port.

    connections as follows - Vss on demoboard to pin5 (gnd) on p.c serial port
    P0 on demoboard through a 4.7K resistor to pin 2 on P.C serial port

    On the pc start up hyperterminal - 9600,N,8,1 and flow control 'None'

    Do the following with the Propeller IDE -

    CON
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000

    OBJ
    ExtSerial : "FullDuplexSerial"

    Pub Test1
    extserial.start(-1, 0, 2, 9600) ' (transmit only)- rxpin,txpin,mode,Baud - depends on your set up

    repeat 5 ' repeat 5 times
    · extserial.str(string("Hello World 'concatenating' "))
    · waitcnt(100_000_000 + cnt) 'wait a length of time
    extserial.str(string(13,10)) 'move to new line
    repeat 5
    · extserial.str(string("Hello World in a new line each time!",13,10))
    · waitcnt(100_000_000 + cnt) 'wait a length of time

    You should see the results in hyperterminal window.

    You may have to adjust the 'Mode' to suit your needs .... mine worked in both modes 2 and 3
    Post Edited (QuattroRS4) : 2/13/2007 8:58:02 PM GMT
  • TrevorTrevor Posts: 8
    edited 2007-02-14 04:59
    Forrest said...
    It's not clear from your original post whether or not you want to PROGRAM the propeller with a Linux PC, or merely COMMUNICATE to the propeller with a Linux PC. PROGRAMMING requires a connection to the RSTn pin on the Propeller - as shown Quatro's Nomad_Sample.pdf. COMMUNICATION can use a simpler circuit using a MAX3232 and (4) 0.1uF capacitors to shift the voltages to/from RS232 to TTL.

    I'm new at this so sorry if this question is kind of dumb, but is there a schematic anywhere that shows this simple communication circuit? I have a MAX3232 and a few 0.1uF capacitors but the circuit i was viewing also required a transistor or two and was once again aimed towards programming. I am attempting to communicate with a MaxStream RF modem through serial and I'm still trying to figure out how to do so.

    Anyway, thanks in advance.
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-02-14 05:28
    Well - its here !!
  • nomadnomad Posts: 276
    edited 2007-02-14 12:15
    hi forester, quadro, trevor and everbody,
    woh......

    thanks for all answers...

    excuse my unclear question.
    i want only communicate with the linux laptop via rs232,
    NOT programming.
    and thanks for the reference to the MAX232

    first i buy the stuff and then build and test the whole stuff.
    and then i make a call to the forums.

    and excuse my bad english.

    thanks to all people
    regards
    nomad
  • nomadnomad Posts: 276
    edited 2007-02-14 12:44
    hi forester,
    now i have look on your Nomad_Sample.PDF
    thanks for the layout.

    first i have a) PropellerChicp-DemoBoard
    ·············· b) PropStickUSB

    the rs232-communications should be running on both devices
    => DemoBoard only for testing the stuff

    => production on PropStickUSB my project a QuadraPod Spider

    few questions:
    first: with the PropStickUSB (32210propstickusbv1.1.pdf)
    the pins 28-31 are used:
    ·· - 28/29 -> eeprom
    ·· - 30/31 -> usb-connections

    so, can i use another pins for the added rs232 connection??

    perhaps pin 0 pin 1 ?

    attachment: 32210propstickusbv1.1.pdf

    thanks for all answers.
    greetings
    nomad
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-02-14 13:25
    Nomad,
    You sure can use the same theory as the example shown to use other pins for serial coms. If you see the Quote I included from a different post whereby I ran a test for serial coms without a 232 driver. You can do the same but I recommend that you use the driver.


    Quattro[noparse][[/noparse]code]CON
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000

    OBJ
    ExtSerial : "FullDuplexSerial"

    Pub Test1
    extserial.start(1, 0, 2, 9600) ' rxpin,txpin,mode,Baud - depends on your set up

    repeat 5 ' repeat 5 times
    ·extserial.str(string("Hello World"))

    will send 'Hello World'


    'extserial.start(1, 0, 2, 9600) ' rxpin,txpin,mode,Baud -adjust to suit your needs



    Post Edited (QuattroRS4) : 2/14/2007 1:47:04 PM GMT
  • nomadnomad Posts: 276
    edited 2007-02-14 13:29
    hi everbody,
    i have a look to my distributor:
    - no ST232 available but
    the MAX2322· as attachment: the datasheet
    i think that is basically the same stuff???

    so, after study your nomad_sample.pdf

    (yeah a pdf with my name ;-))

    i think i must build only the rs232-circuit(leftUp)
    and change the pins.

    greetings
    nomad
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-02-14 13:42
    Nomad,
    The version you have shown here··is the same and is a 3v to 5.5v version so it will be fine..

    QuattroRS4

    Post Edited (QuattroRS4) : 2/14/2007 1:51:05 PM GMT
  • nomadnomad Posts: 276
    edited 2007-02-14 16:17
    hi quadro,

    thanks for your help.

    first:
    i am verry careful.
    now i buy the MAX 3222 AND the MAX 3232·
    for all possiblities


    second:
    i have read your answer.

    you write:
    <<I ran a trial just now for you
    - using a demo board -
    to a laptop which has a third party
    usb to serial device as its serial port>>.

    my answer: yes i have this devise on german: usb to rs232-Adapter.
    no proplem with the linux laptop

    your write:

    << connections as follows
    - Vss on demoboard to pin5 (gnd) on p.c serial port
    P0 on demoboard through a 4.7K resistor to pin 2 on P.C serial port>>

    it this right

    demoboard VSS (gnd)· to ->·· serialPortLaptop Pin5 (gnd)
    demoboard P0 -> 4.7K to ->·· serialPortLaptop Pin2

    its correct??
    if yes, woh..

    on linuxLaptop i can running without problems the linuxHyperterminal or
    my own serialProgram (lowLevel)

    << On the pc start up hyperterminal - 9600,N,8,1 and flow control 'None' >>


    thanks verry much
    greetings
    nomad
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-02-14 16:52
    Nomad,
    Yip - I tried it out for another member and it worked fine - You may have to adjust your mode though - my test worked on both modes 2 & 3 . I wouldn't use this method as a 'finished article' - due to variances in different serial ports - i.e usb to serial adapters v real com port etc - but its fine for a trial - try it out and let me know how you get on - my example using just a resistor was purely a test - I just did a transmit from Propeller to terminal - I would strongly suggest that you use a 232 driver as discussed previously to avoid any difficulty later on ..
  • nomadnomad Posts: 276
    edited 2007-02-15 14:45
    hi quatro,

    the electronic-stuff is here, fine.
    excuse my new question:

    before i soldering my RS232-circuits.

    please have a look on my layout.
    for me is important, that i understood the
    layout for further work.

    -> RS232_withMAX3232.jpg

    it's an adaption of your Nomad_Sample.pdf
    with ST3232, the datasheet from Maxim and my ideas.

    if are faults in my layout, please correct
    the fault (its drawing with MS-paint)

    in the next days i make the circuits and
    other related work.

    thank you for your trouble.

    regards
    nomad
    720 x 470 - 46K
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-02-15 17:58
    Nomad,

    ········ You seem to have deviated a bit from the example - the MAX3232 has the same pinout as the ST232CN so if you follow the 'nomad_sample.pdf' (where the pin no.'s are marked) then it should be fine. Also I noticed the inclusion of the transistor and associated resistors and capacitor C5 in your drawing· - if you just want to use other pins for serial communication but NOT for programming as you have stated then these are not required and therefore neither is the connection to PIN4 on the DB9 connector (or a connection to RSTn of the propeller for that matter). So I suggest you follow nomad_sample.pdf (pin for pin - and choose the rx/tx pins on the prop to suit yourself - omitting the reset circuit if you do not want to program the Propeller through this connection·) you can also verify that here -·http://www.parallax.com/dl/docs/prod/prop/PropStick-v1.2.pdf

    If you follow the same pinouts then it will be easier to debug or move on to the next step (actually using the connection) so we all know your exact configuration .

    Let me know how you get on.



    Quattro
  • nomadnomad Posts: 276
    edited 2007-02-16 07:55
    hi quattro,
    thanks,
    see you later
    regards
    nomad
  • nomadnomad Posts: 276
    edited 2007-02-16 11:33
    hi quattro,

    i send you 2 drawings with my layout-circuits.

    1 - rs232_withMAX3232_2.jpg ( changed as per your last attachement)

    2 - final_RS232_Interface_withMAX3232.jpg (its for soldering purposes)

    i hope the two drawing are correct.

    in the afternoon and after lunch, i make the work.

    regards

    nomad
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-02-17 15:04
    Nomad,
    For a 'simple' serial connection (rx,tx & gnd) you do not require a DTR connection (pin4 on DB9)..

    Regards,
    Quattro
  • nomadnomad Posts: 276
    edited 2007-02-17 15:36
    rs232 - serial-connections-troubles

    hi quattro and everbody,

    on saterday i am finshed the soldering of my
    rs232-adapter-circuit.
    (look at my final_RS232_interface_MAX3232.jpg)

    and on saterday morning·i·testing the stuff
    with serialTestQuadro.spin = it's your program with some testing-results:

    first: tanks for the hint:

    you wrote:

    <For a 'simple' serial connection (rx,tx & gnd) you do not require a DTR· connection (pin4 on DB9)..>

    it's fault when i have connected this 2 pins?

    because i have some troubles.......
    - config hyperterminal: com1, 9600,N,8,1
    -·Demoboard with pin0 & pin1

    - Modes on Spin: (1,2,3) all testing

    Result: nothing happend.

    then the same procedure with linuxBox
    and my serial-C-program: nothing.

    but: with a led o the rs232-connector
    ···· pin5 (gnd) and pin2 (+)
    ···· on the transmission the led blinking.
    so i thing the circuit is ok.

    i must say, that i have NO experience
    with the windowXP (specialize hyperterm).
    i am penguin-man.

    so its possible that i make a fault???·

    But i dont know nothing,whats the matter.

    is this a hardwar- or a software- fault, or misconfiguration of

    my hyperterm or my own stupidity ;.-o

    attachment:serialTestQuadro.spin


    for some help and advice, i am verry grateful
    regards
    nomad·
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-02-17 19:22
    Ok Nomad -

    This is the easiest sample I can think of to debug the circuit - no 232 driver

    pin5 of DB9 (GND)·
    > VSS demo Board (GND)
    P0 of demo Board through a 4.7K resistor to Pin2 DB9

    ·***** on other models of USB to serial adapters the resistor value may have to be lower - i.e 2.2K

    ·And run the sample program you attached in the last post -

    ·I ran the test on my Lap top and it was fine - So I changed the USB to serial adapter to another type and it would not work with a 4.7K resistor but did work when I used a 2.2K resistor (try put 2x 4.7K resistors in parallel)... I have included low res images of the circuit, cable (notice only 2 wire as this is a transmit only sample tx & Gnd) and the hyperterminal window - the sample spin prog·is fine ..... Hyperterminal setup is as follows -·Bits per sec: 9600 ,Data Bits: 8 ,Parity: None, Stop Bits: 1, Flow Control: None· ....·let me know

    Post Edited (QuattroRS4) : 2/17/2007 7:43:14 PM GMT
    640 x 480 - 54K
    640 x 480 - 34K
    640 x 480 - 51K
  • nomadnomad Posts: 276
    edited 2007-02-18 07:09
    hi quattro,
    thanks for your prompt answer.
    now on sunday-morning,
    i am testing the stuff.

    see you later
    regards
    nomad
  • nomadnomad Posts: 276
    edited 2007-02-18 11:16
    hiquattro,

    i am verry frustred and not amusing after 4 hours of testingsmhair.gif

    first: testing

    1 testing hyperterminal

    1-new connection -> new name: propeller3

    comport: COM1 -> ok

    property of com1:
    - baud:······· 9600
    - databit:···· 8
    - paritaet:··· NONE
    - stoppbits:·· 1
    - flowcontrol: NONE

    button -> take over (the right button)
    button -> ok

    run with serialTestQuadro.spin nothing

    but led transmit = ok

    some times later nothing goes.

    no transmission no led

    on MAX3232 PIN 7 -> -5.52VOLT

    with a new chip the same stuff.

    Second:
    then a testing the serial communications with 2 linux-boxes.
    Send and Receive Data ok.

    Third:
    testing
    demoboard with this program and the linuxBox:

    a) only the simple way: rs232-adapter pin5 -> gnd·· on demoboard
    ····································· pin2 -> pin0· on demoboard

    b) with the adapter
    **************************************

    CON
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000

    OBJ
    ExtSerial : "FullDuplexSerial"

    Pub Test1
    extserial.start(-1, 0, 2, 9600) ' (transmit only)- rxpin,txpin,mode,Baud
    ······························· '· - depends on your set up

    repeat 100 ' repeat 5 times
    · extserial.str(string("Hello World\r"))········ ' the \r is the carrige return for unixes
    · waitcnt(100_000_000 + cnt)···················· ' end of 1 read


    *************************************

    result: not running and linux was not amused -> restart

    so in the moment i find no solutations for this problem.
    is the a hardware or a software-problem (look at my latest posting)

    i not understand why on the propellerChips are no existing simple debug-method.
    look at basic stamps one "debug-statements: a rs232-line to a linux box and
    all running.

    and hyperterminal is typical software from microsoft.................

    in the last year i have build 3-wheel-robot of the 10kg - class:
    - 3 microcontrollers, 9 sensors, gps, networkCameralook as masterController
    a 64-bit linuxLaptop with a artifical network for the avoidance and a second
    for picture-recognize.

    in the moment i think i must take· other microcontroller for the communications

    · propeller-chip· <-> mc <-> (serialLine) LinuxBox

    · the better way was:

    · propeller-chip (one coq- for communications) <-> linuxbox

    what you think about of my problemsmad.gif



    thanks

    regards

    nomad
Sign In or Register to comment.