I have a problem with my LabView WSN target software.
The system has PC with Windows 7 and LabView 2012 SP1 as Host computer, NI-WSN9791 as gateway, NI-WSN3230 as node and sbRIO9636 as device connected to node via Serial Port.
Node has WSN 1.4.0f0 firmware.
Software on WSN node communicates with sbRIO and gets data from it. Then node sends that data as User Messages to Gateway.
Main problem is that WSN node can work for a certain time and then
1) says it run out of memor;
2) reboots;
3) works one minute or two;
4) reboots again;
5) works for few minutes;
6) stops respond. Gateway says that signal lost.
Of course it should be something wrong with my program, so I'm asking for advice — where can I find a cause of memory leak or how I can solve it anyway?
I attach the program that I deploy to node (NI 3230).
Sample interval is 5 seconds, set by VI.
Program's function can be divided into the following sequence:
1) Sends command "!Start" to sbRIO and waits for response; If no response it sends Debug Message "Sbrio not responding";
2) Read and parses response — it consists of command's type, length of command's body and body of command;
3) In case if responce has "msg"-type it splits command's body by 50-bytes blocks to fit User Message;
4) Then send splitted strings to gateway by User Message.
5) If no error occured, it sends "!OK" and "!Stop" to Sbrio;
Program try to repeat those operations in 4 second interval, and leaves 1 second to not overlap next sample.
"COM Complex Read" subVI helps to read messages that longer than device can read at one time. Also it designed for reading of COMPort without termination string.
"Split Message" splits command's body to equal sizes to fit User Message (Maximum size of 3230's User Message is 64 bytes) and adds index before it.
Problem solved this time — I had added a warning if received length of command's body is more than 4096 bytes. And it happened about after 1 hour of work of sbRIO and WSN, lasted about 4 seconds (I think it happened inside one sample interval) and then returned back again to normal functioning.