Shop OBEX P1 Docs P2 Docs Learn Events
Serial object with larger buffer — Parallax Forums

Serial object with larger buffer

Dr_AculaDr_Acula Posts: 5,484
edited 2009-11-26 03:11 in Propeller 1
I was wondering if there is a serial object that can drive 2 ports and has buffers >132 bytes and fits in one cog?

I've been using Tim Moore's 4 port single cog object (which is brilliant and I see has been downloaded over 1000 times) but the 64 byte buffer is a bit small for file transfer protocols like xmodem. Before I go modifying the code I was wondering if there are other examples out there of multiple serial ports in one cog?

I *think* it might be possible to make enough space for bigger buffers with this code. It fits with only a few longs to spare, but the code is replicated 4x so deleting code for two of the ports will save a pile of memory, and also I don't need any of the RTS and CTS code so that will save some memory too. Further, the tx part of the code only needs 1 byte for a buffer (with a flag to say ready/not ready), not 16 so that would save a bit too. I think all this would be possible but if it has already been done that would be better!

And of course, if it hasn't been done and I can get this working I'll post it on the obex.

Many thanks in advance, James Moxham

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/build

Comments

  • dMajodMajo Posts: 855
    edited 2009-11-25 19:38
    try this http://obex.parallax.com/objects/398/

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · Propeller Object Exchange (last Publications / Updates);·· Vaati's custom search
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-11-25 22:29
    Thanks dMajo for that line. Some interesting coding there that could come in handy. Unfortunately I need to run two ports at the same time. And it needs to run in one cog as I've run out of cogs!

    Tim Moore's code can do 4 ports from the one cog but the buffer size is smaller. I did find a fudge last night by decreasing the baud rate from 38400 to 19200, and then the controlling program is able to collect the bytes coming in fast enough and the buffer doesn't overrun. So that does work for xmodem and it is possible to transfer files.

    If such an object doesn't exist (and it may not as it is a bit of an unusual requirement) then I might have a go at writing one.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.smarthome.viviti.com/build
  • localrogerlocalroger Posts: 3,452
    edited 2009-11-26 03:11
    Dr_Acula, your plight brings to mind a serious Big Thought I have been having about Prop development, which is that while it is nice to have a library of standard objects it is almost always necessary to edit those objects, in particular to pare out unneeded functions to preserve hub RAM. The handshaking code in the 4-port object just makes me shake my head -- how many people use that? And it takes RAM. Often it's not features we need, it's the memory we save from NOT having features. You need a 2-port solution with the largest receive buffers possible, and for someone familiar with the code that's probably a 2 hour recoding job. I've got several versions of fullduplexserial which I use because fds is half the size of the 4 port object, but alas it does take a cog per port. I am not real thrilled with the direction FSRW is taking because I'm much more interested in conserving RAM than in high-speed access. I feel like writing a manifesto or something.
Sign In or Register to comment.