Scratch Pad Memory Managment
A
Posts: 22
Hello all,
I am wondering if anyone has done any work using the scratch pad ram. In particular I am wondering about using it as a memory buffer for wireless communication.· The scheme is to send a data packet.· if a reply and follwing data are recieved the transmitted data is not buffered.· if no reply I want to buffer the packet.· I know how to get the packets into the ram and retrieve them but am not sure how to manage the buffer.· I would like to send the oldest buffered data if a reply is recieved the sent data is removed from the buffer. Next I would like to then·shift the entire ram contents·to always keep the oldest buffered data at the bottom of the stack.· Mabey there is a better method??
Aaron
I am wondering if anyone has done any work using the scratch pad ram. In particular I am wondering about using it as a memory buffer for wireless communication.· The scheme is to send a data packet.· if a reply and follwing data are recieved the transmitted data is not buffered.· if no reply I want to buffer the packet.· I know how to get the packets into the ram and retrieve them but am not sure how to manage the buffer.· I would like to send the oldest buffered data if a reply is recieved the sent data is removed from the buffer. Next I would like to then·shift the entire ram contents·to always keep the oldest buffered data at the bottom of the stack.· Mabey there is a better method??
Aaron
Comments
The easiest way to proceed is to use an external buffer chip. Both Proteus and Rhombus have chips that can buffer short strings and give you the flexibility you're looking for.
You could perhaps use the Propeller and let one of the processor cogs be your communications handler.
cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
Thanks A
Shifting data around in scratchpad RAM can easily be accomplished with a sequence of GETs and PUTs. Just remember: if you're moving a block of data to a higher address, start at the end of the block and work your way down; if to a lower address, work from the beginning and work your way up. That way you won't write over data that hasn't yet been moved. You will also need to keep an array of pointers to the beginning of each data block, so you know where each begins.
-Phil
The condition where both pointer equal means that the buffer is empty, so don't try to send. It can also mean that the buffer is full, and special consideration has to be given to the event of newValuePoint incrementing to become equal to oldValuePoint. Does it stop in favor of the old data, or does it overwrite the old data in favor of the most recent?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
You're right, of course. I was a little hung up on the fact that the data consisted of contiguous blocks, rather than discrete bytes, and a misperceived need to keep those blocks from being split up at the buffer boundaries. But with a properly-designed circular queue, this needn't be a concern, with the added bonus of not having to change the block pointers after queuing/dequeuing.
-Phil
Aaron