Go Down

Topic: FileLogger - locateFileStart function (Read 503 times) previous topic - next topic

Paraj

Won't let me post something with links in it with a 0 post count so this is a filler post.

Paraj

#1
Aug 25, 2009, 06:08 am Last Edit: Aug 25, 2009, 06:12 am by Paraj Reason: 1
I've got an Arduino Duemilanove with an SD Card Shield from Seeed Studio which uses the FileLogger Library and I'm using an ordinary SanDisk 2GB SD Card (Nearly identical to this, but slightly different label layout) but when I run the Example demo code that comes with the library it fails at the locateFileStart function.
I've changed the demo code to use pin 9 instead of pin 8 for power.


The if expression in the 'for' loop in the locateFileStart function in nanofat.cpp never returns true.
Code: [Select]
// don't match with deleted, [system/volname/subdir/hidden] files
if (vars.de->filespec[0] != 0xe5 && (vars.de->attributes & 0x1e) == 0 && memcmp(cookedName, vars.de->filespec, 11) == 0) {


The SD Card has been formatted with FAT16 (Tried both Linux and Windows systems) and has a file called "data.log" as indicated in the demo (Tried both an empty file and a one byte file). There are no other files on the SD Card.

I don't know what to do from here to fix the problem, it doesn't appear to be a hardware issue since it's gotten this far. Any assistance would be appreciated.

Paraj

#2
Aug 28, 2009, 06:08 pm Last Edit: Aug 28, 2009, 07:00 pm by Paraj Reason: 1
It goes through the vars.buffer array and makes directory_entry's out of each element in nanofat.cpp in locateFileStart, however the memcmp(cookedName, vars.de->filespec, 11) doesn't return 0 because vars.de->filespec is filled with a few bytes of data.

The value of cookedName was
Code: [Select]
DATA    LOG
as expected but the filespec property of each directory_entry were as follows (shown here in hex) starting from element 0 ('<empty>' indicates no data):
Code: [Select]

FAB8
<empty>
4C02CD13EA
<empty>
<empty>
<empty>
<empty>
<empty>
<empty>
<empty>
<empty>
<empty>
<empty>
<empty>
3D
<empty>

Here's a link to the sector dump of the SD Card in a ZIP file (~2 MB) , just be aware that uncompressed it's ~2 GB, but nearly all of it is nulls, the VM I was using wasn't cooperating with me though so I couldn't just grab the sectors I wanted.

Go Up