Shop OBEX P1 Docs P2 Docs Learn Events
fullduplexserial.spin — Parallax Forums

fullduplexserial.spin

El PaisaEl Paisa Posts: 375
edited 2006-12-13 03:06 in Propeller 1
Is in the Hydra software a program like fullduplexserial.spin?
I would like to comunicate with a serial device at 115200 baud.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-12-11 17:55
    Just use the routine in the Propeller library. There are no changes necessary. The system clock in the Hydra is the same (80MHz=10MHz*8) as that in the Demo Board (80MHZ=5MHz*16). Just be sure to pick appropriate pins to connect your device (some pins are used differently on the Hydra).
  • rokickirokicki Posts: 1,000
    edited 2006-12-11 21:12
    Right, just in case anyone is trying to do this with the demo board, here's the magic incantations I found to work.

    On the propeller side of things, this worked:

    CON
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000
    OBJ
    ser : "FullDuplexSerial"
    PUB start | b
    ser.start(31, 30, 0, 115200)
    ser.str(string("I am alive", 13))
    repeat
    b := ser.rx
    ser.tx(b)

    (this is just a copy-data).

    On the Windows side of things, I compiled the following
    program from cygwin. (Cygwin is free and comes with a
    C compiler).

    I needed to do this because I'm testing my SD/FAT write
    routines, and I want to run some intensive tests without
    wearing out a card, so I'm doing the block I/O over serial
    to a hard disk on my laptop. It's much slower, but it will
    let me run many days worth of intensive testing.
    c
    c
  • Dennis FerronDennis Ferron Posts: 480
    edited 2006-12-12 07:01
    I think it's important to point out that serial communication will only work with a crystal clock. If you use the internal RC clock, you can't get enough timing accuracy for the serial duplex object to correctly guess when to sample the last 2 or 3 bits. The least significant bits will come out ok because the % of timing error accumulates throughout the receipt of the byte; at first there isn't enough error to matter but by the time you finish a byte the timing is too far off.

    When debugging serial communications, I recommend making a loop that sends bytes with values 0, 1, 2, 3, ... up to 255 and then start over again. This is your best chance of at least receiving something even if it's wrong, and once you have a little bit going through you can start to sort out what makes it work better and what makes it stop working.
  • El PaisaEl Paisa Posts: 375
    edited 2006-12-12 12:11
    Mike,

    You·were right, the only thing I changed was the clock settings and the pinouts.

    I am using the fullduplexserial.spin

    Now I can communicate with a ezLCD-004 Graphics display at 115200 baud.

    Thanks again.
  • James LongJames Long Posts: 1,181
    edited 2006-12-13 03:06
    What are you using to communicate? The USB...or another connector.

    James L

    Post Edited (James Long) : 12/13/2006 5:11:14 AM GMT
Sign In or Register to comment.