No data saved to SD Card, only after a long run period
mattorvis
Posts: 4
in Propeller 1
Hello,
I'm currently using the Activity Board WX, with a 32 GB SD card loaded. I have a program that is saving data packets to the SD card. If I run this for several hours, it works great and I can grab all my data. However, if I let it run overnight, the SD card comes up with the appropriate file, but no data in it. The data packets are about 100 bytes each, saved at 1 second intervals, so it shouldn't be getting anywhere near maxing out the SD card. What could be causing this? Thanks,
Matt
I'm currently using the Activity Board WX, with a 32 GB SD card loaded. I have a program that is saving data packets to the SD card. If I run this for several hours, it works great and I can grab all my data. However, if I let it run overnight, the SD card comes up with the appropriate file, but no data in it. The data packets are about 100 bytes each, saved at 1 second intervals, so it shouldn't be getting anywhere near maxing out the SD card. What could be causing this? Thanks,
Matt
Comments
Normally you would receive a prompt reply from some helpful forum member but as with any forum and any questions, they can only be answered by someone WHEN they have sufficient information. Of course we can play a back and forth game of asking for more information or you could just provide that information in the first place. None of us have a clue as to what software you are running and so we can't answer your question. Therefore it is always best to post the code either directly using the code tags ( 'C' in the forum compose menu) or zip the files. Sometimes if may be hardware in which case send a clear photo or two and also any links that might be needed.
If you do these things you usually get a prompt response from one or more members.
8.6MB/day
Which is far, far below the 4 Gigabyte FAT32 file size limit.
Yet this doesn't explain why the SD card isn't recording correctly while running overnight.
It could have something to do with opening the file, moving the file pointer to the existing data, appending to it, then closing the file.
It could be that as the file gets larger there's a problem with fseek() working correctly. I had a problem similar to this with a FreeDOS based data collection device at work.
We worked around it by only running the unit for several hours, then stopped the recorder, downloaded the data, then restarted.
I know that isn't a solution, as we don't know what the cause of the problem is that Matt is experiencing, but perhaps a review of what functions he's using to write to the card fopen(), fwrite(), fseek(), fclose(), etc, might spark some ideas...
Oops!
But, I'm not sure I'd trust even it for continuous appending to a file...
I'd for sure start with a freshly formatted sd card. That may fix whatever problem you are having.
If it were critical, I'd add an SPI flash chip to the system and first write to it and then copy to uSD and then verify the write and then start over...
But, I'd write to a new file each time instead of trying to append.
I wouldn't trust append...