Download præsentationen
Præsentation er lastning. Vent venligst
Offentliggjort afRikke Lund Redigeret for ca. et år siden
1
Efteruddannelse Embedded C Modul 5 (Fredag den 15/1-2010) 07.01.2010
2
Modul 1 1)SPI protokollen 2)SD Card 1)Korttyper 2)Features 3)Interface 4)Opbygning og interne registre 5)Kommunikationsprotokol 3)Funktioner med variabelt antal parametre 4)Afrunding og evaluering
3
SPI kommunikation
4
Master og slave
5
Puls plan
6
SPI kontrol register i PIC
7
Kontrolregister til SPI modul i PIC
8
SD Card
9
SD Card typer SD Card mini SD micro SD SDHC mini SDHC micro SDHC SDXC
10
SDCard kapacitet og spænding TypeKapacitetSpænding SD0 – 2GB2,7 - 3,6V SDHC4GB – 32GB2,7 – 3,6V SDXC32GB – 2 TB2,7 – 3,6V
11
SDIO enheder
12
SDCARD Features •Targeted for portable and stationary applications • Memory capacity: 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)
13
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) •Card Detection (Insertion/Removal) •Application specific commands •Comfortable erase mechanism
14
SDCARD Feautures • Protocol attributes of the communication channel: • SD Memory Card Communication Channel Six-wire communication channel (clock, command, 4 data lines) Error-protected data transfer Single or Multiple block oriented data transfer • SD Memory Card 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 Memory Card).
15
Compabilitet SD vs SDHC
16
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).
17
Speed Class
18
Overordnet Blokdiagram
19
SD card Arkitektur
20
Interface
21
Pinout i SD Bus mode
22
Pinout i SPI bus mode
23
Opkobling på udviklings board
24
Interne SD card registre
25
OCR (Operating Conditions Register)
26
OCR’Struktur
27
Card Identification Register (CID)
28
Card Specific Data
29
CSD
31
SD Card Configuration Register
32
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
33
SD Bus kommunikations mode
34
SPI mode
36
Multi block read
37
SPI mode
38
Multi block write mode
39
SPI mode
40
Command tokens Sendes på den 1 bits commando linie, derfor start og stop bit. Eller
41
Format af response token 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
42
Format af commandoer
43
Formater for datapakker
44
Datapakke format
45
Card state
46
Card Indefication mode
47
Setup i SD mode
48
Data Transfer mode
49
Øvelse 1)Gennemgå funktionen MDD_SDSPI_MediaInitialize i eksemplet : USB-MSD-SPCard reader Tegn et diagram i stil med ”Setup i SD mode” der viser, hvordan kortet er sat op. 2) (extra opgave) Modificer koden i USB-MSD-SPCard reader, så data fra accerometer gemmes i en fil på kortet.
50
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: int minFunktion(…) { …. Det betyder at man kan have variabelt antal input
51
Eksempel
52
Opsummering 1)Opsummering 2)Evaluering 3)Tak for denne gang
Lignende præsentationer
© 2024 SlidePlayer.dk Inc.
All rights reserved.