Shop OBEX P1 Docs P2 Docs Learn Events
Parallax Serial Terminal — Parallax Forums

Parallax Serial Terminal

bcrembcrem Posts: 2
edited 2011-05-20 18:34 in Accessories
Hi folks,

So I'm using the PST for debugging; just wondering if anyone knows how to use if for multiple cogs. Once I have the object in my main cog, can I pass an address to other cogs I spin off, so I can see debug output from them as well? Obviously I'd have to watch out for one cog's output stomping on anothers...still, I'd rather have too many talking than just one.

Any code examples of this kind of usage?

Thanks in advance,
Bill

Comments

  • Mike GMike G Posts: 2,702
    edited 2011-05-20 05:59
    I think this answers your question.

    Main HUB RAM is available to all COGs. The following example is running in the top object. Temp is a memory pointer returned from the "Request" child object. The repeat loop prints out 256 bytes in 10 byte rows starting at the memory address stored in temp.
    temp :=  Request.Address(id)
    ...
    repeat j from 0 to 256
              pst.hex(byte[temp + j], 2)
              pst.char($20)
              if((j+1) // 10 == 0) 
                pst.char(13)
    

    If you need to view PASM variables, then do much the same. Write the value to HUM memory then expose the memory through a method. I use PASD for low level PASM debugging as PASD provides a COG memory view. There is also ViewPort.

    If you have multiple objects reading and writing to main ram then you'll need to use memory locking. Else you will have unexpected results and debugging will be a challenge.

    See the sections on byte[], word[], and long[] in the Propeller manual.
  • Dave HeinDave Hein Posts: 6,347
    edited 2011-05-20 11:17
    You can use a lock to prevent multiple cogs form using the serial port at the same time. Also, FullDuplexSerial and some other serial drivers put their variables in a VAR section, which means you can only print from the object that started the serial driver. You can move the variables to a DAT section to fix that. Or, you could use cserial.spin from the CLIB object library. It has the standard start, rx, tx and other methods that are used in FDS, but it declares the variables in a DAT section, and it has an option bit to specify using a lock. You would start it with start(31, 30, %10000, 115200) to use a lock.

    cserial.spin is attached below. It also contains other routines such as start1, rx1, tx1 that are used to create additional serial ports, but you should probably stay away from using those.

    Dave
  • bcrembcrem Posts: 2
    edited 2011-05-20 18:34
    Thanks guys - I'll take a look at using those solutions.
Sign In or Register to comment.