![](http://datasheet.mmic.net.cn/Flexipanel/USB-FILESYS-DIL_datasheet_99869/USB-FILESYS-DIL_3.png)
p3 of 10
26-Aug-10
USB-FileSys / USB-Config
HW149-8
www.hexwax.com
MOSI may be changed by the master. (This is also
known as Mode D or 0,0 operation.) See figure 3. The
actual commands are specified in the Host Commands
section.
Hi-Z
SSn
SCLK
MOSI
MISO
...
Command
Response
...
1MHz max
Figure 3. SPI Timing Diagram
All commands from the host are followed by a response
from USB-FileSys.
Since the time generated to
generate a response is indeterminate, USB-FileSys will
output bytes of value 0xFF until it can generate a valid
response. After issuing a command, the host should
repeatedly read data from USB-FileSys, waiting for a
byte with a value other than 0xFF. The Write File and
Set File Entry commands are each composed of two
such Command-Response exchanges.
USB-FileSys has been tested with SPI clock rates up to
1MHz.
Memory
Internal Memory
In order to maximize available storage space, the
internal memory is pre-formatted as a 16-sector FAT12
file system with 512 bytes per sector.
(4 of these
sectors are required for the file system and root
directories.) Reformatting by the PC is not permitted.
The root directory can contain up to 16 entries, including
the volume name.
Since long file names require
multiple directory entries, they are not recommended.
The volume is normally supplied containing no files. If
ordered in 5K+ quantities, files may be pre-loaded.
To indicate to USB-FileSys that the internal memory
should be used, the SCK-M input should be pulled low.
Pages of internal memory may be erased and rewritten
approximately 100K times.
If file sizes change
frequently, the greatest wear will occur in the FAT tables
and the directory entry. Therefore if a file is to be written
to frequently, its size should be fixed.
This option is only available for the 28-pin device.
TQFP and SSOP packages are available, but they are
not in general distribution.
Contact us for further
information.
External Memory – 25AA1024
For
moderate storage
applications,
a
Microchip
25AA1024
memory (128kByte storage)
may
be
connected to the MISO-M, MOSI-M, SCK-M and SSn-M
lines.
A 4k7 pull-up resistor should be provided for
SCK-M. The media detect input should be permanently
biased low.
When first used, the memory will automatically be
formatted as a 16-sector FAT12 file system with 512
bytes per sector. The PC may re-format the drive if
required.
External Memory – SD card / integrated circuit
For large storage applications, an SD-compatible
memory of up to 1GB may be connected to the MISO-M,
MOSI-M, SCK-M and SSn-M lines. 4k7 pull-up resistors
should be provided for these lines, and also for unused
SD card I/O pins.
The memory can be a removable SD card or a SD-
compatible chip. If the memory is removable, the media
detect input should be connected to a switch to indicate
when the card is present. Devices with SD card readers
will be able to read the data on the SD card directly.
Memories larger than 1GB will be ignored, as will non-
standard memories which do not have block sizes of
512 bytes. San-Disk products are used for testing.
Pages of SD memory are typically wear-leveled, so
memory wear is not a great concern – memory wear can
be compensated for by using a larger memory. For
example, for a given amount of data stored, a 1GB SD
card will last 10 times longer than a 100MB card.
This option is only available for the 28-pin device.
TQFP and SSOP packages are available, but they are
not in general distribution.
Contact us for further
information.
Memory Integrity
With internal memory and 25AA1024 memory, power
loss during a write may result in corruption of data,
possibly requiring reformatting of the disk.
With external memory, power loss protection may or
may not be implemented by the memory itself.
If power is lost while a file is open, the file length
information in the directory entry may be incorrect, but
the data will be intact.
Application Circuits
The following circuits show a typical implementation of
the USB-FileSys.
Suggested component values are
shown in table 3.
Table 3. Suggested component values
Label
Component
R1-R3, R40-R44
22k resistor
R6
1k resistor
R21
470Ω resistor
T1
P-channel Mosfet, e.g. NDS352P
D1-D2
Low Vf switching diode
LED1
Light emitting diode
C1
1μF capacitor
C2, C3
22pF capacitor
C4, C6-C7
100nF capacitor
C8
470nF capacitor
X1
12MHz parallel cut crystal