PDA

View Full Version : Buffer Question


drew
03-20-2009, 10:03 AM
I was wondering if there is a way to clear the wireless module's buffer. I've noticed that sometimes when I have a module send a command, it won't until its buffer threshold is met. At this time it will send the command I want it to send multiple times. Basically, I want the command "ABCD" to be sent. Most of the time it goes through as "ABCD". However, sometimes I'll tell it to send "ABCD" and nothing happens until the buffer threshold is met. At this time it will output all at once when the buffer threshold is met, i.e. "ABCDABCDABCD" or at a different buffer threshold level "ABCDABCDABCDAB", etc. I would just set the buffer threshold to only be able to have enough bytes to send "ABCD", but I'll need to be able to send data that is larger and smaller than this.

One more question. In the command line in portal I am typing in rpc('\x##\x##\x##','reboot'), where ## are the node's address, but none of the nodes will reboot using this command. I can also have one node with a script where it will execute a command every 2 seconds. In this node I am doing the same rpc as before to get it to reboot the other node I'm using every other second, but the other node won't reboot. Is it just not showing the reboot sequence in the Portal node info panel, or is there something I'm missing?

msellers
03-20-2009, 05:08 PM
Drew,
There is no explicit way to clear a buffer. Take a look at ID13, 14, and 15 on p78 of the SNAP Manual. 13 is a timer that starts at the first character. When it times out, the packet is sent. 14 is a counter of characters - when it gets full, a packet is sent. I suspect that is one of those two that fires to send the ABCDABCDABCD type commands you see. ID15 is an intercharacter timeout. Say your characters of a command are coming in at 9600bps, about 1msec each. When no character appears for say 5msec, you could have it send the buffered packet. This is probably the mode you need since your commands are variable in length. Tweak that to match your bit rate and intercommand delay.
As for the reboot, the nodes should be rebooting but that info doesn't automatically get displayed in Portal unless you executed the command by clicking the function in Portal. Portal doesn't automatically show that rediscovery process when it isn't aware it should be looking. Toggle a pin or LED in your startup routine and watch for it in the reboot process.