`information with PCs and
`other USB hosts
`
`Read and write files in flash
`memory and other media
`
`Create embedded hosts that
`access USB storage devices
`
`Micron Ex. 1018, p. 1
`Micron v. Vervain
`IPR2021-01549
`
`
`
`USB Mass Storage
`
`Designing and Programming
`Devices and Embedded Hosts
`
`Jan Axelson
`
`Lakeview Research LLC
`Madison, WI
`
`Micron Ex. 1018, p. 2
`Micron v. Vervain
`IPR2021-01549
`
`
`
`USB Mass Storage: Designing and Programming Devices and Embedded Hosts
`by Jan Axelson
`
`Copyright 2006, 2016 by Janet L. Axelson
`
`All rights reserved. No part of the contents of this book, except the program code, may be
`reproduced or transmitted in any form or by any means without the written permission of
`the publisher. The program code may be stored and executed in a computer system and may
`be incorporated into computer programs developed by the reader.
`
`The information, computer programs, schematic diagrams, documentation, and other
`material in this book are provided "as is," without warranty of any kind, expressed or
`implied, including without limitation any warranty concerning the accuracy, adequacy, or
`completeness of the material or the results obtained from using the material. Neither the
`publisher nor the author shall be responsible for any claims attributable to errors, omissions,
`or other inaccuracies in the material in this book. In no event shall the publisher or author
`be liable for direct, indirect, special, incidental, or consequential damages in connection
`with, or arising out of, the construction, performance, or other use of the materials con(cid:173)
`tained herein.
`
`Many of the products and company names mentioned herein are the trademarks of their
`respective holders. MPLAB, PICDEM, PICmicro, and PICtail are registered trademarks of
`Microchip Technology Inc. in the U.S.A. and other countries.
`
`Certain materials contained herein are reprinted with the permission of Microchip Technol(cid:173)
`ogy Incorporated. No further reprints or reproductions may be made of said materials with(cid:173)
`out Microchip Technology Inc.'s prior written consent.
`
`Published by Lakeview Research LLC, 5310 Chinook Ln., Madison WI 53704
`
`janaxelson.com
`
`Distributed by Independent I>ublishers Group (ipgbook.com).
`
`14 13 12 11 10 9 8 7 6 5
`
`Printed and bound in the United States of America
`
`ISBN 978-1-931448-04-8 (paper)
`ISBN 978-1-931448-23-9 (epub)
`ISBN 978-1-931448-19-2 (Kindle)
`ISBN 978-1-931448-05-5 (pdf)
`
`Micron Ex. 1018, p. 3
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Contents
`
`Acknowledgements xi
`Introduction xiii
`
`1 Mass Storage Basics 1
`When to Use a Storage Device 1
`Benefits 2
`Other Considerations 3
`Requirements 4
`Devices 4
`Embedded Hosts 5
`Selecting a Media Type 7
`Drive Mechanisms 8
`Addressing Methods 1 0
`Reading and Writing Considerations 1 0
`Removable Media and Devices 12
`Hardware Interfaces 12
`Hard Drives 13
`Technology 13
`Interfaces 13
`Flash Memory 13
`Technology 14
`Options for Flash Memory 15
`MultiMediaCard 16
`SD Memory Card 20
`CompactFiash 22
`
`Ill
`
`Micron Ex. 1018, p. 4
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Contents
`
`2 Supporting USB 25
`The Interface in Brief 26
`Hosts and Devices 26
`Host Responsibilities 27
`Device Responsibilities 29
`Bus Speeds 31
`Endpoints 31
`Transfer Types 32
`Transactions 32
`The Data Toggle 33
`Descriptors 34
`Mass Storage Requirements 34
`Choosing a Device Controller 37
`Controllers with Support for Flash Memory 37
`Controllers with support for ATNATAPI 38
`Firmware Options 38
`Microchip PIC18F4550 39
`Architecture 39
`Firmware Support 39
`The USB Controller 39
`
`3 The USB Mass Storage Class 45
`Requirements 45
`Specifications 45
`Logical Block Addressing 46
`Mass Storage Requests 46
`Descriptors 46
`Device Descriptor 47
`Configuration Descriptor 49
`Interface Descriptor 51
`Endpoint Descriptors 53
`String Descriptors 54
`
`IV
`
`Micron Ex. 1018, p. 5
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Responding to Commands 55
`The Command Block Wrapper 56
`The Command Status Wrapper 60
`Managing Communications on the Bulk Endpoints 62
`More about STALL 72
`Thirteen Cases for Any Situation 73
`PC Support 76
`Windows 76
`Linux 77
`
`4 Accessing Flash Memory Cards 79
`The Interface 79
`Signals and Power 80
`Example Circuit 80
`Host Programming 83
`Configuring 83
`Hardware Ports 85
`Firmware-controlled Ports 86
`Transferring Data 86
`Default States 86
`SPI on the PIC18F4550 86
`Configuring the Port 88
`Writing a Byte 89
`Reading a Byte 91
`
`5 MultiMediaCard Protocol 93
`Command and Response Formats 93
`Commands 94
`Response Types 94
`Token Formats 98
`The Commands 99
`Classes 99
`Commands Used by Mass-storage Devices 1 00
`Registers 101
`
`Contents
`
`v
`
`Micron Ex. 1018, p. 6
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Contents
`
`Sending Commands 1 01
`Timing Considerations 1 02
`Commands with No Data Transfer 1 05
`Commands that Read Data from the Storage Media 1 05
`Commands that Write Data to the Storage Media 1 06
`Application Example 1 07
`Detecting and Selecting a Card 1 07
`Sending a Command 1 09
`Reading a Sector 118
`Writing a Sector 120
`Initializing Communications 123
`
`6 SCSI Commands 131
`About the Commands 131
`Specifications 131
`Which Commands to Implement? 132
`Sense Data 135
`Fixed-format Sense Data 137
`Setting Default Values 138
`Primary Commands 139
`INQUIRY 139
`MODE SELECT 143
`MODE SENSE 143
`PREVENT ALLOW MEDIUM REMOVAL 145
`REPORT LUNS 146
`REQUEST SENSE 146
`SEND DIAGNOSTIC 147
`TEST UNIT READY 147
`
`vi
`
`Micron Ex. 1018, p. 7
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Block Commands 148
`FORMAT UNIT 148
`READ 149
`READ CAPACITY 152
`START STOP UNIT 154
`SYNCHRONIZE CACHE 154
`VERIFY 155
`WRITE 155
`Multimedia Commands 159
`READ FORMAT CAPACITIES 159
`READ TOC/PMA/ATIP 159
`Handling Commands and Events 160
`Decoding Commands 160
`The UNIT ATTENTION Condition 161
`Informing the Host about Media Changes 162
`Reset Behavior 163
`
`7 Media Structure 165
`A Look Inside 165
`Components of Formatted Media 166
`Drives without an MBR Sector 168
`Byte Order 168
`The Master Boot Record Sector 168
`Executable Code 169
`The Partition Table 169
`Extended Partitions 170
`The Boot Signature 172
`
`8 FAT File Systems 175
`Inside a FAT16 Volume 175
`Reserved Region 176
`File Allocation Table Region 179
`Root Directory Region 180
`File and Directory Data Region 180
`
`Contents
`
`vii
`
`Micron Ex. 1018, p. 8
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Contents
`
`Inside a FAT32 Volume 181
`Reserved Region 181
`File Allocation Table Region 184
`File and Directory Data Region 185
`Selecting a File System 185
`Cluster Sizes 185
`A Hardware Solution 186
`The File Allocation Table 188
`The First Two Entries 188
`Data Clusters 188
`Accessing the FAT 190
`Volume Information 190
`File Information 191
`Obtaining a Cluster's Logical Block Address 192
`Reading from the FAT 192
`Writing to the FAT 194
`Finding a File's Next Cluster 195
`Performing Sequential Reads 197
`Finding an Empty Cluster 198
`
`9 Directories 201
`The Contents of an Entry 201
`File Entries 202
`Directory Entries 205
`The Volume Label Entry 206
`Subdirectory Entries 207
`Handling Long File Names 207
`LFN Entries 207
`The Checksum 209
`Creating a Short File Name 21 0
`
`VIII
`
`Micron Ex. 1018, p. 9
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Using Directories 211
`Storing an Entry 211
`Reading an Entry 212
`Getting the Main Entry 217
`Updating an Entry 219
`Updating the Time and Date 220
`
`1 0 File Operations 223
`Cluster Operations 224
`Erasing a Cluster 224
`Reserving an Available Cluster 225
`Allocating a File's First Cluster 226
`Allocating Additional Clusters 226
`Managing Files 228
`Obtaining File Information 228
`Finding a File 231
`Creating a Directory Entry 234
`Finding an Available Entry 235
`Creating a File 238
`Deleting a File 239
`Opening a File 243
`Reading from a File 246
`Tasks 246
`Performing a Read Operation 247
`Writing to a File 250
`Tasks 250
`Performing a Write Operation 251
`Closing a File 257
`
`Contents
`
`ix
`
`Micron Ex. 1018, p. 10
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Contents
`
`11 Embedded Hosts 259
`Inside an Embedded Host 259
`OTG Devices and Conventional Hosts 260
`General Host Functions 260
`Mass Storage Functions 261
`Handling Non-compliant Devices 263
`Host Options 266
`Cypress EZ-HOST 266
`Host Software 267
`A Mass-storage Host Module 267
`Index 271
`
`X
`
`Micron Ex. 1018, p. 11
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Introduction
`
`A mass-storage device can provide access to data for just about any purpose.
`Every time you load an application or save a file on a PC, you're using a
`mass-storage device. A computer's hard drive is a mass-storage device, as are
`flash, CD, and DVD drives. Devices with dedicated functions-data log(cid:173)
`gers, robots, and other embedded systems-can use mass storage as well.
`Every mass-storage device contains a microcontroller, microprocessor, or
`other intelligent hardware that knows how to access the contents of the stor(cid:173)
`age media.
`
`A USB device controller enables a mass-storage device to share its data with
`other computers. For example, a data logger can collect data in the field and
`then connect to a PC, where an application reads the data from the logger's
`storage media. Or a robot can attach to a PC to receive a file containing con(cid:173)
`figuration data to use in robotic tasks.
`
`Flash-memory cards provide convenient storage for many small systems.
`Other systems function as USB hosts that can access files in off-the-shelf
`USB flash drives and hard drives.
`
`xiii
`
`Micron Ex. 1018, p. 12
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Introduction
`
`If you're involved with designing or programming devices that incorporate a
`USB mass-storage device or host interface, this book will help you get your
`projects up and running. You'll also find the book useful if you're designing
`or programming devices that use flash-memory cards for data storage,
`whether or not the devices have USB interfaces.
`
`Interfaces, Protocols, and Technologies
`Designing and programming a USB mass-storage device or embedded USB
`host involves a variety of interfaces, protocols, and structures.
`Every USB mass-storage device must support two interfaces:
`• A USB device interface to enable the device to communicate with a PC
`or other USB host.
`• An interface between the device's microcontroller or other CPU and the
`storage media. Flash-memory cards typically use the Serial Peripheral
`Interface (SPI), MultiMediaCard bus, SO-Card bus, or a bus derived
`from the ATA interface or PC-Card bus. Hard drives typically use the
`ATA parallel interface.
`A USB mass-storage device must implement these protocols and structures:
`• Generic USB protocol. Every USB device must respond to requests sent
`by the USB host and other events on the bus.
`• USB mass-storage protocol. Every USB mass-storage device must detect
`and respond to requests that are specific to the USB mass-storage class.
`• SCSI commands. USB hosts access mass-storage devices via commands
`originally developed for devices that use :the Small Computer Systems
`Interface (SCSI).
`• Media-speciftc protocol. The storage media's controller typically supports
`a command set for accessing the media's contents. Many flash-memory
`cards use the MultiMediaCard protocol or the SD Card protocol. Hard
`drives use the ATA protocol.
`Reading and writing data to a mass-storage device also involves understand(cid:173)
`ing logical structures in the media:
`• Media structure. Program code accesses the storage area in drives as a
`series of logical blocks, or sectors. Dedicated areas in the media store
`
`xiv
`
`Micron Ex. 1018, p. 13
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Introduction
`
`information about the logical blocks and other logical structures in the
`media.
`• File system. If the device firmware reads or writes to files on its own,
`rather than via a USB host, the device must implement a file system such
`as FAT16 or FAT32.
`
`This book shows how to put all of these interfaces, protocols, and structures
`to work in a USB mass-storage device. The book assumes you have a basic
`familiarity with microcontroller programming and interfacing. For more
`about USB, I recommend my book, USB Complete: Everything You Need to
`Develop Custom USB Peripherals.
`
`About the Code
`This book include code examples written for the Microchip PIC18F4550
`microcontroller using Microchip's MPLAB® C18 C compiler. On my web(cid:173)
`site (janaxelson.com) you can find links to complete mass-storage firmware
`for this chip and example mass-storage firmware for other microcontrollers.
`
`For More Information
`In addition to example code, janaxelson.com has links to specification docu(cid:173)
`ments, white papers, corrections and additions to this book, and other infor(cid:173)
`mation to help you design and program USB mass-storage devices.
`
`I hope you find the book useful!
`
`Jan Axelson
`jan@janaxelson.com
`
`XV
`
`Micron Ex. 1018, p. 14
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Introduction
`
`xvi
`
`Micron Ex. 1018, p. 15
`Micron v. Vervain
`IPR2021-01549
`
`
`
`1
`
`Mass Storage Basics
`
`A mass-storage device is electronic hardware that stores information and
`supports a protocol for sending and retrieving the information over a hard(cid:173)
`ware interface. The information can be anything that can be stored electron(cid:173)
`ically: executable programs, source code, documents, images, spreadsheet
`numbers, database entries, data logger output, configuration data, or other
`text or numeric data. Mass-storage devices typically store information in
`files. A file system defines how the files are organized in the storage media.
`
`In Windows computers, mass-storage devices appear as drives in My Com(cid:173)
`puter. From Windows Explorer, users can copy, move, and delete files in the
`devices.· Program code can access files using file-system APis or .NET's File
`class.
`
`When to Use a Storage Device
`
`Implementing a mass-storage function is a solution for systems that need to
`read or write moderate to large amounts of data.
`
`1
`
`Micron Ex. 1018, p. 16
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Chapter 1
`
`If the device has a Universal Serial Bus (USB) interface, any PC or other
`USB host can access the storage media. Generic USB mass-storage devices
`include the hard drives, flash drives, CD drives, and DVD drives available
`from any computer-hardware store. Table 1-1 lists popular device types.
`These devices have just one function: to provide storage space for the sys(cid:173)
`tems they connect to.
`Another type of USB mass-storage device (or storage device for short) is the
`special-purpose device with storage capabilities. For example, a camera can
`capture images and store the images in files. A data logger can collect and
`store sensor readings in files. A robotic device can receive files containing
`configuration parameters. With the addition of a USB mass-storage inter(cid:173)
`face, any of these devices can use USB to exchange files with PCs and other
`USB hosts.
`Generic storage devices are readily available and inexpensive. Unless you're
`employed by a storage-device manufacturer, there isn't much point in
`designing and programming your own generic devices. But special-purpose
`USB storage devices are useful in many embedded systems, including
`one-of-a-kind projects and products manufactured in small quantities.
`Another option for some systems is to add USB host-controller hardware
`and mass-storage firmware. The embedded system can then store and read
`files in off-the-shelf USB storage devices.
`
`Benefits
`Adding storage-device capabilities to a system has several benefits:
`• With a USB device controlle1·, a system can make the coments of its stor-(cid:173)
`age media available to any PC or other USB host computer.
`• File systems provide a standard way to store and access data. A PC or
`other USB host can format the media in a USB storage device to use the
`FAT16 or FAT32 file system. When the device is connected to a PC, the
`operating system enables reading and writing to files. User.s can access the
`files without having to install and learn a vendor-specific application.
`• Storage media is readily available. Flash-memory cards are convenient
`and have enough capacity for many applications. Some cards require only
`a few port pins to access. Devices that need large amounts of storage can
`interface to hard drives.
`
`2
`
`Micron Ex. 1018, p. 17
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Mass Storage Basics
`
`Table 1-1: Common USB mass storage devices use a variety of storage media.
`Local CPU Interface Removable Media?
`Storage Media
`Device
`to Media
`ATA
`No
`Yes
`ATA+ATAPI
`Yes
`ATA+ATAPI
`Local CPU data bus No
`Yes
`SPI,
`MultiMediaCard bus,
`SD-Card bus
`
`Hard drive
`CD drive
`DVD drive
`Flash drive
`Flash-memory-card
`reader/writer
`
`Hard disk
`CD
`DVD
`Flash memory
`Flash memory
`
`Other Considerations
`A storage device isn't the solution for every application, however.
`• Mass-storage firmware is complex. A USB mass-storage device must sup(cid:173)
`port the USB protocols required for all USB devices as well as class-spe(cid:173)
`cific mass-storage protocols. If the device firmware needs to create, read,
`or write to files and directories on its own (not via the USB interface),
`the firmware must also support a file system. For some applications, a
`different USB class or a vendor-specific protocol would require less time
`and expense to implement.
`• USB mass-storage devices transfer data using bulk transfers. These pro(cid:173)
`vide the fastest transfers on an otherwise idle bus but have no guaranteed
`timing or bus bandwidth. If your device needs precise timing in transfer(cid:173)
`ring data, the mass-storage class isn't appropriate.
`• A storage device should have one mass-storage master at a time. The mas(cid:173)
`ter, or mass-storage host, is the computer that reads and writes to the
`storage media. Special-purpose mass-storage devices can function as mas(cid:173)
`ters on their own and can also permit a PC or other USB host to func(cid:173)
`tion as the master. If one master adds, deletes, or changes a file and the
`other master isn't aware of the changes, confusion or worse problems can
`result. Devices that support two masters can have a manual or electronic
`switch to enable one master at a time, or a device can use firmware proto(cid:173)
`cols to inform the host when the media's contents have changed. For
`some designs, another approach without this added complexity makes
`more sense.
`
`3
`
`Micron Ex. 1018, p. 18
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Chapter 1
`
`STORAGE
`IVE:DIA
`
`IVE:DIA
`CONTROLLER
`
`DEVICE CPU OR
`MICROCONTROLLER
`
`USB DEVICE
`CONTROLLER
`
`' USB
`
`/
`
`USB HOST
`CCM>UTER
`
`STORAGE
`IVE:DIA
`
`IVE:DIA
`CONTROLLER
`
`MICROCONTROLLER
`WITH EMBEDDED
`USB DEVICE
`CONTROLLER
`
`USB HOST
`CCM>UTER
`
`USB
`
`Figure 1-1 : A USB mass-storage device contains storage media, a media
`controller, a device CPU or microcontroller, and a USB device controller, which
`can be on a separate chip or embedded in a microcontroller.
`
`Alternate approaches for USB devices that transfer generic or vendor-spe(cid:173)
`cific data include the human-interface device class, a device accessed via a
`virtual COM port, or a generic or vendor-specific driver.
`
`Requirements
`Adding storage capabilities and a USB interface to an embedded system
`requires hardware and firmware to support accessing the storage media and
`communicating over the USB interface.
`
`Devices
`An embedded system that functions as a USB mass-storage device requires
`the following hardware (Figure 1-1):
`
`• A microcontroller or other CPU or intelligent hardware to manage the
`embedded system's operation.
`• A USB device controller, which can be embedded in a microcontroller
`chip or on a separate chip that interfaces to a CPU or micro(.nntroller.
`• A generic hard drive, flash drive, or other media that interfaces to the
`device's CPU.
`
`4
`
`Micron Ex. 1018, p. 19
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Mass Storage Basics
`
`In a USB mass-storage device, the hardware or firmware must perform the
`following functions:
`• Detect and respond to generic USB requests and other events on the bus.
`• Detect and respond to USB mass-storage requests for information or
`actions from the device.
`• Detect and respond to SCSI commands received in USB transfers. These
`industry-standard commands read and write blocks of data in the storage
`media, request status information, and control device operation.
`In addition, devices that create, read, or write to files and directories on their
`own (not via a USB host) must implement a file system. A file is a named
`collection of data. A directory structure provides an index to the files. Popu(cid:173)
`lar file systems for embedded systems include FAT16 and FAT32.
`Two popular types of storage media for embedded systems are flash-memory
`cards and hard drives. A flash-memory card contains flash-memory chips to
`provide storage, a controller that manages reading and writing to the mem(cid:173)
`ory, and an interface to the outside world. Common types of flash-memory
`cards includes the MultimediaCard (MMC), Secure Digital (SO) Card, and
`CompactFlash® (CF®) card. A hard drive contains a hard disk that provides
`storage, drive components to perform functions such as spinning the disk
`and positioning the heads, a drive controller, and an interface to the outside
`world. An embedded system that accesses flash-memory cards or hard drives
`must have a microcontroller or other CPU or intelligent hardware to man(cid:173)
`age communications with the cards or drives.
`This book focuses on block storage devices, where data is transferred in
`blocks of defined sizes. USB hard drives and flash drives are block storage
`devices. Other devices are stream devices, where each data transfer is a
`sequence, or stream, of data that can be any length. An example of a stream
`device is a modem that carries voice communications.
`
`Embedded Hosts
`An embedded system that functions as a USB host for flash or hard drives
`requires the following hardware (Figure 1-2):
`• A microcontroller or other CPU or intelligent hardware to manage the
`embedded system's operation.
`
`5
`
`Micron Ex. 1018, p. 20
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Chapter 1
`
`GENERIC
`USB
`MASS STORAGE
`DEVICE
`
`USB
`
`USB HOST
`CONTROLLER
`
`HOST CPU OR
`MICROCONTROLLER
`
`GENERIC
`USB
`MASS STORAGE
`DEVICE
`
`HOST CPU OR
`MICROCONTROLLER
`WITH EMBEDDED
`USB HOST CONTROLLER
`
`USB
`
`Figure 1-2: To access generic USB mass-storage devices, an embedded
`system must contain a USB host controller, which can be on a separate chip or
`embedded in a microcontroller.
`
`• A USB host controller, which can be embedded in a microcontroller chip
`or on a separate chip that interfaces to the CPU, microcontroller, or
`other intelligent hardware.
`• A generic hard drive, flash drive, or other media connected to a USB port
`on the host.
`
`The hardware or firmware in an embedded USB mass-storage hosr must
`provide the following functions:
`
`•
`
`•
`
`•
`
`Issue USB requests and initiate other CV(~nts on the bus to identifY
`attached devices and manage traffic and power on the bus.
`Issue USB mass-storage requests that ask for status information or specifY
`actions for the device to perform.
`Issue SCSI commands in USB transfers. 'Ine commands re'ad and write
`blocks of data in the storage media, request status information, and con-·
`trol the device operation.
`• Support a file system to access files in the media.
`
`6
`
`Micron Ex. 1018, p. 21
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Mass Storage Basics
`
`Figure 1-3: USB flash drives provide convenient storage that PCs and other
`USB hosts can access.
`
`Selecting a Media Type
`
`The storage media is the physical entity that holds a device's data. In embed(cid:173)
`ded systems, a storage device's media is typically separate from the system's
`program memory, which stores the code executed by the system's CPU.
`Over time, various storage technologies and form factors have come and
`gone in popularity. Currently popular technologies include hard drives,
`CD/DVD drives, flash-memory cards, and USB flash drives (Figure 1-3).
`Other names for a USB flash drive (UFD) include USB key, pen drive,
`ThumbDrive®, DiskOnKey®, and JumpDrive®.
`
`The different media types vary in the hardware and circuits required to
`access the media, the ability to erase and rewrite, methods of write protec(cid:173)
`tion, whether the media is removable from its drive, and interface options
`for external CPUs.
`For many devices, flash memory is a good choice for storage media.
`Flash-memory cards are physically small, can store moderate amounts of
`
`7
`
`Micron Ex. 1018, p. 22
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Chapter 1
`
`data, and manage the low-level protocols for accessing the memory. Some
`cards require only a few port pins to access. With the addition of a USB
`device controller and supporting firmware, USB hosts can access the data in
`a device's flash-memory card. Users can also remove a card from the device
`and insert the card in a card reader attached to a PC or other computer.
`Flash memory consumes less power than other media types. When attached
`to a USB host or hub, a typical flash-memory storage device can receive all
`of its power from the bus.
`
`Hard drives are the cheapest per byte and can hold massive quantities of
`data. CD and DVD drives are less common in embedded systems because
`embedded applications tend to require media that is easily erased and rewrit(cid:173)
`ten. CD-RW, DVD-RW, and DVD+RW discs can be erased and rewritten,
`but not as easily as magnetic media.
`
`A device that contains a USB host controller and supporting firmware can
`access ordinary USB flash drives and hard drives. Because a USB host must
`manage the bus, USB host programming is more complex than USB device
`programming. But for some applications, the ability to store data in generic
`drives makes the increased complexity worthwhile.
`
`Drive Mechanisms
`Hard disks require a drive mechanism to spin the disks and position the read
`and write heads (Figure 1-4). A hard drive contains a stack of platters. Each
`platter has magnetic storage media arranged in concentric circles, called
`tracks, on both sides. Each surface of a planer has a head positioned above
`the platter's surface. The head can .read o.r write to the bit of data directly
`opposite the head.
`An area on a drive can be identified by cylinder, head, and sector. A cylinder
`is a stack of tracks of the same diameter. Each surface has a head, so the head
`identifies a surface on a platter. A sector is a portion of a track and contains
`the smallest addressable quantity of data in the media. All sectors in a drive
`have the same capacity, typically 512 bytes.
`The drive mechanism spins the disks and moves the heads to requested
`tracks. When a requested sector on a spinning disk passes under the head,
`
`8
`
`Micron Ex. 1018, p. 23
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Mass Storage Basics
`
`READ/V\RITE
`HEAD
`
`PLATTER (ONE SIDE)
`
`SECTORS
`
`CYLINDER
`
`Figure 1-4: A hard drive contains multiple platters. Each side on a platter has
`circular tracks containing magnetic media and a read/write head. A cylinder
`consists of all of the tracks with the same diameter on all of the platters.
`
`the head performs the read or write operation on the media. The head reads
`and writes a minimum of a sector's data in each read or write operation.
`
`Flash memory resides in chips. Accessing flash memory requires no moving
`parts. USB storage devices with flash memory don't have mechanical drives,
`but the term flash drive for these devices has stuck.
`
`9
`
`Micron Ex. 1018, p. 24
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Chapter 1
`
`Addressing Methods
`All USB drives and other drives of recent vintage support logical block
`addressing (LBA). With LBA, blocks of storage capability are numbered
`sequentially beginning at zero. All blocks have the same size, again typically
`512 bytes. The logical block address is often referred to as a sector address
`because the block size equals the capacity of a sector in a hard drive. To
`access the media, software specifies the logical block address to read or write
`to. For hard drives, the drive's controller translates each LBA to a cylinder,
`head, and sector on the drive. For flash drives, the drive's controller trans(cid:173)
`lates each LBA to a block, page, and column in the memory array. The
`sequence of logical block addresses doesn't have to correspond to the physi(cid:173)
`cal locations of the sectors in a drive or the memory in a chip. All that mat(cid:173)
`ters is that the media's controller knows what area of storage corresponds to
`each address.
`In older systems, software accessed storage media using CHS addressing,
`where the software specifies a cylinder, head, and sector number to read or
`write to. A storage device can support both CHS addressing and LBA.
`Compared to CHS addressing, LBA is simpler, more flexible, and supports
`larger capacities. File-system drivers in embedded systems are unlikely to
`need to use CHS addressing.
`
`Reading and Writing Considerations
`Storage media varies in the available methods of write-protecting the con(cid:173)
`tents, support for erasing, and copy-protection technologies.
`
`Write Protection
`The storage media, drive mechanism, circuits, or a manual switch can per(cid:173)
`mit or forbid writing to the media. For example, a flash-memory controller
`can forbid writing to all or a portion of the memory. Or a manual switch on
`a flash-memory card can inform the host that the media shouldn't be erased
`or overwritten. Higher-level software in the mass--storage master can also
`control access to data on a storage device.
`
`10
`
`Micron Ex. 1018, p. 25
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Mass Storage Basics
`
`Erasing
`The media in a hard drive can be erased and rewritten virtually endlessly,
`while flash memory can survive 10,000 or more erase cycles, depending on
`the technology. Some memory cards contain programmed ROM chips,
`which can't be erased and rewritten.
`
`The flash memory used in storage devices must be read and written in pages
`and erased in blocks. The page size for read and programming (write) opera(cid:173)
`tions is typically either 528 bytes (small block) or 2112 bytes (large block).
`A 528-byte page can hold one 512-byte sector and 16 additional bytes for
`error-correcting codes (ECC), address-mapping information for use in wear
`leveling, and other information. A 2112-byte page holds four 512-byte sec(cid:173)
`tors with 16 additional bytes per sector. Newer memory chips tend to use
`large blocks.
`
`The block size for erase operations is much larger than the page size for read(cid:173)
`ing and writing. In the past, blocks of 16 KB and 32 KB were common,
`while current flash memory has erase blocks of 128 KB or 256 KB. Before
`writing to previously programmed memory, the area to be written must be
`erased. So to write even a single byte to a previously programmed area, the
`memory controller must erase an entire erase block and then program a
`page's contents back into the memory.
`
`The controllers in flash-memory cards manage the erase operations and
`enable device firmware to work with 512-byte blocks. To write a byte to a
`flash-memory card, device firmware typically reads 512 bytes into a buffer,
`changes the byte to be written, and writes the buffer back to the memory
`card. The card's controller handles the erase and write operations.
`
`The controllers in flash-memory cards use wear-leveling techniques that
`help extend the useful life of the memory array by spreading erase/write
`cycles evenly among all of the memory cells. A file-system driver that
`accesses raw flash-memory chips can implement wear leveling as well.
`
`Security
`Some media types have built-in copy-protection capabilities. For example,
`an SD Card can be configured to require authentication before allowing
`access to the card's contents, and a card can restrict the number of allowed
`coptes.
`
`11
`
`Micron Ex. 1018, p. 26
`Micron v. Vervain
`IPR2021-01549
`
`
`
`Chapter 1
`
`Removable Media and Devices
`A device can have removable media, and an entire device can be removable
`from the computer that communicates with the device.
`
`Removable Media
`In a drive with removable media, users can easily insert and remove media in
`the drive. CD and DVD drives have removable media because you can easily
`swap discs. A memory-card reader with a card slot has removable media.
`Hard drives and flash drives have non-removable media because you can't
`easily remove the hard disk from its drive or the flash