为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

Ti sd卡

2011-03-03 5页 pdf 75KB 24阅读

用户头像

is_949030

暂无简介

举报
Ti sd卡 1 Hardware Description CS DI VSS VCC SCK CD DO 1 2 3 4 5 6 7 3 V 47 kW 100 nF 3 V 0.1 µF P5.0 P5.1/SIMO1 P5.3/UCLK1 P5.6 P5.2/SOMI1 RST DVCC AVCC DVSS AVSS MSP430F161x MMC Card 47 kW Application Report SLAA281B–November 2005–Revised M...
Ti  sd卡
1 Hardware Description CS DI VSS VCC SCK CD DO 1 2 3 4 5 6 7 3 V 47 kW 100 nF 3 V 0.1 µF P5.0 P5.1/SIMO1 P5.3/UCLK1 P5.6 P5.2/SOMI1 RST DVCC AVCC DVSS AVSS MSP430F161x MMC Card 47 kW Application Report SLAA281B–November 2005–Revised March 2008 Interfacing the MSP430 With MMC/SD Flash Memory Cards Stefan Schauer, Christian Speck.............................................................................................. MSP430 ABSTRACT This application report and the associated source code files demonstrate the implementation of a serial peripheral interface (SPI) between the MSP430F161x microcontroller and an MMC or SD flash memory card used in SPI mode. The provided information can be used with any MSP430 device with a hardware SPI interface. The MSP430F161x is used to communicate with the MMC or SD card via 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 using the USART module in SPI mode. The hardware interconnection for the master-slave configuration operating on a single supply voltage is shown in Figure 1. The associated MSP430F161x 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 MSP430F161x is configured in the 3-pin SPI mode. Pins P5.1, P5.2, and P5.3 of the MSP430 provide the SIMO1, SOMI1, and UCLK1 interface to the MMC card. Figure 1. Connection Between MSP430 and MMC Card SLAA281B–November 2005–Revised March 2008 Interfacing the MSP430 With MMC/SD Flash Memory Cards 1 Submit Documentation Feedback www.ti.com 2 Software Description 3 Function Description 3.1 char mmcInit (void); 3.2 char mmcping(void); 3.3 void mmcSendCmd (const char cmd, unsigned long data, const char crc); Software Description The code associated with this application note is designed as a driver set for communication between an MSP430 and an MMC card or an SD card via the SPI bus as illustrated in the preceding hardware section. The code is written modularly and can be reused easily. Note that 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. An example main() function is provided to illustrate proper use of the driver functions. It initializes the MSP430F161x in the 3-pin SPI mode with the function mmcInit(). The MSP430 then polls until an MMC card is detected and tries to read the device memory size. Upon the completion, the MSP430 prepares a buffer with 512 bytes of data and writes it into two different sectors of the card. Finally, the MSP430 reads the data back that was written to each memory segment. After uncommenting the code line: //#define withDMA the MSP430F161x DMA module is used for data transmission between the MSP430 and the MMC card, resulting in higher communication speed and less CPU load. If the software is adapted to a different USART or a different device in which the USART is connected to other port pins, the following functions must be checked for the correct settings: • void initSPI (void) • char mmcInit (void) • mmc.h file Initialize the port, SPI, and the MMC card. This routine may need to be adjusted if the library is adapted to another MSP430 type or to another USART module. Also, some of the control signals can be set to a different port, if necessary. Parameter: None Return: Status Error/success code Check if MMC card is present. Parameter: None Return: Status Error/success code Send a command to the MMC card. Parameter: cmd Command that should be sent to the MMC card data Data for the command crc Checksum for the command Return: None Interfacing the MSP430 With MMC/SD Flash Memory Cards2 SLAA281B–November 2005–Revised March 2008 Submit Documentation Feedback Administrator 打字机 有插图的 Administrator 打字机 先前的 Administrator 打字机 Administrator 打字机 子集 Administrator 打字机 局限 www.ti.com 3.4 char mmcGoIdle(); 3.5 char mmcSetBlockLength (const unsigned long); 3.6 char mmcReadBlock(const unsigned long address, const unsigned long count, 3.7 char mmcWriteBlock (const unsigned long address, const unsigned long count, Function Description Set the MMC card in idle mode to save current. Parameter: None Return: Status Error/success code Set the MMC block length of count = 2n byte. Normally this command is not required. The default block length is 512 bytes. Parameter: Block Length of count = 2n Byte Return: Status Error/success code unsigned char *pBuffer); #define mmcReadSector(sector, pBuffer) mmcReadBlock(sector × 512, 512, pBuffer) Read a size byte big block beginning at the address. Parameter: address Start address of data to read on the card count Number of bytes to read pBuffer Pointer to read buffer Return: Status Error/success code unsigned char *pBuffer); #define mmcWriteSector(sector, pBuffer) mmcWriteBlock(sector × 512, 512, pBuffer). Write a 512 byte big block beginning at the (aligned) address Parameter: address Start address of data to read on the card count Number of bytes to write pBuffer Pointer to write buffer Return: Status Error/success code SLAA281B–November 2005–Revised March 2008 Interfacing the MSP430 With MMC/SD Flash Memory Cards 3 Submit Documentation Feedback tw 打字机 空闲模式 tw 打字机 www.ti.com 3.8 char mmcReadRegister (const char cmd_register, const unsigned char length, 3.9 unsigned long mmcReadCardSize(void); 4 References References unsigned char *pBuffer); Read the Register arg1 with Length arg2 (into the buffer). Parameter: cmd_register Register to read length Number of bytes to read pBuffer Pointer to read buffer Return: Status Error/success code Read the card size from the CSD Register. Parameter: None Return: Detected card size 1. MSP430x169 Mixed Signal Microcontroller Data Sheet (SLAS368) 2. MSP430x1xx Family User’s Guide (SLAU049) 3. SanDisk MultiMediaCard Product Manual (SanDisk, 2001) 4 Interfacing the MSP430 With MMC/SD Flash Memory Cards SLAA281B–November 2005–Revised March 2008 Submit Documentation Feedback IMPORTANT NOTICE Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements, and other changes to its products and services at any time and to discontinue any product or service without notice. Customers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All products are sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment. TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI’s standard warranty. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where mandated by government requirements, testing of all parameters of each product is not necessarily performed. TI assumes no liability for applications assistance or customer product design. Customers are responsible for their products and applications using TI components. To minimize the risks associated with customer products and applications, customers should provide adequate design and operating safeguards. TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right, copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process in which TI products or services are used. Information published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI. Reproduction of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional restrictions. Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements. TI products are not authorized for use in safety-critical applications (such as life support) where a failure of the TI product would reasonably be expected to cause severe personal injury or death, unless officers of the parties have executed an agreement specifically governing such use. Buyers represent that they have all necessary expertise in the safety and regulatory ramifications of their applications, and acknowledge and agree that they are solely responsible for all legal, regulatory and safety-related requirements concerning their products and any use of TI products in such safety-critical applications, notwithstanding any applications-related information or support that may be provided by TI. Further, Buyers must fully indemnify TI and its representatives against any damages arising out of the use of TI products in such safety-critical applications. TI products are neither designed nor intended for use in military/aerospace applications or environments unless the TI products are specifically designated by TI as military-grade or "enhanced plastic." Only products designated by TI as military-grade meet military specifications. Buyers acknowledge and agree that any such use of TI products which TI has not designated as military-grade is solely at the Buyer's risk, and that they are solely responsible for compliance with all legal and regulatory requirements in connection with such use. TI products are neither designed nor intended for use in automotive applications or environments unless the specific TI products are designated by TI as compliant with ISO/TS 16949 requirements. Buyers acknowledge and agree that, if they use any non-designated products in automotive applications, TI will not be responsible for any failure to meet such requirements. Following are URLs where you can obtain information on other Texas Instruments products and application solutions: Products Applications Amplifiers amplifier.ti.com Audio www.ti.com/audio Data Converters dataconverter.ti.com Automotive www.ti.com/automotive DSP dsp.ti.com Broadband www.ti.com/broadband Clocks and Timers www.ti.com/clocks Digital Control www.ti.com/digitalcontrol Interface interface.ti.com Medical www.ti.com/medical Logic logic.ti.com Military www.ti.com/military Power Mgmt power.ti.com Optical Networking www.ti.com/opticalnetwork Microcontrollers microcontroller.ti.com Security www.ti.com/security RFID www.ti-rfid.com Telephony www.ti.com/telephony RF/IF and ZigBee® Solutions www.ti.com/lprf Video & Imaging www.ti.com/video Wireless www.ti.com/wireless Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright © 2008, Texas Instruments Incorporated 1 Hardware Description 2 Software Description 3 Function Description 3.1 char mmcInit (void); 3.2 char mmcping(void); 3.3 void mmcSendCmd (const char cmd, unsigned long data, const char crc); 3.4 char mmcGoIdle(); 3.5 char mmcSetBlockLength (const unsigned long); 3.6 char mmcReadBlock(const unsigned long address, const unsigned long count, unsigned char *pBuffer); 3.7 char mmcWriteBlock (const unsigned long address, const unsigned long count, unsigned char *pBuffer); 3.8 char mmcReadRegister (const char cmd_register, const unsigned char length, unsigned char *pBuffer); 3.9 unsigned long mmcReadCardSize(void); 4 References
/
本文档为【Ti sd卡】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索