2015-05-03 07:31 AM
Guys,
How can I use Internal SRAM on STM32F107 for FIFO operation ? Any examples for writing and reading ? Thanks2015-05-03 08:46 AM
A FIFO for what? Most buffering concepts can be constructed in software.
2015-05-06 05:16 PM
2015-05-07 05:07 AM
A FIFO doesn't work so well when dealing with Ethernet messages, because some messages take longer to process than others, depending on the Listener. A better approach is a pool of message buffers so that you can dispatch an incoming message to a Listener task without blocking the Ethernet stack. When the Listener task finishes with the message it is returned to the pool. That way multiple Listeners can run at the same time, or messages are queued to a busy Listener, and you don't have to worry about the stack dropping packets while a resource intensive message like a JSON packet is being parsed.
A message pool is very similar to managing a heap. Allocate a large chunk of memory, and then from that pool allocate message buffers as needed. Return the messages back to the pool when finished with them. Remember that TCP/IP message vary considerably in size so don't use fixed length buffers. Not every message is 1500 bytes long, so if you allocate an array of fixed size buffers based on the maximum MTU then you can waste a lot of RAM receiving 64 byte messages in a 1500 byte buffer. And if you support jumbo frames you'll quickly exhaust the pool with 98% or the space unused. Jack Peacock