Presentation on theme: "PSoC R Secure Digital (SD) Card Module Solution. 2 Agenda SD Card Basics Types of Media Applications Communication File System SD Card Lab Project 1:"— Presentation transcript:
PSoC R Secure Digital (SD) Card Module Solution
2 Agenda SD Card Basics Types of Media Applications Communication File System SD Card Lab Project 1: Run a short demo that prints the string Hello World to the SD Card Additional Example Projects
SD Card Basics
4 What is an SD Card? High-capacity, inexpensive, portable flash (non-volatile) memory Capacity: 32MB to 2GB Size: 11mm x 15mm x 1mm Designed for fast and easy transfer of data between devices Security for copyright protection on SD Cards
5 PSoC + SD: Supported Media SD 32mmx24mmx2.1mm 2GB - $100 / 256MB - $20 miniSD Great for small electronics 256MB - $35 microSD/TransFlash Smallest memory card available 256MB - $35 / 2GB - $120 MMC Up to 8GB 2GB - $50 RS-MMC/MMCmobile Popular for handsets MMCmobile: Meets lower voltage spec of 1.8V HCSD Capacity > 2GB SDIO Extends functionality of devices with SD Card socket Not Supported
6 Where is SD Used? Digital Cameras (DSC, Video) Media Players Voice Recorders PDA PC Peripherals GPS – Data Tracking Mobile Handsets – Number and Setting Storage Exercise Equipment – Storing Data Bootloaders – Feed Data to Other Devices for Programming Shoes….
7 Where is SD Used? PSoC Supported Digital Cameras (DSC, Video) Media Players Voice Recorders PDA PC Peripherals GPS – Data Tracking Mobile Handsets – Number and Setting Storage Exercise Equipment – Storing Data Bootloaders – Feed Data to Other Devices for Programming Shoes….
8 PSoC + SD: Required Resources Digital BlocksAnalog BlocksFlashRAMI/O 1 (DCB)020kB700 bytes4-7 File System must be compatible with the build configuration (selectable parameter) of the User Module (UM) Several build configurations are available in the SDCard UM Complex file systems require more flash Must support additional addressing requirements Full – Additional addresses require more flash (How much on average?) Standard – Complete API list is loaded into library source file (How much do you save by using FAT16/Standard option?) Build Configuration Options: FAT32: Must use Full File System build configuration FAT16: Can use Standard File System or Full File System build configuration Basic Read Only Basic Read Write APIs removed from library source file reduced flash usage No file system reduced flash usage **Limited to only 29xxx family parts
9 Why is so much Flash required? Implementing the file system to interface to SD Card requires sizeable Flash space Most cards are formatted with FAT32 (Generally 32MB and greater)- Full file system build configuration. **FAT32 is a more complex file system, and requires more flash to support additional addresses available in the card.
10 Some Definitions: File System Data Structure that… Stores and organizes computer files and data Facilitates access to storage devices Contains directories with subsets of filenames Allows files to be searched, copied, renamed, removed, etc.
11 PSoC File System Compatibility Compatible: MS-DOS - Microsoft FAT16 FAT32 NOT Compatible: MS-DOS FAT12 Limited availability Requires more code space than FAT16 3-bit nibbles HFS - Hierarchical File System Apple Computer – MAC OS NTFS – New Technology File System Windows NT Windows 2000 Windows XP
12 Some Definitions: FAT FAT: Disk structure that partitions blocks of contiguous space into clusters Connects each file with an index into a file allocation table (FAT) Clusters are typically 2 KB to 32 KB in size Clusters contain groups of sectors which are 512 bytes in size Each cluster may only link to one file at a time Files typically contain many sectors or clusters FAT entries correspond one for one with clusters Each FAT entry points to the next FAT entry for the same file or directory A special value indicates the end of the file The size of FAT entries dictates the size of the FAT and the maximum size of the disk. There are 3 common FAT entry sizes in use: FAT Entry SizeNumber of Clusters FAT124,078 FAT1665,518 FAT32268,435,438
13 PSoC + SD: Nuances Requires Short File Names (Dos8.3) Saves code space Generally longer file names are mapped to other directories which arent supported Supports Only 1 Directory: Root Directory More code is required to track directory paths Flat-file system Speed Reduced with Multiple Files Open More RAM needed for additional files Read/Write speed of ~2200 BYTES per second SPI mode instead of SD mode Clock speed Two clock speed choices: 24 MHz at 5V: 5% Performance Enhancement 12 MHz at 3.3V Limited by cache buffer size
17 SD Internals PSoC implements the file system: 1.PSoC supplies a command to the card interface controller in order to read from or write to files on the SD card 2.Card interface controller retrieves data 3.PSoC completes calculations to determine further necessary commands
SD Card Lab
19 Lab Hardware: CY3210-SDCARD SD Card Adapter board (3.3V) is compatible with the LCD connector on the CY3210-PSoCEVAL1 board (shown) To properly supply SD Card Adapter board with 3.3V 1.Insert jumper JP3 to regulate voltage to 3.3V 2.Remove the following jumpers: JP2: Connects P27 to TX pin JP1: Connects P16 to RX pin
20 Lab Hardware: SD USB CY3210-SDCARD Kit also contains SD Card Reader/Writer with USB connection 64 MB SD Card Connect Reader/Writer to PC and insert SD Card to read *Note: Additional projects located in PSoC Designer Examples directory
21 Lab Software: You Need to Install… PSoC Designer PSoC Express PSoC Programmer Latest User Module (UM) Extension Pack
22 Project 1: Hello World Quick Example Build Project Insert SD Card Adapter board into LCD connector on CY3210-PSoCEval1 board (as shown) Put CY8C PXI PSoC device into 28- pin PDIP socket Open Hello World project from PSoC Designer in the following directory: C:\ProgramFiles\CypressMicrosystems\ PSoCDesigner\Examples\SDCard\Hello Generate application, build and program part Connect 12V power supply to voltage regulator on PSoCEval1 board Run Project Insert SD Card into SD Card Adapter boards socket PSoC writes Hello World to SD Card Remove SD Card Place SD Card in USB Thumb Drive Read hello.txt *Note: Using MiniProg to program will supply the entire PSoCEVAL1 board 5V. Remove SD Card from Adapter board before using MiniProg.
23 Additional Example Projects The following example projects are located within PSoC Designer: C:\Program Files\Cypress MicroSystems\PSoC Designer\Examples\SDCard AppendFile - Open a file and write string to a file. Also print files size out the serial port. ListFiles - When card is inserted in the SD socket, the files names and their sizes will be printed via the serial port. SdCopyFile - Creates a file then copies it to another file. UartLog - This application requires the use of a terminal emulator. It will log data to the SD Card until a line with a period "." in the first character location is detected. UartRead - Open a specific file and display its contents via a serial port.