160 likes | 524 Views
USB 2.0 to SD-Card File transfer Using NIOS II and DE-3. USB to SD Project. By: Nadav Haklai & Noam Rabinovici Supervisors: Mike Sumszyk & Roni Lavi Semester: Spring 2010. Background. USB 2.0- Standard for peripheral devices The USB mass storage device class
E N D
USB 2.0 to SD-Card File transfer Using NIOS II and DE-3 USB to SD Project By: Nadav Haklai & Noam Rabinovici Supervisors: Mike Sumszyk & RoniLavi Semester: Spring 2010
Background • USB 2.0- Standard for peripheral devices • The USB mass storage device class • ISP1761 - single-chip Hi-Speed Universal Serial Bus (USB) On-The-Go (OTG) Controller • SD-Card - Non-Volatile memory card format • Very popular and common (Cameras, Embedded Systems) • Fat - File System
Project Goal • Create a stand alone bridge between the USB and SD-Card interfaces • Transfer files easily between the devices. • No computer is needed. • Hardware - ALTERA Stratix III FPGA and SOPC Core
Development Tools • Software: • Quartus II 9.1 SP1 • SOPC Builder • NIOS II IDE 9.1 • Hardware: • Altera DE3 Board • Stratix III FPGA • Soft NIOS II Core • USB Controller - ISP1761
Design Flow • Study system devices and technologies in depth • Analyze System Requirements • Create Soft NIOS Core in SOPC Builder • Develop HW environment • Develop SW using NIOS II IDE • SD Card Driver • FAT File System • USB Driver • Debug & Improvements
Step 3: Create Soft NIOS Core • Specify target FPGA and clock settings • Adding peripherals: • NIOS II core • On-chip memory • USB ISP 1761 core • SD-Card Core • Generating system SD-Card Socket
Step 4: Develop HW environment • Use DE3 System Builder to generate project • Pin assignments and board configuration • Integrate SOPC Builder into Quartus II project • Integrate custom HW modules • Set design constrains: • Timing requirements • Compiling HW design for DE3 board • Analysis & Synthesis • Place & Route
Step 5: Develop SW environment - Ready • USB SW design Layers: - Not Ready Program - Examples Code - Ready FAT File System • SD-CardSW design Layers: USB mass storage device Driver USB Protocol Program USB HOST Controller FAT File System ISP 1761 HAL SD-Card Driver NIOS II PIO NIOS II PIO
Step 5: Develop SW environment • DE3 Design examples: • The DE3 offers USB Host and SD-Card code examples • The interfaces examples support read-only mode from the USB or SD devices • The examples are not documented and messy. • SW Development • The examples were used as a starting point. • USB and SD drivers are modified to add write support. • FAT File system was implemented to allow the work with files on the SD-Card and the USB mass storage device. • Design the high program layer
Step 5: FAT File System • FAT Fundamentals: • Sectors and Clusters • LBA and MBR • Mount and Initialization • Logical vs. Physical Drives • File Locations – Cluster Chains • Implementation – Open Source File System • SD-Card • USB – Mass Storage Device
Step 5: SD-Card Driver • SD-Card Protocol • SD Mode (1 or 4bits) vs. SPI Mode • Bus Protocol basic operation: • Data Packet Format • Command Packet Format
Step 5: USB Mass Storage Class • UFI Commands • Based on SCSI Commands • Learn examples commands implementations • Write Command: • Interface between USB Protocol and File System
Step 6: Debug • Debug: • Download SW to NIOS II System on DE3 Board • Run / Debug SW on DE3 • Refine SW & HW