SLAA281C November 2005 – August 2018 MSP430F1610 , MSP430F1610 , MSP430F1611 , MSP430F1611 , MSP430F1612 , MSP430F1612 , MSP430G2001 , MSP430G2001 , MSP430G2101 , MSP430G2101 , MSP430G2111 , MSP430G2111 , MSP430G2121 , MSP430G2121 , MSP430G2131 , MSP430G2131 , MSP430G2201 , MSP430G2201 , MSP430G2201-Q1 , MSP430G2201-Q1 , MSP430G2211 , MSP430G2211 , MSP430G2221 , MSP430G2221 , MSP430G2231 , MSP430G2231 , MSP430G2231-Q1 , MSP430G2231-Q1
This application report and the associated source code files demonstrate a serial peripheral interface (SPI) between the MSP430F1612 microcontroller (MCU) and an MMC or SD flash memory card that used in SPI mode. The provided information can be used with any MSP430™ MCU with a hardware SPI interface.
The sample software described in this application report can be downloaded from http://www.ti.com/lit/zip/slaa281.
MSP430 is a trademark of Texas Instruments.
All other trademarks are the property of their respective owners.
The MSP430F1612 communicates with the MMC or SD card through the SPI interface. SPI is a fast and efficient protocol that allows for simultaneous bidirectional data transfer. Serial data is transmitted and received by the MSP430 MCU using the USART module in SPI mode. Figure 1 shows the hardware interconnection for the master-slave configuration operating on a single supply voltage.
The associated MSP430F1612 pins P5.3 and P5.4 are configured as GPIO to control the chip-select pin and read the memory card detect signal. The USART1 hardware peripheral of the MSP430F1612 is configured in the 3-pin SPI mode. Pins P5.1, P5.2, and P5.3 of the MSP430 MCU provide the SIMO1, SOMI1, and UCLK1 interface to the MMC card.
The code associated with this application report is designed as a driver set for communication between an MSP430 MCU and an MMC card or an SD card through the SPI bus as described in Section 1. The code is written modularly and can be reused easily. Only a subset of the available card commands is used, based on the limitations of the SPI interface and the secure functions of the SD card. This sample code can be downloaded from http://www.ti.com/lit/zip/slaa281.
An example main() function shows the proper use of the driver functions.
Uncomment the following line of code to use the MSP430F1612 DMA module for data transmission between the MCU and the MMC card, which results in higher communication speed and less CPU load.
//#define withDMA
If you adapt the software to a different USART or a different device in which the USART is connected to other port pins, modify the following functions for the correct settings: