View Full Version : Data Aquisition System shuts down after 4 minutes and 42 seconds

03-30-2012, 02:36 PM
For a science project I designed a data acquisition system that takes data from a temperature pressure and wind speed sensor and logs the data on an attached micro SD card. The program runs smoothly, but at 4 minutes 42 seconds the program freezes preventing any of the collected data from being saved. I'm just wondering if it sounds like i'm doing something obviously wrong. I just can't figure out why it always crashes at the exact same time.

possibilities I've thought of:

the actual writing of data is taken care of by one of the cogs not the main object
thus the cog might be running out of memory

or i could be missing a wait command causing the program to have to recycle through the code

again if there's something obvious i;m missing please let me know.

Phil Pilgrim (PhiPi)
03-30-2012, 02:53 PM
Welcome to the forum, Ondway!

There's not much we can do to help until you post your code.


03-30-2012, 03:56 PM
One commonly seen issue is starting new cogs with giving them enough stack space...

You might make sure all your SPIN cogs have enough stack space reserved...

If you are storing data in buffers, you might also check you don't have a buffer overrun problem...

Duane Degn
03-30-2012, 05:26 PM
I agree, this sounds like you're over running a buffer.

Use the "file\archive\project" feature in the Propeller Tool to zip you project up and post it.

I just made data logging project of sorts in the robot forum. I used a uSD card with a PropBOE to record the servo data as I drove my PropBOE bot (http://forums.parallax.com/showthread.php?138903-PropBOE-Bot)around (which could then be replayed). The code is posted in the last post of the thread.

03-30-2012, 06:00 PM
The other thing that can catch people is directly using CNT in a conditional.

this code fails when cnt is > $8000_0000 or on rollovers. ( "<" is signed, while CNT is not. I use (x >>1) < (y>>1) when i want an unsigned comparison.)

C1 := cnt + wait
"do something"
if C1 < cnt

This code works all the time due to a useful side effect of limited precision math.

C1 := cnt
"do something"
if (cnt - C1) > wait


03-30-2012, 08:10 PM
A special case of overrun and stack space is having recursive function calls somewhere in the code. But I agree to the proposals above: Post your code if it's not rocket science ;o)