520 likes | 669 Views
Efteruddannelse Embedded C. Modul 5 (Fredag den 23/4 -2010 ). 07.01.2010. Modul 1. SPI protokollen SD Card Korttyper Features Interface Opbygning og interne registre Kommunikationsprotokol Funktioner med variabelt antal parametre Afrunding og evaluering. SPI kommunikation.
E N D
EfteruddannelseEmbedded C Modul 5 (Fredag den 23/4-2010) 07.01.2010
Modul 1 • SPI protokollen • SD Card • Korttyper • Features • Interface • Opbygning og interne registre • Kommunikationsprotokol • Funktioner med variabelt antal parametre • Afrunding og evaluering
SD Card typer • SD Card • mini SD • micro SD • SDHC • mini SDHC • micro SDHC • SDXC
SDCARD Features • Targeted for portable and stationary applications • Memorycapacity: • Standard Capacity SD Memory Card: Up to and including 2 GB • High Capacity SD Memory Card: More than 2GB (This version of specification limits capacity up to and including 32GB) • Voltage range: • High Voltage SD Memory Card – Operating voltage range: 2.7-3.6 V • Dual Voltage SD Memory Card – Operating voltage range: Low Voltage Range (T.B.D) and 2.7-3.6 V • Designed for read-only and read/write cards. • Default mode: Variable clock rate 0 - 25 MHz, up to 12.5 MB/sec interface speed (using 4 parallel data lines) • High-Speed mode: Variable clock rate 0 - 50 MHz, up to 25 MB/sec interface speed (using 4 parallel data lines)
SDCard Features • Correction of memory field errors • Card removal during read operation will never harm the content • Content Protection Mechanism - Complies with highest security of SDMI standard. • Password Protection of cards (CMD42 - LOCK_UNLOCK) • Write Protect feature using mechanical switch • Built-in write protection features (permanent and temporary) • CardDetection (Insertion/Removal) • Applicationspecificcommands • Comfortableerasemechanism
Protocol attributes of the communication channel: • SD Memory Card Communication Channel • Six-wirecommunicationchannel • (clock, command, 4 data lines) • Error-protected data transfer • Single or Multiple block oriented data transfer • SD MemoryCard Form-factor • Standard Size SD Memory Card: Specified in this specification (See Chapter 6 and 8) • miniSD Memory Card: Specified in “miniSD Memory Card Specification” • microSD Memory Card: Specified in “microSD Memory Card Specification” • Standard Size SD Memory Card thickness is defined as both 2.1 mm (normal) and 1.4 mm • (Thin SD MemoryCard). SDCARD Feautures
SPEED Class • Four Speed Classes are defined and indicate minimum performance of the cards • Class 0 - These class cards do not specify performance. It includes all the legacy cards prior to this specification, regardless of its performance • Class 2 - Are more than or equal to 2 MB/sec performance. • Class 4 - Are more than or equal to 4 MB/sec performance. • Class 6 - Are more than or equal to 6 MB/sec performance. • High Capacity SD Memory Cards shall support Speed Class Specification and have performance more than or equal to Class 2. • Note that the unit of performance [MB/sec] indicates 1000x1000 [Byte/sec] while the unit of data size [MB] indicates 1024x1024 [Byte]. This is because the maximum SD Bus speed is specified by the maximum SD clock frequency (25 [MB/sec] = 25000000 [Byte/sec] at 50 MHz) and data size is based on memory boundary (power of 2).
Kommando’er • Der er forskel på om man tilgår SD card i SD mode eller i SPI mode som det kan ses i specifikationen er der en del kommendor der ikke findes i SPI mode. • Se i filen : • ..\..\Datasheet\ProdManualSDCardv1.9.pdf
Sendes på den 1 bits commandolinie, derfor start og stop bit. Commandtokens Eller
Format af responsetoken Der findes 4 forskellige type R1, R3, R6 og R2. Der findes 2 forskellige størrelser 48 bits – R1, R3 og R6 136 bits – R2
Øvelse • Lav Lab7
Funktioner i C med ”variabelt” antal parametre • I nogen situationer er det smart, at kunne kalde en funktion med forskellige antal parametre tænk f.ek på printf, i de objekt orienterede sprog klares dette via overloadning, men det er også muligt i c, blot er det lidt mere besværlig. • I C er det muligt at definere en funktion, som vist nedenfor: • intminFunktion(…) • { • …. • Det betyder at man kan have variabelt antal input