Difference between revisions of "MSP430 Datalogger"

From DIDEAS Wiki
Jump to: navigation, search
m
m
Line 22: Line 22:
  
 
Use "genfile" to write a file named "datalog0.bin" that fills the SD card.  This binary file contains a single value (0xFF) and is designed to overwrite previous data on the card and most importantly to cause windows to create a single FAT file chain the starts with cluster 2, 3, 4, 5, ..., last available cluster.
 
Use "genfile" to write a file named "datalog0.bin" that fills the SD card.  This binary file contains a single value (0xFF) and is designed to overwrite previous data on the card and most importantly to cause windows to create a single FAT file chain the starts with cluster 2, 3, 4, 5, ..., last available cluster.
 
  
 
genfile n:datalog0.bin 7666C 0xff 16k
 
genfile n:datalog0.bin 7666C 0xff 16k
  
  
 
+
Finally before removing the SD card, flush file system buffers.  You can use the cygwin "sync" command, or rom explorer, right click on the drive letter representing the SD card, and select eject.   
 
 
Cause windows to flush data buffers.  From explorer, right click on the drive letter representing the SD card, and select eject.  You can remove the card.
 
  
 
=== How the datalogger chooses where to write data on the SD card ===
 
=== How the datalogger chooses where to write data on the SD card ===
 
The datalogger only consults the SD card's FAT when the card is inserted and thus does not modify the FAT or follow it.  At insertion the partition table, boot record, and root directy are analyzed ultimatly to find the cluster number of a single file "datalog0.txt".  If the file doesn't exist then the logger stops and waits for a card insertion event.  If the file is found then the starting cluster is read and from that the LBA (logical block address) of the start of the file is calculated. The datalogger will then using a binary search algorithm searching the card's complete data area to locate "end of file". End of file is define as the last sector that does NOT start with 4 bytes of 0xFF.  Writing will comence with the first LBA that does contain 0xFFFFFFFF.
 
The datalogger only consults the SD card's FAT when the card is inserted and thus does not modify the FAT or follow it.  At insertion the partition table, boot record, and root directy are analyzed ultimatly to find the cluster number of a single file "datalog0.txt".  If the file doesn't exist then the logger stops and waits for a card insertion event.  If the file is found then the starting cluster is read and from that the LBA (logical block address) of the start of the file is calculated. The datalogger will then using a binary search algorithm searching the card's complete data area to locate "end of file". End of file is define as the last sector that does NOT start with 4 bytes of 0xFF.  Writing will comence with the first LBA that does contain 0xFFFFFFFF.

Revision as of 08:37, 22 August 2005

Support Software / Hardware

SD Card Preperation

The following information was created and verified using Windows 2000 SP4.

Format card using FAT16 and largest possible cluster size:


format <drive_letter> /FS:FAT /A:16K /V:


A cluster size of 16K was the largest permited with the SD 128MB card. Possibly a smaller cluster size will need to be used with a smaller SD card. (Large cluster size means that FAT is smaller (which isn't used anyway) - and thus more space is avaialble for logging)

IF format doesn't report the drive size, use chkdsk <drive letter> to deterime the size of the SD card. The card size is reported in bytes, but then may also be given in "allocation units". If so - record the allocation units and the cluster size.

Use "genfile" to write a file named "datalog0.bin" that fills the SD card. This binary file contains a single value (0xFF) and is designed to overwrite previous data on the card and most importantly to cause windows to create a single FAT file chain the starts with cluster 2, 3, 4, 5, ..., last available cluster.

genfile n:datalog0.bin 7666C 0xff 16k


Finally before removing the SD card, flush file system buffers. You can use the cygwin "sync" command, or rom explorer, right click on the drive letter representing the SD card, and select eject.

How the datalogger chooses where to write data on the SD card

The datalogger only consults the SD card's FAT when the card is inserted and thus does not modify the FAT or follow it. At insertion the partition table, boot record, and root directy are analyzed ultimatly to find the cluster number of a single file "datalog0.txt". If the file doesn't exist then the logger stops and waits for a card insertion event. If the file is found then the starting cluster is read and from that the LBA (logical block address) of the start of the file is calculated. The datalogger will then using a binary search algorithm searching the card's complete data area to locate "end of file". End of file is define as the last sector that does NOT start with 4 bytes of 0xFF. Writing will comence with the first LBA that does contain 0xFFFFFFFF.