Shop OBEX P1 Docs P2 Docs Learn Events
Debugging 2 objects with same serial — Parallax Forums

Debugging 2 objects with same serial

Ron CzapalaRon Czapala Posts: 2,418
edited 2010-09-25 09:28 in Propeller 1
I am using Extended_FDSerial to display debugging info on my PC monitor using pins 31 and 30.

I am also using some other spin objects and would like to display data to the PC monitor.
I tried using the Start method in the top level object only while using TX in both objects.
It didn't work, so I tried putting a Start in the lower level object also.
That didn't work either.

Is there a way to use the same serial connection in a top level and lower level object?

Thanks!

Comments

  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2010-09-24 08:56
    After further searching of the forum I think I found the answer - SerialMirror.

    I will try that.

    EDIT - Found Mike Green's explanation
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-09-24 10:44
    just my 2 cents thoughts that come up in my mind when reading this post:

    there might be still a problem if methods from different cogs (not diferent objects) start to send. Then the characters get mixed up.

    This can be solved through a writebuffer.

    With a buffer of 16 bytes
    Where cog a only writes to buffer-index 0-7 and cog b writes only to buffer 8-15

    The top-object checks for changes and if a byte has changed in the buffer then sends always the complete buffer.

    This way the bytes can't get mixed up as each cog writes to his own part of the buffer.

    best regards

    Stefan
  • TimmooreTimmoore Posts: 1,031
    edited 2010-09-24 12:53
    To expand on what stefan said. There are 2 problems
    1. Using a serial port from multiple objects but the objects are running on the same cog.
    2. Using a serial port from 1 or more objects but from multiple cogs

    SeriallMirror will allow 1 and 2 but with 2 the output from the cogs will be interleaved which makes reading the messages harder.
    4 port serial also allows 1 and 2 but has the interleaving problem as well.
    I have a version of 4 port serial that allows a lock to be used per port so multiple calls to 4 port serial can be used without interleaving between cogs but its not automatic, if you want do use multiple calls from a cog without interleaving you need to wrap the calls with a get/freelock
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2010-09-24 13:08
    Stefan and Tim
    Thanks for your response. Luckily SerialMirror works for my current need but this information will probably be useful in the future.

    I thought about using a USB2SER on a second com port/pin set but SerialMirror was easier.

    Thanks again!
  • Bob AndersonBob Anderson Posts: 122
    edited 2010-09-25 09:28
    Try the following object. It is designed to multiplex up to 8 serial streams over a single connection. The associated C# client demultiplexes the stream to up to 8 little windows that allow individual communication on each "channel"

    http://obex.parallax.com/objects/243/
Sign In or Register to comment.