Shop OBEX P1 Docs P2 Docs Learn Events
Prop to Prop communication using fullduplexserial — Parallax Forums

Prop to Prop communication using fullduplexserial

donnpangydonnpangy Posts: 49
edited 2010-10-21 00:15 in Propeller 1
I am trying to communicate between 2 props now and I am having a problem with the RX command on the full duplex serial.

I have no problem transmitting, but I loose data using the RX or RxStr or Rxdec command (on the receive side).

I am using 9600 baud and get very intermittent loss of data from prop to prop.

Maybe I should look up code on the OBEX for Prop to Prop communication.


Thanks again,
Don

Comments

  • $WMc%$WMc% Posts: 1,884
    edited 2010-10-19 17:42
    donnpangy wrote: »
    I am trying to communicate between 2 props now and I am having a problem with the RX command on the full duplex serial.

    I have no problem transmitting, but I loose data using the RX or RxStr or Rxdec command (on the receive side).

    I am using 9600 baud and get very intermittent loss of data from prop to prop.

    Maybe I should look up code on the OBEX for Prop to Prop communication.


    Thanks again,
    Don
    '
    Are you using a cross-over cable?
    '
    How far apart are the Prop's from each other.
  • donnpangydonnpangy Posts: 49
    edited 2010-10-19 17:47
    I am running prop1 tx to prop2 rx and running prop1rx to prop2 tx.

    The props are a few inches apart, which should work nicely at only 9600 baud.

    hmmmmmmmmmmmmm,
    Don
  • donnpangydonnpangy Posts: 49
    edited 2010-10-19 17:53
    If I hook the TX from prop1 to a terminal, I have no problems with sending anything. I get no loss of data.

    My problem is on the RX side. Does anyone have any code that does very simple communication between 2 props.

    Maybe 9600 baud is entirely to slow.


    thanks,
    Don
  • Invent-O-DocInvent-O-Doc Posts: 768
    edited 2010-10-19 18:21
    Also check these things:

    - make sure you are issueing the software command to employ a crystal on both units (not RCTIME)

    - make sure that you get serial output from the sender. Check it on another device

    - you can get much faster transfers by adding a wire and doing SPI between the chips.

    Good luck. Please post code.
  • Cluso99Cluso99 Posts: 18,069
    edited 2010-10-19 19:39
    Your setup should work fine. I use 115200 between props without problems. Are you sure your code is taking the characters fast enough out of the buffer? You could use larger buffers (see my FDX revision in the OBEX which allows larger buffers easily - note 512 does not work).
  • kwinnkwinn Posts: 8,697
    edited 2010-10-19 20:22
    Also make sure you have a ground connection between the two props.
  • donnpangydonnpangy Posts: 49
    edited 2010-10-19 20:47
    kwinn wrote: »
    Also make sure you have a ground connection between the two props.

    Kwinn,
    I have a good ground on both props . . . I just rechecked.
    Thanks,
    Don
  • donnpangydonnpangy Posts: 49
    edited 2010-10-19 20:53
    Also check these things:

    - make sure you are issueing the software command to employ a crystal on both units (not RCTIME)

    - make sure that you get serial output from the sender. Check it on another device

    - you can get much faster transfers by adding a wire and doing SPI between the chips.

    Good luck. Please post code.

    Invent-O-Doc,
    I have the correct 2 lines set up for the crystal . . . . for both props to run at 80Mhz.

    I also can transmit from both prop boards , into the "parallax serial terminal", with no loss of data. My problem is the rx side.

    I like your idea about SPI. I was actually thinking about SPI or I2C to communicate.

    Thanks,
    Don
  • donnpangydonnpangy Posts: 49
    edited 2010-10-19 21:01
    Cluso99 wrote: »
    Your setup should work fine. I use 115200 between props without problems. Are you sure your code is taking the characters fast enough out of the buffer? You could use larger buffers (see my FDX revision in the OBEX which allows larger buffers easily - note 512 does not work).

    Cluso99,
    This sounds good. Can you point me to your code on the OBEX. I would love to see it.

    Thanks,
    Don
  • Shawn LoweShawn Lowe Posts: 635
    edited 2010-10-20 07:56
    donnpangy wrote: »
    Kwinn,
    I have a good ground on both props . . . I just rechecked.
    Thanks,
    Don

    Sorry if this is redundant, but do you have the grounds of each prop connected to each other? I am unclear if by good ground you mean between or just from each prop to the ground on the circuit
  • donnpangydonnpangy Posts: 49
    edited 2010-10-20 11:48
    I think my problem is my use of the Rx command.

    Should I pause in between sending characters?

    is there start or stop bits that I am missing?

    PC.start(PC_Rx, PC_Tx, 0, PC_Baud) ' Initialize comms for PC
    XB.start(XB_Rx, XB_Tx, 0, XB_Baud) ' Initialize comms for XBee


    "5": ' Configure local
    XB.str(string("abcdefghij")) 'this is my transmit code

    "6": ' Query local
    strIn[0] := XB.Rx 'this is the receiving code
    strIn[1] := XB.Rx
    strIn[2] := XB.Rx
    strIn[3] := XB.Rx
    strIn[4] := XB.Rx
    strIn[5] := XB.Rx
    strIn[6] := XB.Rx
    strIn[7] := XB.Rx
    strIn[8] := XB.Rx
    strIn[9] := XB.Rx
    PC.dec(strIn[0])
    PC.dec(strIn[1])
    PC.dec(strIn[2])
    PC.dec(strIn[3])
    PC.dec(strIn[4])
    PC.dec(strIn[5])
    PC.dec(strIn[6])
    PC.dec(strIn[7])
    PC.dec(strIn[8])
    PC.dec(strIn[9])

    thanks,
    Don
  • donnpangydonnpangy Posts: 49
    edited 2010-10-20 11:53
    Shawn Lowe wrote: »
    Sorry if this is redundant, but do you have the grounds of each prop connected to each other? I am unclear if by good ground you mean between or just from each prop to the ground on the circuit

    The ground is connected between both Props. The wiring is shown below.

    Prop1 gnd>
    <Prop2 gnd
    Prop1 Tx >
    <Prop2 Rx
    Prop1 Rx >
    <Prop2 Tx

    Thanks,
    Don
  • donnpangydonnpangy Posts: 49
    edited 2010-10-21 00:15
    Thanks everyone . . . for all the help.

    I figured out what the problems was . . . . . a drum role please

    There was another program running in another cog that was corrupting the Rx array data.

    Thanks to everyone for the assistance.

    It now runs flawless.

    thanks,
    Don
Sign In or Register to comment.