Serial object with larger buffer
Dr_Acula
Posts: 5,484
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
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· Propeller Object Exchange (last Publications / Updates);·· Vaati's custom search
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