ms_uc / fue1 / v08 4- 1 ssp programming microcontroller spp and file system 32k byte burst flash 64k...

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

Post on 22-Dec-2015




2 download

Embed Size (px)


  • Slide 1
  • MS_uC / fue1 / V08 4- 1 SSP Programming Microcontroller SPP and File system 32K Byte Burst Flash 64K or 96K Byte SRAM 256K or 512K Byte Burst Flash OTP Mem UARTI2CSPI TIMRTC EXT. Bus GPIO USB 2.0FS CAN 2.0B Enet MAC PFQ BC DMA INTR Cntl ARM966 E CORE w/DSP 96 MHz CLK Cntl ADC LVD BOD PLL JTAGETM9
  • Slide 2
  • MS_uC / fue1 / V08 4- 2 SSP Synchronous Serial Peripheral (SSP) zSSP is serial high-speed bus system yDisplay, AD- & DA converters zSSP is always used in a master-slave mode yMaster is responsible for the clock generation zSSP works in a duplex mode yMOSI & MISO EIA: Electronic Industry Alliance
  • Slide 3
  • MS_uC / fue1 / V08 4- 3 SSP SSP Hardware flow control
  • Slide 4
  • MS_uC / fue1 / V08 4- 4 SSP SSP features zMaster & Slave modes zProgrammable choice of interface operation yMotorola SPI yNational Microwire yTI synchronous serial zProgrammable data frame size from 4 to 16 bits zProgrammable bit rate and Internal clock prescaler zSeparate transmit and receive FIFO buffers y16 bits wide and 8 locations deep zSupport for DMA zIndependent masking of transmit & receive FIFO interrupts zInternal loopback test mode zDynamic change from Master Slave or Slave Master
  • Slide 5
  • MS_uC / fue1 / V08 4- 5 SSP SSP Block diagram Ref manual figure 74
  • Slide 6
  • MS_uC / fue1 / V08 4- 6 SSP SSP Pin description
  • Slide 7
  • MS_uC / fue1 / V08 4- 7 SSP SSP register map
  • Slide 8
  • MS_uC / fue1 / V08 4- 8 SSP SSP Configuration (1/3) zSSP Control Register 0 (SSP_CR0) yFrame Format bits (FRF) xSelect one of the three protocols Motorola SPI Texas Instruments SSI National Semiconductor Microwire yData Size Select bits (DSS) xSelect the data word size ySerial Clock Rate bits (SCR) xFix the transmit and receive bit rates from the SPI Master Clock yCPHA & CPOL bits xClock Phase and Polarity, applicable to Motorola SPI format
  • Slide 9
  • MS_uC / fue1 / V08 4- 9 SSP SSP Configuration (2/3) zSSP Control Register 1 (SSP_CR1) yMaster or Slave (MS) selection bit xTo configure the SSP as a master (MS = 0) or slave (MS = 1) ySSP Enable (SSE) xTo enable the SSP (SSE = 1) zSSP Presale Register (SSP_PR) y Clock Presale Register bits xFix the SPI Master Clock
  • Slide 10
  • MS_uC / fue1 / V08 4- 10 SSP SSP Configuration (3/3)
  • Slide 11
  • MS_uC / fue1 / V08 4- 11 SSP Pin connections of SSP STR91x ARM966 manual 12274.pdf, 4.1 pin functions page 36 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 Use the SD Card adapter of MCBSTR9. Which port?
  • Slide 12
  • MS_uC / fue1 / V08 4- 12 SSP File system (FS) zFS is a method for storing & organizing computer files zFS use data storage devices yHard disk, CD-ROM, SD cards yArray of fixed size blocks, called sectors (512, 1k, 2k or 4k bytes) yFile system organize these sectors into files and directories
  • Slide 13
  • MS_uC / fue1 / V08 4- 13 SSP Type of FS zDisk file system yStorage of the files on disk drive xFAT, NTFS and HFS zFlash file system yStorage of the files on flash memory devices xMMC or SD cards zNetwork file system yActs as a client for remote file access xNFS (Network File System) xAFS (Andrew File System) xSMB (Server Message Block)
  • Slide 14
  • MS_uC / fue1 / V08 4- 14 SSP Secure Digital (SD) Memory Card zSD is a non volatile memory card yDeveloped by Matsushita, ScanDisk and Toshiba zUse range of SD Cards yDigital cameras yHandheld computers yPDAs ymobile phones yGPS receivers yvideo game consoles zCapacities range from 4 MB to 2 GB
  • Slide 15
  • MS_uC / fue1 / V08 4- 15 SSP Pin assignments Pin no.SymbolDirectionDescription InOut 1CS Chip select 2DI Data in 3VSS GND 4VDD VCC 5SCLK Clock 6VSS2 GND 7DO Data out
  • Slide 16
  • MS_uC / fue1 / V08 4- 16 SSP Structure of FAT partition disc zBoot sector, yBIOS Parameter Block with some basic information about the file system yBoot loader of the operating system zFAT Region yThis region contains two copies of the File Allocation Table zRoot Directory Region. yInformation about the files and directories located in the root directory zData Region. yThis region contains the files and directories xFiles are allocated entirely in a cluster xIf a 1 KB file resides in a 32 KB cluster, 31 KB are wasted Boot sector File Allocation Table 2 Root Directory (FAT12/16 only) Data Region (for files and directories)
  • Slide 17
  • MS_uC / fue1 / V08 4- 17 SSP File Allocation Table (FAT) zA partition is divided up into identically sized clusters yCluster sizes vary between 2 KB and 32 KB. zEach file may occupy one or more of these clusters yA File is represented by a chain of these clusters (singly linked list) zFAT contains information about the clusters yEach entry records one of five things xThe cluster number of the next cluster in a chain xA special end of cluster chain (EOC) xA special entry to mark a bad cluster xA special entry to mark a reserved cluster xA zero to note that the cluster is unused
  • Slide 18
  • MS_uC / fue1 / V08 4- 18 SSP File Allocation Table (example) NumberValueMeaning Cluster 10000Empty Cluster 20003Used Cluster 30004Used Cluster 40006Used Cluster 50001Reserved Cluster 60007Used Cluster 7FFFFEOF
  • Slide 19
  • MS_uC / fue1 / V08 4- 19 SSP Directory table zA directory table is a special type of file that represents a directory yIts files or directories are represented by a 32-byte entries xName xExtension xAttributes (archive, hidden, read-only) xDate & time of creation xAddress of the first cluster xSize of the file/directory
  • Slide 20
  • MS_uC / fue1 / V08 4- 20 SSP Application Interface (API) of a FS zThe file are represented with FILE objects zThe read & write functions need a pointer to the FILE objects fopen() xFurnishes a pointer to the given FILE object zExample y#include FILE *FilePointer; FilePointer = fopen ("c:\\Text.txt", "w"); if (FilePointer == NULL) { printf ("Error, the file could not be opened !\n"); }
  • Slide 21
  • MS_uC / fue1 / V08 4- 21 SSP FILE *fopen (char filename[], char mode[]) First argument of the fopen function yFile name Second argument of the fopen function yAccess 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 update at the end of it
  • Slide 22
  • MS_uC / fue1 / V08 4- 22 SSP int fclose (FILE *stream) zWhen the file will not be used The link to the file must be close with fclose() zExample yfclose (FilePointer);
  • Slide 23
  • MS_uC / fue1 / V08 4- 23 SSP Function to read from or print into files Key board/screenFunctionFile printf("v = %d", i) Formatted output fprintf(FilePointer, "v = %d", i) scanf("%f", f) Formatted input fscanf(FilePointer, "%f", f) c = getchar() Read a character c = fgetc(FilePointer) putchar(c) Write a character fputc(c, FilePointer) gets(Buffer) Read a sentence fgets(Buffer,Maxlength,FilePointer) puts(Text) Write a sentence fputs(Text, FilePointer)