Connecting an SD-Card to your Launchpad opens up your options to use the MSP430 platform as a cheap data logger, from temperature to acceleration. Although you can log to an SD-Card in a raw format, it is much more useful if you could store data onto it as files. This will allow you to disconnect the card from your Launchpad(using a BoosterPack) and view the files on it on a PC. Luckily for us, a guy known as Elm-Chan created a free, open-source FAT file system library, which can be used on flash disks and USB sticks. However, if you have worked with the Launchpad G2, you have realized that it is low on memory making us wary of dumping huge code libraries into it. Elm-Chan comes to our rescue again with a smaller library, aptly named Petite-FS. The only drawback of this library is the user has to pre-create the file on the SD-Card on a PC before using it on the Launchpad. This should not pose an issue as we can write to that file all day long.

Required Tools And Hardware Launchpad EXP-MSP430G2

SD-Card BoosterPack

SD-Card, any size.

USB cable

Required Software Energia, download from here.

SD-Card demo code, download from here.

Make sure the BoosterPack is oriented on the Launchpad the correct way.

Connections The 43oh Store sells an SD-Card BoosterPack, assembled or PCB only. The new version v1.2 of the PCB already has the jumpers set to connect the SD-Card pins to the USCI module of the MSP430. Pin 8 or Port2.0 connects Chip Select line to the SD-Card. One major advantage of the SD-Card BoosterPack is that you can connect it to any other micro-controller of your choice using the breakout connector J3. Mount the SD-Card BoosterPack to the Launchpad as shown in the adjoining image.

Hardware Preparation 1. Insert the Launchpad into a spare USB port on your PC. Make sure your drivers for the Launchpad get installed correctly. You should see "MSP430 Application UART" in your COM port device manager. If not, you can download the drivers from here. 2. Take the SD-Card you want to use and plop it into your PC. PetiteFS requires the user to pre-create the log file of the desired size. In this example we create a log file of 1MByte using fsutil and fill it with NULLs. This will allows us to log 2048 log entries( 1048576/512 = 2048 ). Open up a command window in windows as administrator and issue the following command: fsutil file createnew LOG.txt 1048576 To make it easier for you we created a LOG.txt file for you in the same folder as the sketch. 3. Copy the the file LOG.txt under the PFatFs subdirectory to the root folder of the SD-Card. You can leave any other files on the card, but deleting them for this example is suggested. 4. Now copy the file to your SDCard and insert it into your BoosterPack. When you connect your Launchpad to the PC, the red led on the BoosterPack should turn on, which means the card has been inserted properly.

Downloading and Running Code 1. We hope you have Energia downloaded and running. If not, go here to download the latest version. 3. Download the code for this example from here. See the SDCardTutorialWithEnergia folder? Unzip it and copy it to the Energia Library directory, under hardware msp430 libraries Now, open Energia and click Open. Browse to the sketch SDCardTutorialWithEnergia.ino under hardware msp430 libraries SDCardTutorialWithEnergiaexamples SDCardTutorialWithEnergia 3. Open Energia.exe and select the correct terminal for your Launchpad as shown below: 4. Now click File->Upload and Open Serial Monitor. A serial port should pop up. Press the reset button on your Launchpad and you should see something like the below window. That's it. Press button S2 and the Launchpad will start writing the current temperature into your SD-Card.