L86 FM24C16A By Master
Start
S
Address & Data
Slave Address
0 A
Word Address
By FM24C16
Stop
A
Data Byte
A
P
Acknowledge
Figure 5. Single Byte Write
By Master
Start
S
Address & Data
Slave Address
0 A
Word Address
Stop
A
Data Byte
By FM24C16
A
Data Byte
A
P
Acknowledge
Figure 6. Multiple Byte Write Read Operation There are two types of read operations. They are current address read and selective address read. In a current address read, the FM24C16A uses the internal address latch to supply the lower 8 address bits. In a selective read, the user performs a procedure to set these lower address bits to a specific value.
most likely create a bus contention as the FM24C16A attempts to read out additional data onto the bus. The four valid methods are as follows. 1.
2. Current Address & Sequential Read As mentioned above the FM24C16A uses an internal latch to supply the lower 8 address bits for a read operation. A current address read uses the existing value in the address latch as a starting place for the read operation. This is the address immediately following that of the last operation. To perform a current address read, the bus master supplies a slave address with the LSB set to 1. This indicates that a read operation is requested. The 3 page select bits in the slave ID specify the block of memory that is used for the read operation. On the next clock, the FM24C16A will begin shifting out data from the current address. The current address is the 3 bits from the slave ID combined with the 8 bits that were in the internal address latch. Beginning with the current address, the bus master can read any number of bytes. Thus, a sequential read is simply a current address read with multiple byte transfers. After each byte, the internal address counter will be incremented. Each time the bus master acknowledges a byte this indicates that the FM24C16A should read out the next sequential byte. There are four ways to properly terminate a read operation. Failing to properly terminate the read will Rev 3.0 Mar. 2005
3. 4.
The bus master issues a no-acknowledge in the 9th clock cycle and a stop in the 10th clock cycle. This is illustrated in the diagrams below. This is the preferred method. The bus master issues a no-acknowledge in the 9th clock cycle and a start in the 10th. The bus master issues a stop in the 9th clock cycle. Bus contention may result. The bus master issues a start in the 9th clock cycle. Bus contention may result.
If the internal address reaches 7FFh it will wrap around to 000h on the next read cycle. Figures 7 and 8 show the proper operation for current address reads. Selective (Random) Read A simple technique allows a user to select a random address location as the starting point for a read operation. It uses the first two bytes of a write operation to set the internal address byte followed by subsequent read operations. To perform a selective read, the bus master sends out the slave address with the LSB set to 0. This specifies a write operation. According to the write protocol, the bus master then sends the word address byte that is loaded into the internal address latch. After the FM24C16A acknowledges the word address, the bus master issues a start condition. This simultaneously aborts the write operation and allows the read command to be issued with the slave address set to 1.
L87 FM24C16A The operation is now a current address read. This Start
By Master
operation is illustrated in Figure 9. No Acknowledge
Address
S
Slave Address
By FM24C16
1 A
Data Byte
Acknowledge
1
Stop
P
Data
Figure 7. Current Address Read
Start
By Master
Address
No Acknowledge
Acknowledge
Stop S
Slave Address
By FM24C16
1 A
Data Byte
A
Acknowledge
Data Byte
1 P
Data
Figure 8. Sequential Read
By Master
Address
Start
Start
No Acknowledge
Acknowledge
Address
Stop S
By FM24C16
Slave Address
0 A
Word Address
A
S
Slave Address
1 A
Acknowledge
Data Byte
A
Data Byte
1 P
Data
Figure 9. Selective (Random) Read
Endurance The FM24C16A internally operates with a read and restore mechanism. Therefore, endurance cycles are applied for each read or write cycle. The FRAM architecture is based on an array of rows and columns. Rows are defined by A10-A3. Each access causes an endurance cycle for a row. Endurance can be optimized by ensuring frequently accessed data is placed in different rows. Regardless, FRAM read and write endurance is effectively unlimited at the 1MHz
Rev 3.0 Mar. 2005
two-wire speed. Even at 3000 accesses per second to the same row, 10 years time will elapse before 1 trillion endurance cycles occur.
L88 FM24C16A
Electrical Specifications Absolute Maximum Ratings Symbol Description VDD Power Supply Voltage with respect to VSS VIN Voltage on any signal pin with respect to VSS TSTG TLEAD VESD
Storage Temperature Lead Temperature (Soldering, 10 seconds) Electrostatic Discharge Voltage - Human Body Model (JEDEC Std JESD22-A114-B) - Charged Device Model (JEDEC Std JESD22-C101-A) - Machine Model (JEDEC Std JESD22-A115-A) Package Moisture Sensitivity Level
Ratings -1.0V to +7.0V -1.0V to +7.0V and VIN < VDD+1.0V * -55°C to +125°C 300° C 4kV 1kV 300V MSL-1
* Exception: The “VIN < VDD+1.0V” restriction does not apply to the SCL and SDA inputs. Stresses above those listed under Absolute Maximum Ratings may cause permanent damage to the device. This is a stress rating only, and the functional operation of the device at these or any other conditions above those listed in the operational section of this specification is not implied. Exposure to absolute maximum ratings conditions for extended periods may affect device reliability.
DC Operating Conditions (TA = -40° C to + 85° C, VDD = 4.5V to 5.5V unless otherwise specified) Symbol Parameter Min Typ Max VDD Main Power Supply 4.5 5.0 5.5 IDD VDD Supply Current @ SCL = 100 kHz 115 150 @ SCL = 400 kHz 400 500 @ SCL = 1 MHz 800 1000 ISB Standby Current 1 10 ILI Input Leakage Current ±1 ILO Output Leakage Current ±1 VIL Input Low Voltage -0.3 0.3 VDD VIH Input High Voltage 0.7 VDD VDD + 0.5 VOL Output Low Voltage 0.4 @ IOL = 3 mA RIN Input Resistance (WP pin) For VIN = VIL (max) 50 For VIN = VIH (min) 1 VHYS Input Hysteresis 0.05 VDD
Units V
Notes 1
∝A ∝A ∝A ∝A ∝A ∝A V V
2 3 3
V K. M. V
5 4
Notes 1. SCL toggling between VDD-0.3V and VSS, other inputs VSS or VDD-0.3V. 3. 2. SCL = SDA = VDD. All inputs VSS or VDD. Stop command issued. 4. 3. VIN or VOUT = VSS to VDD. Does not apply to WP pin. 5. 4. This parameter is characterized but not tested. 6. 5. The input pull-down circuit is strong (50K. ) when the input voltage is below VIL and much weaker (1M. ) when the input voltage is above VIH.
Rev 3.0 Mar. 2005
L89 FM24C16A AC Parameters (TA = -40° C to + 85° C, VDD = 4.5V to 5.5V unless otherwise specified) Symbol Parameter Min Max Min Max Min fSCL SCL Clock Frequency 0 100 0 400 0 tLOW Clock Low Period 4.7 1.3 0.6 tHIGH Clock High Period 4.0 0.6 0.4 tAA SCL Low to SDA Data Out Valid 3 0.9 tBUF tHD:STA tSU:STA tHD:DAT tSU:DAT tR tF tSU:STO tDH tSP
Bus Free Before New Transmission Start Condition Hold Time Start Condition Setup for Repeated Start Data In Hold Time Data In Setup Time Input Rise Time Input Fall Time Stop Condition Setup Data Output Hold (from SCL @ VIL) Noise Suppression Time Constant on SCL, SDA
Max 1000
0.55
Units kHz ∝s ∝s ∝s
4.7 4.0 4.7
1.3 0.6 0.6
0.5 0.25 0.25
∝s ∝s ∝s
0 250
0 100
0 100 300 100
ns ns ns ns ∝s ns
50
ns
1000 300 4.0 0
300 300 0.6 0
50
0.25 0 50
Notes : All SCL specifications as well as start and stop conditions apply to both read and write operations. 1 The speed-related specifications are guaranteed characteristic points from DC to 1 MHz. 2 This parameter is periodically sampled and not 100% tested.
Capacitance (TA = 25° C, f=1.0 MHz, VDD = 5V) Symbol Parameter CI/O Input/Output Capacitance (SDA) CIN Input Capacitance
Max 8 6
Notes 1 This parameter is periodically sampled and not 100% tested.
AC Test Conditions Input Pulse Levels Input rise and fall times Input and output timing levels Equivalent AC Load Circuit 5.5V
1700 . Output 100 pF
Rev 3.0 Mar. 2005
0.1 VDD to 0.9 VDD 10 ns 0.5 VDD
Units pF pF
Notes 1 1
Notes 1
2 2
L90 FM24C16A Diagram Notes All start and stop timing parameters apply to both read and write cycles. Clock specifications are identical for read and write cycles. Write timing parameters apply to slave address, word address, and write data bits. Functional relationships are illustrated in the relevant data sheet sections. These diagrams illustrate the timing parameters only. Read Bus Timing tR
tF
t HIGH
t SP
t LOW
t SP
SCL t SU:SDA
1/fSCL
t BUF
t HD:DAT t SU:DAT
SDA Start
t DH
t AA
Stop Start
Acknowledge
Write Bus Timing t HD:DAT
SCL t HD:STA
t SU:STO
t SU:DAT
t AA
SDA Start
Stop Start
Data Retention (VDD = 4.5V to 5.5V, +85° C) Parameter Data Retention
Rev 3.0 Mar. 2005
Min 45
Acknowledge
Units Years
Notes
L91 FM24C16A
Mechanical Drawing 8-pin SOIC (JEDEC Standard MS-012 variation AA)
Recommended PCB Footprint
7.70
3.90 ±0.10
3.70
6.00 ±0.20 2.00
0.65
1.27
Pin 1 4.90 ±0.10
1.27 0.33 0.51
0.25 0.50
1.35 1.75
0.10 0.25
0.10 mm
0.19 0.25
45 °
0°- 8°
0.40 1.27
Refer to JEDEC MS-012 for complete dimensions and notes. All dimensions in millimeters.
SOIC Package Marking Scheme
XXXXXXX-P LLLLLLL RICYYWW
Legend: XXXX= part number, P= package type LLLLLLL= lot code RIC=Ramtron Int’l Corp, YY=year, WW=work week Example: FM24C16A, Standard SOIC package, Year 2004, Work Week 39 FM24C16A-S A40003S RIC0439
Rev 3.0 Mar. 2005
L92 FM24C16A
Revision History Revision 0.1 2.0 2.1 3.0
Rev 3.0 Mar. 2005
Date 6/26/02 7/23/03 3/17/04 3/29/05
Summary Initial Release Changed to Production status. Added “green” package. Updated package drawing. Changed Data Retention spec. Added ESD and package MSL ratings. Added pcb footprint drawing. New rev. number and 1st page footer to comply with new scheme.
L93
EMS SD/MMC/FRAM Application Note Mengenal SD Card & FAT16 Oleh: Tim IE
S
ecure Digital (SD) atau MultiMedia Card (MMC) seringkali digunakan sebagai sarana penyimpan data pada Personal Digital Assistant (PDA), kamera digital, dan telepon seluler (ponsel). Beberapa perintah dasar untuk SD Card juga dapat digunakan untuk MMC sehingga kita dapat menggunakan SD atau MMC. Format data pada SD maupun MMC umumnya menggunakan format FAT. FAT12 digunakan untuk kapasitas 16 MB ke bawah. FAT16 digunakan untuk kapasitas 32 MB hingga 2 GB. FAT32 digunakan untuk kapasitas di atas 2 GB (SDHC). Ada 2 bagian yang akan dijelaskan secara singkat pada AN ini, yaitu: 1. Protokol komunikasi SD card secara SPI 2. Format data FAT16 Perlu diketahui bahwa penjelasan berikut ini merupakan penjelasan dasar. Penjelasan ini tidak mencakup keseluruhan protokol atau format data namun dapat digunakan sebagai bahan untuk membuat aplikasi berbasis SD Card dengan FAT16 secara sederhana.
S
D card terbagi atas sektor-sektor dan tiap satu sektornya berisi 512 byte (sumber: http://document.sharpsma.com/files/LH79520_AN_multimediacar.pdf). Secara default, proses baca atau tulis selalu melibatkan satu sektor (512 byte). Secara default juga, nilai byte CRC bersifat don’t care sehingga nilainya sembarang / dapat diabaikan (tidak dihitung). Salah satu sumber mengenai protokol komunikasi SPI untuk SD/MMC adalah dari situs internet http://www.ulrichradig.de milik Ulrich Radig, tepatnya pada dokumen http://www.ulrichradig.de/site/arm_projekts/mmc_sd/doc/MMCSDTimming.pdf. Berdasar dari sumber ini dan juga percobaan, maka timing diagram untuk perintah RESET, INIT, READ, dan WRITE adalah sebagai berikut: RESET
10 x 8
8 4x8 8
Nx8
8
8
= jumlah pulsa SCK
SCK
CSSD
MOSI 40h 00h 95h MISO 01h Gambar 1 Timing Diagram Perintah RESET 1. Pada dokumen asli milik Ulrich Radig, RESET diawali dengan pengiriman lebih dari 74 pulsa clock SCK. Oleh karena itu pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, pulsa yang dikirimkan adalah 10 byte data FFh atau 80 pulsa clock. Semua ini dilakukan saat kondisi CSSD, MOSI, dan MISO berlogika High. 2. Langkah berikutnya adalah mengubah logika CSSD menjadi Low untuk mulai mengakses SD card. Pada dokumen Ulrich Radig memang tidak disebutkan berapa lama jarak antara perubahan logika CSSD
Application Note Mengenal SD Card & FAT16
L94
3. 4.
5. 6.
dengan pengiriman clock berikutnya. Namun pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, diletakkan jeda selama 5 µs sebelum mulai mengirimkan clock berikutnya. Data pertama yang dikirim adalah 40h (CMD0), diikuti dengan pengiriman 4 byte bernilai 00h, dan diakhiri dengan pengiriman CRC bernilai 95h. Selama CSSD masih berlogika Low, dilakukan pemeriksaan terhadap MISO untuk mengetahui apakah perintah ini sudah diterima oleh SD card. Hal ini dilakukan dengan membaca data dari MISO hingga bernilai 01h. Pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, pemeriksaan ini dibatasi hanya 9 kali pembacaan. Setelah menerima 01h, diletakkan jeda selama 5 µs sebelum mengembalikan CSSD ke logika High (pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51). Setelah CSSD berlogika High, dilakukan pengiriman 1 byte data FFh atau 8 pulsa clock. Pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, hal ini tidak dilakukan. Sebagai gantinya, sebelum perintah INIT, READ, atau WRITE, ditambahkan pengiriman 1 byte FFh atau 8 pulsa clock. INIT
8 4x8 8
Nx8
8
8
= jumlah pulsa SCK
SCK
CSSD
MOSI 41h 00h FFh MISO 00h Gambar 2 Timing Diagram Perintah INIT 1. Pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, ditambahkan pengiriman 1 byte FFh atau 8 pulsa clock sebelum mengirimkan perintah ini. 2. Pengiriman perintah ini diawali dengan mengubah logika CSSD menjadi Low untuk mulai mengakses SD card. Pada dokumen Ulrich Radig memang tidak disebutkan berapa lama jarak antara perubahan logika CSSD dengan pengiriman clock berikutnya. Namun pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, diletakkan jeda selama 5 µs sebelum mulai mengirimkan clock berikutnya. 3. Data pertama yang dikirim adalah 41h (CMD1), diikuti dengan pengiriman 4 byte bernilai 00h, dan diakhiri dengan pengiriman CRC bernilai FFh. 4. Selama CSSD masih berlogika Low, dilakukan pemeriksaan terhadap MISO untuk mengetahui apakah perintah ini sudah diterima oleh SD card. Hal ini dilakukan dengan membaca data dari MISO hingga bernilai 00h. Pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, pemeriksaan ini dibatasi hanya 9 kali pembacaan. 5. Setelah menerima 00h, diletakkan jeda selama 5 µs sebelum mengembalikan CSSD ke logika High (pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51). 6. Setelah CSSD berlogika High, dilakukan pengiriman 1 byte data FFh atau 8 pulsa clock. Pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, hal ini tidak dilakukan. Sebagai gantinya, sebelum perintah INIT, READ, atau WRITE, ditambahkan pengiriman 1 byte FFh atau 8 pulsa clock. Pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, jika SD card tidak mengirimkan 00h, maka proses pengiriman perintah INIT akan diulangi dari awal. Proses pengulangan ini akan dibatasi sebanyak 250 kali.
Application Note Mengenal SD Card & FAT16
L95
READ
8 4x8 8
Nx8
8
Nx8
8
512 x 8
8
8
8
= jumlah pulsa SCK
SCK
CSSD
MOSI 51h
Sector FFh Address
MISO 00h
FEh
512 byte CRC 2 byte (don’t care)
Gambar 3 Timing Diagram Perintah READ 1. Pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, ditambahkan pengiriman 1 byte FFh atau 8 pulsa clock sebelum mengirimkan perintah ini. 2. Pengiriman perintah ini diawali dengan mengubah logika CSSD menjadi Low untuk mulai mengakses SD card. Pada dokumen Ulrich Radig memang tidak disebutkan berapa lama jarak antara perubahan logika CSSD dengan pengiriman clock berikutnya. Namun pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, diletakkan jeda selama 5 µs sebelum mulai mengirimkan clock berikutnya. 3. Data pertama yang dikirim adalah 51h, diikuti dengan pengiriman 4 byte alamat sektor SD card yang dimulai dari MSB, dan diakhiri dengan pengiriman CRC bernilai FFh. 4. Selama CSSD masih berlogika Low, dilakukan pemeriksaan terhadap MISO untuk mengetahui apakah perintah ini sudah diterima oleh SD card. Hal ini dilakukan dengan membaca data dari MISO hingga bernilai 00h. Pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, pemeriksaan ini dibatasi hanya 9 kali pembacaan. 5. Setelah menerima 00h, dilakukan pemeriksaan terhadap MISO lagi untuk menunggu Start Byte yang bernilai FEh. Pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, pemeriksaan ini dibatasi hingga 9 x 250 kali pembacaan. 6. Penerimaan Start Byte diikuti dengan penerimaan 512 byte data dan 2 byte CRC. 7. Setelah menerima 2 byte CRC, diletakkan jeda selama 5 µs sebelum mengembalikan CSSD ke logika High (pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51). 8. Setelah CSSD berlogika High, dilakukan pengiriman 1 byte data FFh atau 8 pulsa clock. Pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, hal ini tidak dilakukan. Sebagai gantinya, sebelum perintah INIT, READ, atau WRITE, ditambahkan pengiriman 1 byte FFh atau 8 pulsa clock. Pada AN SD Card & FRAM – AVR dan AN SD Card & FRAM – MCS-51, jika SD card tidak mengirimkan 00h, maka proses pengiriman perintah READ bagian pertama (hingga penerimaan 00h) akan diulangi dari awal. Proses pengulangan ini akan dibatasi sebanyak 250 kali.
Application Note Mengenal SD Card & FAT16