Is there any buffer overflow prevention on FullDuplexSerial?
Sniper King
Posts: 221
I started this thread as a sister to my other thread because this could affect everybody.· I haven't started learning the Spin Assembly so I can't check this.· But I am narrowing my problem down to this.·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·- Ouch, thats not suppose to be hot!··
Michael King
Application Engineer
R&D
Check out Project: PSAV Persistent Sailing Autonomous Vehicle
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·- Ouch, thats not suppose to be hot!··
Michael King
Application Engineer
R&D
Check out Project: PSAV Persistent Sailing Autonomous Vehicle
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"I have always wished that my computer would be as easy to use as my telephone.· My wish has come true.· I no longer know how to use my telephone."
- Bjarne Stroustrup
You could implement software flow control in your code that uses FDS. Getting hardware flow control would require more pins (and hardware modification depending on what board you are using).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out the Propeller Wiki·and contribute if you can.
The standard FullDuplexSerial object discards the oldest character in the receive buffer if it receives a new character and the buffer is full.
The buffer size is easily increased to any power of two by changing a couple of lines of code. The version of FullDuplexSerial used in BoeBotBasic has been modified to be able to set the buffer size with a constant definition in one place.
if you changeover from FullDuplexSerial to SerialMirror from the obex you can increase the buffer to several kB
as serialmirror does not use COG-RAM for the buffer but HUB-RAM where you have 32kB minus "your SPIN-tokens" as memory
best regards
Stefan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out the Propeller Wiki·and contribute if you can.
It appears to me that the head/tail buffer pointers wrap around on overflow and ignore previously received characters.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dennis B. Page, Page Radio Company
There is a limit of $1FF for any immediate value. You would need to change the few instructions that use these
bit masks to use a direct value (not immediate) and define the transmit and receive wraparound bit masks as
32-bit constants. That would allow larger buffer sizes to be used.
Yes, the head/tail buffer pointers wrap around. If the buffer is full and a new character is received, the oldest
character in the buffer is overstored. There's no provision for reporting that an overrun condition occurred.
It's possible for you or someone else to add this feature and it's possible to change the behavior of the driver
when an overrun occurs, but this is not a "full service" UART simulator. Most programs don't check for receive
overrun. There is a modified FDS in the Object Exchange that has an option for hardware flow control.
It appears to me that if the buffer is full and a new character is received, and the oldest character in the buffer is overstored, FDS returns only the new character and none of the older characters, effectively losing the older characters.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dennis B. Page, Page Radio Company
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dennis B. Page, Page Radio Company
Could you please explain this in a bit more neophyte language? I would like to increase the size of the FDS buffer, but I'm not understanding what changes need to be made. Thanks!
I post #2 of my index, one of the projects listed was to expand the buffers in Tim Moore's driver (here's a link). There is some discussion in the thread about what is required to increase buffer sizes.