PacketBuffer class in NanodeRF code, max size

Is there a limit to the PacketBuffer class size in the NanodeRF code. If I try and increase the char buf[ ] to more than 165 bytes the code will not run.

Robert Wall's picture

Re: PacketBuffer class in NanodeRF code, max size

I can't seem to reproduce that. I have increased it to 250 bytes, the code (NanodeRF_multinode.ino) compiles, loads and does appear to run (though I don't have it connected to anywhere). I have not tried writing to fill the buffer.

Have you checked that your 165 bytes is actually enough, and you're not overflowing the buffer?

TrystanLea's picture

Re: PacketBuffer class in NanodeRF code, max size

I've found I can extend it quite a long way 400+, there's a useful library and function that can be used, detailed here: http://arduino.cc/playground/Code/AvailableMemory to get the amount of available memory.

mad_dad's picture

Re: PacketBuffer class in NanodeRF code, max size

I use str.length() to print its length before sending to server. And it's around 135 - 148bytes having shortened all my feed idents.

if i set it to 265 the code does not even elaborate! No serial o/p at all.

Will check out free memory tomorrow

 

alco's picture

Re: PacketBuffer class in NanodeRF code, max size

Trystan How do you recall that out of the library?
I got the same problem with my NanodeRF and sensingshield. The arduino goes "mad" if increase the packetbuffer more than 200. And there are 2 more buffers in the sketch. 50 of the HTTP header (callback) and 700 (!!) for the ethercard buffer. and all the serial communication, datatypes (a INT = 16 bit, a Byte=8bit) takes a lot of the SRAM.

My sketch will work if I disable al the serial communication that isn't needed for posting, and shrink al the datatypes to BYTE where it's possible.

But I want to know how mutch SRAM takes.. and have 2 points where I have some doubts about:

1) why does the ethercard::buffer=700 need so mutch SRAM?

2) The amount of receiving nodes at X time is also a factor to deal with. If you get many packets from Nodes you get out of SRAM very quickly! See also the posting of user "mountaindude" at http://openenergymonitor.org/emon/node/1084

Robert Wall's picture

Re: PacketBuffer class in NanodeRF code, max size

"Trystan How do you recall that out of the library?"

Do you mean: "How do you install that in the library?"

Copy the first part into your editor and save it as a file named MemoryFree.h
Copy the second part into your editor and save it as a file named MemoryFree.cpp
Move both files in a directory called MemoryFree
Copy that directory into your Libraries directory.

In your sketch do like "Example sketch: "

Put at the end of loop( ) in the example nanodeRF_multinode sketch, mine reports 208 bytes free.

 

 

 

alco's picture

Re: PacketBuffer class in NanodeRF code, max size

tnx Robert, my nanodeRF with sensingshield and one jeenode with 3 temp sensors gives me a 125 bytes free of SRAM with minimal serial print communication on it. but with full-debug communication it drops to 77 bytes. and it will create a buffer over-run with a high frequency of RF12 radio communication (receiving sensors) so this confirmed my Sram issue with my sketch.

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.