Memory stick Datalogger lock up problem.
jruthroff
Posts: 38
I'm using the attached code to pull down the temperature from an LM34, digitize it with an ADC0831, and storing it on a USB stick using the Parallax Memory Stick Datalogger.
The problem I'm having is random lock-ups of the system. In 10 tries of attempting to log 100 temperature data points, I've only been able to have the process complete twice.
The normal failure mode is for the debug terminal to stop right after displaying "count = XX", where XX is some random count of the samples logged.
The project is built on a BOE and powered by a bench top power supply. I've tried formatting the drive before each run, this doesn't seem to help.
Any thoughts?
Thanks,
John
The problem I'm having is random lock-ups of the system. In 10 tries of attempting to log 100 temperature data points, I've only been able to have the process complete twice.
The normal failure mode is for the debug terminal to stop right after displaying "count = XX", where XX is some random count of the samples logged.
The project is built on a BOE and powered by a bench top power supply. I've tried formatting the drive before each run, this doesn't seem to help.
Any thoughts?
Thanks,
John
Comments
However in the next WRF command you're specifying 7 bytes, but I only see 5 being sent.
Thanks for that input. I've changed the second WRF command to specify 5 bytes. I'm testing now...so far one success and one failure.
I guess I think it would either work or not work (i.e., fail right away), but it doesn't work that way I guess :-).
I wonder...do you think the brand of the USB drive should make a difference? I'm using a "non recommended" drive, and it wouldn't be putting me out that much to get one of the suggested drives. Has the list of recommended drives been expanded?
Thanks, again,
John
To be honest I never really thought much of the "recommended" list of drives. Thumb Drives with "secure" software and other such "special" drives are the only ones I have had issues with. Formatting is important. Other than that I don't think FTDI has limited the range of usable USB drives much. I didn't look in your code past the first error. It is possible there are more that I missed or something in the logic that causes an eventual failure. I supposed I could just try your code on my end and see what happens. If I have time tomorrow I will see if I can. It's been awhile since I have used one.
In text mode there is no need to enter the number of characters in hex. No matter what surest cause of a lockup and strange results is to get the count of characters wrong after the WRF.
SEROUT TX\CTS, Baud, ["WRF 9", CR, DEC5 counter, "**", CR, LF]
there is no need for a CR after LF, which is the 9th character. Having an extra CR after the LF does not hurt anything but it does generate an extra OK response from the monitor.
Or put everything on one line...
SEROUT TX\CTS, Baud, ["WRF 14", CR, DEC5 counter, "**", CR, LF, DEC3 adcVal, CR, LF]
Or this too is okay
SEROUT TX\CTS, Baud, ["WRF 14", CR]
SEROUT TX\CTS, Baud, [DEC5 counter, "**", CR, LF]
SEROUT TX\CTS, Baud, [DEC3 adcVal, CR, LF]
I got the impression he was writing the CR/LF out to the file in this section, which would account for 9 characters. 5 for the counter, the two * symbols and the CR/LF, making the last CR the command terminator. The datasheet specifies the CR to terminate the command. Are you suggesting we don't need the CR at the end of the command?
Yes, this command does not have a terminator. It goes by the count only. What data sheet are you referring to? I am referring to Vinculum Firmware User Manual v2.4 rev 3, section 6.2.7 on Write to File (WRF).
Plus my own experience--Never add an extra CR.
Regards,
John
Again--You have to get the count right. Some excess characters are not so benign. Suppose the WRF instruction says it is going to send 20 characters, but you actually send 25. The monitor will attempt to interpret the extra 5 characters as commands, and will usually error out. But sometimes what you send may actually be a monitor or disk command that does something you didn't want such as change the baud rate or put the drive to sleep or move the file pointer. Bummer. Sending too few characters can end up in lala land too. The monitor accepts as data what you thought were going to be your next commands and puts them as data on the the thumb drive. When it does get the number of characters you had specified, it likely ends up out of sync, with garbage going as commands to the monitor, ouch, lockup.
For debugging you can print out what is returned from the Purge and Get_Serial_Bytes operations. DEBUG out everything that the drive sends back:
That's why I was concerned about the CR...I was thinking if it's not supposed to be there on the current firmware then it would be an extra character that would be parsed. As you pointed out, perhaps just causing an extra "OK" prompt, however if characters were missing it could seen as data or something else. I need to download the latest manual and firmware and get my knowledge and devices up to date. Been busy testing out the XBee Wi-Fi modules and side-tracked on that. Which by the way, also needed updated firmware.
For what it's worth, once you figure these things out... they are bulletproof. I use them in my DieselDock product, and they are flawless.
I have a thread on here somewhere with code that may help. If you haven't figured out the issue by the time I get back to my office, I can find the links.
Dave