1 / 52

Efteruddannelse Embedded C

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.

Download Presentation

Efteruddannelse Embedded C

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EfteruddannelseEmbedded C Modul 5 (Fredag den 23/4-2010) 07.01.2010

  2. Modul 1 • SPI protokollen • SD Card • Korttyper • Features • Interface • Opbygning og interne registre • Kommunikationsprotokol • Funktioner med variabelt antal parametre • 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

  11. SDIO enheder

  12. 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)

  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) • CardDetection (Insertion/Removal) • Applicationspecificcommands • Comfortableerasemechanism

  14. 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

  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. CardIdentification Register (CID)

  28. CardSpecific Data

  29. CSD

  30. CSD

  31. SD CardConfiguration 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

  35. SPI mode

  36. Multiblockread

  37. SPI mode

  38. Multiblockwrite mode

  39. SPI mode

  40. Sendes på den 1 bits commandolinie, derfor start og stop bit. Commandtokens Eller

  41. 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

  42. Format af commandoer

  43. Formater for datapakker

  44. Datapakke format

  45. Cardstate

  46. CardIndefication mode

  47. Setup i SD mode

  48. Data Transfer mode

  49. Øvelse • Lav Lab7

  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: • intminFunktion(…) • { • …. • Det betyder at man kan have variabelt antal input

More Related