Difference between revisions of "MSP430 Datalogger"

From DIDEAS Wiki
Jump to: navigation, search
m
 
(22 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Setup=
+
[[Main Page]]
  
==Support Software / Hardware==
+
=[[Datalogger Setup]]=
 +
Discussion of preparing the laboratory PC for working with the datalogger.
  
===required===
+
[[Image:datalog.jpg|right|thumb|160px|SD LOG]]
* C compiler and JTAG tools : http://mspgcc.sourceforge.net/ or [http://www.dideas.com/docs/datalogger/executable/mspgcc-20050614.exe locally]
 
  
* "Adapt3" USB drivers : http://www.ftdichip.com/Drivers/FT232-FT245Drivers.htm or [http://www.dideas.com/docs/datalogger/executable/ftdi-usbdriver-win2k-xp-R9052154.zip locally]
+
=[[Datalogger Use | Laboratory use of the Datalogger]]=
  
===optional / informative===
+
Discussion of programming the datalogger, preparing the SD card, etc.
* PC Hardware clock synchronization : http://www.thinkman.com/dimension4/download.htm
 
* Parallel port J-TAG cable : http://www.olimex.com/dev/msp-jtag.html
 
* Windows sync utility (explorer eject replacement) : (UNVERIFIED) http://www.only4gurus.com/v3/download.asp?ID=2443
 
* PC serial port terminal emulator for RS-232 debugging
 
* 1.5mm "straight" 10 pin programming cable - custom built from http://www.jst.com/ - [http://www.jst-mfg.com/ProductGuideE/EZR-D.html based on 10ZR-8M]
 
* [[ICC-MSP setup]]
 
  
==Software and Tools Setup==
+
=[[Datalogger Field | Field use of the Datalogger]]=
*Install MSP430-GCC.  Download [http://www.dideas.com/docs/datalogger/executable/mspgcc-20050614.exe Win32 version (mspgcc-20050614.exe)] [http://sourceforge.net/project/showfiles.php?group_id=42303 Other platforms]
 
 
 
*Optionally install [http://www.dideas.com/docs/datalogger/executable/ftdi-usbdriver-win2k-xp-R9052154.zip USB drivers] for Adapt3
 
 
 
*MSP430 firmware, [http://www.dideas.com/docs/datalogger/dl6_v1-082205.zip Download] and extract source code for the datalogger.
 
 
 
==My Tools Setup==
 
 
 
Executable binaries and source code are available from : http://www.dideas.com/docs/datalogger
 
 
 
At minimum download each of the binaries and copy into either the "working directory" or better yet or somewhere in your executable path.  I keep them in c:\bin
 
 
 
*[[jtag_clock]] [http://www.dideas.com/docs/datalogger/executable/jtag_clock.exe download]
 
*[[genfile]] [http://www.dideas.com/docs/datalogger/executable/genfile.exe download]
 
*[[sd_translate]] [http://www.dideas.com/docs/datalogger/executable/sd_translate.exe download]
 
*[[reset]] [http://www.dideas.com/docs/datalogger/executable/reset.bat download]
 
 
 
==Hardware Setup for MSP430 Programming==
 
 
 
*Connect the JTAG cable to the PC printer board and to the "Adapt3" PCB.  The JTAG cable is polarized to help connect it properly.
 
 
 
*Optionally connect "Adapt3" to the PC via the USB cable (you many need to install drivers). USB will provide power to the board - however the parallel port can also do this (but may not be reliable).  This USB interface is also used for debugging.
 
 
 
*Connect the 1.5mm cable (10 pins) to the "Adapt3" PCB and to the datalogger board requiring programming.
 
 
 
=Working with the Datalogger=
 
==Programming the Datalogger==
 
* Complete the software and hardware setup
 
* From the datalogger source code directory, build and download the package by typing "make download".  The download should take less than 1 minute.  After the download, jtag-talk will be run and will program the clock. 
 
 
 
* some other commands:
 
* make - just build the project, don't download
 
* make clean - clean up the project in preparation for a total rebuild
 
* make clock - start the "jtag_clock" program that will attempt to talk with the datalogger and set it's clock
 
* reset - a batch script that resets the datalogger
 
 
 
==SD Card Preparation==
 
 
 
The SD Card preparation is essentially a process of wiping the card with a known value and also creating a single sequential file in the card's root directory.
 
 
 
The following information was created and verified using Windows 2000 SP4.
 
 
 
Format card using FAT16 and largest allowable cluster size:
 
 
 
 
 
format <drive_letter> /FS:FAT /A:16K /V:
 
 
 
(/A:8192 for 64MB MMC card)
 
 
 
 
 
A cluster size of 16K was the largest permitted 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 available for logging)
 
 
 
 
 
If format doesn't report the drive size, use chkdsk <drive letter> to determine 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 "sdtest00.txt" ("timing00.bin" next version) that fills the SD card.  This binary file contains a single value 0x5A (next version will be 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.
 
 
 
 
 
Example : genfile n:timing00.bin 7666C 0x5a 16k
 
 
 
Next version Example : genfile n:timing00.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. 
 
 
 
===Shortening the Preparation Procedure===
 
Format and genfile can take several minutes to complete for a large card. 
 
 
 
When "wiping" the card, the procedure may be shortened if you know that only small portion of the card has been overwritten.  For example its not necessary to reformat the card every time, nor is it necessary to use genfile to fill the entire card.  However, it is necessary to format and fill the entire card before the first use.
 
 
 
=== 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.  (Using the FAT to direct the write activity would require additional RAM and/or require additional power / time to frequently read the FAT).  At insertion the partition table, boot record, and root directory are analyzed ultimately to find the cluster number of a single file "sdtest00.txt" (next version "timing00.bin").  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 use a binary search algorithm to search the card's complete data area to locate "end of file" (the size of the file in the FAT isn't used). End of file is defined as the last sector that does NOT start with 4 bytes of 0x5a (next version 0xFF).  Writing will commence with the first LBA that does contain 0x5a5a5a5a (next version 0xFFFFFFFF) and will continue sequentially though the entire data area of the card.
 
 
 
=== Storing Extra Data on the Card ===
 
* The datalogger makes use of the first partition that is of type FAT16.  Creating a non FAT16 partition, or a 2nd FAT16 may be used for alternative applications
 
 
 
* Small amounts of information may be stored in the root directory as the filename.  There are two restrictions. 
 
#The datalogger file must be in the first sector of the root directory (with in the first 32 file name entries files)
 
#The maximum size of the root directory not be exceeded
 
(Remember - long file names take more than one directory entry)
 
 
 
* Actual files may be placed in the same partition as the datalogger file so long as
 
#the clusters precede the first cluster of the datalogger file
 
#the datalogger file - cluster chain not be fragmented.
 
 
 
 
 
These requirements are easily accomplished by following the following preparation sequence:
 
#format the card
 
#write the non-datalogger files
 
#write the datalogger file
 
  
 
=Information and Specs=
 
=Information and Specs=
 
*[http://www.sandisk.com/oem/default.asp Sandisk OEM info for SD and MMC]
 
*[http://www.sandisk.com/oem/default.asp Sandisk OEM info for SD and MMC]
  
*Datasheets and application notes
+
*[http://www.dideas.com/docs/datalogger/datasheet/ Datasheets and application notes]
 
 
=DL6 Issues=
 
* Datalogger supply voltage is restricted to the 2.7 to 3.3V range.  Outside of this range communication with both the DS1339 and SD/MMC card become problematic. 
 
 
 
 
 
Workarounds :
 
# Keep fresh batteries in the unit - however there is no advance way of know that a low voltage will occur shortly soon - and thus the batteries usage needs to be further restricted.
 
# Break the jumper trace connecting BAT+ to VCC.  Install a Schottky diode between BAT+ and VCC.  Install a 2nd Schottky diode between VCC.SD and VCC.  The result is that the maximum of BAT+ SD.VCC are used to power the CPU and DS1339.  The voltage differential between the SD card and CPU will be small to permit communication.  The CPU will operate from the BAT+ voltage under most conditions, however when DS1339 communication is required (only at reset), the voltage booster will be started.  The voltage booster is also normally powered durning SD communication.
 
 
 
* DL6F PCB crystal pads are covered in solder mask part of this should be exposed
 
 
 
Workaround :
 
# remove portion of solder mask exposed with flat screwdriver
 
 
 
* Not possible to test battery voltage as the voltage booster needs to be enabled to enable testing, and thus the boosted voltage is tested
 
 
 
* No low voltage reset
 
 
 
* Watchdog reset software protection can fail if the supply voltage is too low to maintain WDR oscillator - but not low enough to cause reset.  Could happen when batteries are near depleation or removed.
 
 
 
 
 
 
 
 
 
==Special Assembly Instructions==
 
* solder mask on large pad adjacent to XX1, XX2, XR1 needs to be partially removed so that crystals can be soldered to PCB
 
 
 
* trace connecting pads of SH1 needs to be cut
 
 
 
* 2 pins of SOT-523 diode should be soldered SH1
 
 
 
* 3rd pin of SOT-523 diode has jumper wire that connects to CD1 far side pad
 
 
 
* push button switch is not populated
 
 
 
* Use BAT54CT-FDICT-ND for SOT-523 diode
 
 
 
=SD / MMC Requirements and Test Results =
 
 
 
The datalogger requirements:
 
* SPI mode of operation. 
 
* 3.3V (+-5V) operation
 
* full sized SD/MMC (reduced size not tested)
 
 
 
The datalogger and firmware has been tested with 4 types of SD and MMC cards with a range of sizes from 32 to 128mB and is believed to work with all. The firmware in was unable to operate with two cards - however a commercial card reader and Windows 2000 also failed these cards.
 
 
 
 
 
==passed==
 
*Lexar SD Card "Digital Film" (PAS032BADBV) 32MB : CID = 1 50 41 53 30 33 32 42 41 44 42 56 b2 0 44 a9
 
* SandDisk SD Card 64MB (SDSD064C) : CID = 0 53 44 53 44 30 36 34 43 68 d4 b6 8c 0 33 19
 
* A-Data MMC "My Flash" 64MB (4SDMMC) : CID = ff 12 34 53 44 4d 4d 43 20 11 30 0 30 0 27 cb
 
* PNY SD Card 128 MB (IN128MB) : CID = 18 49 4e 31 32 38 4d 42 3 40 5e d8 71 0 56 55
 
* PNY SD Card 64 MB
 
 
 
==failed==
 
  
*Sandisk SD Card 128MB (card has invalid track 0 under Win2K also)
+
*[[DS1339 Discussion]]
*SanDisk SD Card 64MB (card has invalid track 0 under Win2K also)
 
  
=Delivered=
+
=[[DL6F Issues]]=
  
* 8-21-05 : modified device (xxx-nnnn, 64MB MMC flash card, DL6 datalogger ser#2) with "alpha firmware"
+
Known problems with the DL6F design and workarounds
* 8-21:05 : JTAG programming system (Olimex adapter, parallel port extension, adapt3 interface card, USB cable, 1.5mm DL6 programming cable)
 
* 8-23-05 : [http://www.dideas.com/docs/datalogger/datalogger-dl6-bom-v11-082305.xls Bill of materials V1.1 for DL6F (XLS format)]
 
* 8-23-05 : PCB Camera artwork for DL6F and instructions for re-producing datalogger.
 
* 8-24-05 : firmware DL6-V2 (alpha2)
 
* 8-30-05 : 3 modified devices with 64 MB SD cards, DL6 datalogger ser 3,4,5) with "beta firmware DL6V4"
 
  
== Special Features Added ==
+
=[[SD / MMC Requirements and Test Results]]=
* serial number sent by jtag_clock stored in DS1339 written to card on insert action
 
  
 +
Results of various SD and MMC cards.
  
 +
=[[DL6F delivery | Delivered and Status]]=
  
=Assembly DOCS=
+
Dates of deliveries and project status.
*[http://www.dideas.com/docs/datalogger/datalogger-dl6f-assembly-bom-v12-083105.xls Assembly Bill of materials V1.2 for DL6F (XLS format)]
 
  
 +
=[[DL6F Assembly | Assembly Documentation]]=
  
*[http://www.dideas.com/docs/datalogger/special_assembly_pics/ Special assembly photographs, and PCB layout graphics]
+
Bill of materials and assembly documentation

Latest revision as of 19:31, 9 August 2006

Main Page

Datalogger Setup

Discussion of preparing the laboratory PC for working with the datalogger.

SD LOG

Laboratory use of the Datalogger

Discussion of programming the datalogger, preparing the SD card, etc.

Field use of the Datalogger

Information and Specs

DL6F Issues

Known problems with the DL6F design and workarounds

SD / MMC Requirements and Test Results

Results of various SD and MMC cards.

Delivered and Status

Dates of deliveries and project status.

Assembly Documentation

Bill of materials and assembly documentation