slide1 n.
Skip this Video
Loading SlideShow in 5 Seconds..
Programming Microcontroller SPP and File system PowerPoint Presentation
Download Presentation
Programming Microcontroller SPP and File system

Programming Microcontroller SPP and File system

147 Views Download Presentation
Download Presentation

Programming Microcontroller SPP and File system

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Programming Microcontroller SPP and File system 64K or 96K Byte SRAM Enet MAC ARM966E CORE w/DSP USB 2.0FS 96 MHz 256K or 512K Byte Burst Flash PFQ BC CAN 2.0B DMA INTR Cntl CLK Cntl 32K Byte Burst Flash GPIO OTP Mem LVD BOD EXT. Bus JTAG ETM9 PLL RTC TIM ADC SPI I2C UART SSP

  2. SSP is serial high-speed bus system Display, AD- & DA converters SSP is always used in a master-slave mode Master is responsible for the clock generation SSP works in a duplex mode MOSI & MISO Synchronous Serial Peripheral (SSP) SSP EIA: Electronic Industry Alliance

  3. SSP Hardware flow control SSP

  4. Master & Slave modes Programmable choice of interface operation Motorola SPI National Microwire TI synchronous serial Programmable data frame size from 4 to 16 bits Programmable bit rate and Internal clock prescaler Separate transmit and receive FIFO buffers 16 bits wide and 8 locations deep Support for DMA Independent masking of transmit & receive FIFO interrupts Internal loopback test mode Dynamic change from “Master  Slave” or “Slave  Master” SSP features SSP

  5. SSP Block diagram SSP Ref manual figure 74

  6. SSP Pin description SSP

  7. SSP register map SSP

  8. SSP Control Register 0 (SSP_CR0) Frame Format bits (FRF) Select one of the three protocols Motorola SPI Texas Instruments SSI National Semiconductor Microwire Data Size Select bits (DSS) Select the data word size Serial Clock Rate bits (SCR) Fix the transmit and receive bit rates from the SPI Master Clock CPHA & CPOL bits Clock Phase and Polarity, applicable to Motorola SPI format SSP Configuration (1/3) SSP

  9. SSP Control Register 1 (SSP_CR1) Master or Slave (MS) selection bit To configure the SSP as a master (MS = 0) or slave (MS = 1) SSP Enable (SSE) To enable the SSP (SSE = 1) SSP Presale Register (SSP_PR) Clock Presale Register bits Fix the SPI Master Clock SSP Configuration (2/3) SSP

  10. SSP Configuration (3/3) SSP

  11. Pin connections of SSP SSP  Use the SD Card adapter of MCBSTR9. Which port? P5.4 UART0_SCLK Alternate Output 2 P5.5 UART0_MOSI Alternate Output 2 P5.6 UART0_MISO Alternate Input 1 P5.7 GPIO_5.7 Alternate Output 1 STR91x ARM966 manual 12274.pdf, 4.1 pin functions page 36

  12. FS is a method for storing & organizing computer files FS use data storage devices Hard disk, CD-ROM, SD cards … Array of fixed size blocks, called sectors (512, 1k, 2k or 4k bytes) File system organize these sectors into files and directories File system (FS) SSP

  13. Disk file system Storage of the files on disk drive FAT, NTFS and HFS Flash file system Storage of the files on flash memory devices MMC or SD cards Network file system Acts as a client for remote file access NFS (Network File System) AFS (Andrew File System) SMB (Server Message Block) Type of FS SSP

  14. SD is a non volatile memory card Developed by Matsushita, ScanDisk and Toshiba Use range of SD Cards Digital cameras Handheld computers PDAs mobile phones GPS receivers video game consoles Capacities range from 4 MB to 2 GB Secure Digital (SD) Memory Card SSP

  15. Pin assignments SSP

  16. Structure of FAT partition disc SSP • Boot sector, • BIOS Parameter Blockwith some basic information about the file system • Boot loader of the operating system • FAT Region • This region contains two copies of the File Allocation Table • Root Directory Region. • Information about the files and directories located in the root directory • Data Region. • This region contains the files and directories • Files are allocated entirely in a cluster • If a 1 KB file resides in a 32 KB cluster, 31 KB are wasted

  17. A partition is divided up into identically sized clusters Cluster sizes vary between 2 KB and 32 KB. Each file may occupy one or more of these clusters A File is represented by a chain of these clusters (singly linked list) FAT contains information about the clusters Each entry records one of five things The cluster number of the next cluster in a chain A special end of cluster chain (EOC) A special entry to mark a bad cluster A special entry to mark a reserved cluster A zero to note that the cluster is unused File Allocation Table (FAT) SSP

  18. File Allocation Table (example) SSP

  19. A directory table is a special type of file that represents a directory Its files or directories are represented by a 32-byte entries Name Extension Attributes (archive, hidden, read-only) Date & time of creation Address of the first cluster Size of the file/directory Directory table SSP

  20. The file are represented with FILE objects The read & write functions need a pointer to the FILE objects fopen() Furnishes a pointer to the given FILE object Example #include<stdio.h> FILE *FilePointer; FilePointer = fopen ("c:\\Text.txt", "w"); if (FilePointer == NULL) { printf ("Error, the file could not be opened!\n"); } Application Interface (API) of a FS SSP

  21. First argument of the fopen function File name Second argument of the fopenfunction Access type "r"Open the file for read "w"Create the file for write "a"Create or open the file for write at the end of it "r+"Open the file for update(read and write) "w+"Create the file for update "a+"Create or open the file for updateat the end of it FILE *fopen (char filename[], char mode[]) SSP

  22. When the file will not be used The link to the file must be close with fclose() Example fclose (FilePointer); int fclose (FILE *stream) SSP

  23. Function to read from or print into files SSP