MAX6902
SPI-Compatible RTC in a TDFN
10 ______________________________________________________________________________________
unusable, and always read zero. Any data written to
bits 0–6 are ignored. Bit 7 must be set to zero before a
single write to the clock, before a write to RAM, or dur-
ing a Burst Write to the clock.
Example: Setting the Clock
with a Burst Write
To set the clock to 10:11:31PM, Thursday July 4th,
2002 with a burst write operation, write 3Fh as the
Address/Command byte, followed by 8 bytes, 31h, 11h,
B0h, 04h, 07h, 05h, 02h, and 00h (Figure 2). 3Fh is the
Clock Burst Write Address/Command. The first byte,
31h, sets the Seconds register to 31. The second byte,
11h, sets the Minutes register to 11. The third byte,
B0h, sets the Hours register to 12hr mode, and 10PM.
The fourth byte, 04h, sets the Date register (day of the
month) to the 4th. The fifth byte, 07h, sets the Month
register to July. The sixth byte, 05h, sets the Day regis-
ter (day of the week) to Thursday. The seventh byte,
02h, sets the Year register to 02. The eighth byte, 00h,
clears the Write-Protect bit of the Control register to
allow writing to the MAX6902. The Century register is
not accessed with a Burst Write and therefore must be
written to separately to set the century to 20. Note the
Century register corresponds to the thousand and hun-
dred digits of the current year and defaults to 19.
Reading the Clock
Reading the Timekeeping Registers
The main timekeeping registers (Seconds, Minutes,
Hours, Date, Month, Day, Year) can be read with either
Single Reads or a Burst Read. In the MAX6902, a latch
buffers each clock counter’s data. Clock counter data
are latched by the SPI Read Command (on the falling
edge of SCLK, after the Address/Command byte has
been sent by the master to read a timekeeping regis-
ter). Collision-detection circuitry ensures that this does
not happen coincident with a Seconds counter incre-
ment to ensure accurate time data are being read. The
clock counters continue to count and keep accurate
time during the read operation.
The simplest way to read the timekeeping registers is to
use a Burst Read. In a Burst Read, the main timekeep-
ing registers (Seconds, Minutes, Hours, Date, Month,
Day, Year), and the Control register are read sequen-
tially, in the order listed with the Seconds register first.
They are read out as a group of eight registers, with 8
bits each. All timekeeping registers (except Century)
are latched upon the receipt of the Burst Read com-
mand. The worst-case error between the “actual” time
and the “read” time is 1s for a normal data transfer.
The timekeeping registers may also be read using
Single Reads. If Single Reads are used, it is necessary
to do some error checking on the receiving end,
because it is possible that the clock counters could
change during the Read operations, and report inaccu-
rate time data. The potential for error is when the
Seconds register increments before all the registers are
read. For example, suppose a carry of 13:59:59 to
14:00:00 occurs during single read operations. The net
data read could be 14:59:59, which is erroneous. To
prevent errors from occurring with single read opera-
tions, read the Seconds register first (initial-seconds)
and store this value for future comparison. After the
remaining timekeeping registers have been read,
reread the Seconds register (final-seconds). Check that
the final-seconds value equals the initial-seconds
value. If not, repeat the entire Single Read process.
Using Single Reads at a 100kHz serial speed, it takes
under 2.5ms to read all seven of the timekeeping regis-
ters, including two reads of the Seconds register.
Example: Reading the Clock
with a Burst Read
To read the time with a Burst Read, send BFh as the
Address/Command byte. Then clock out 8 bytes,
Seconds, Minutes, Hours, Date of the month, Month,
Day of the week, Year, and finally the Control byte. All
data are output MSB first. Decode the required informa-
tion based on the register definitions listed in Figure 2.
Using the Alarm
A polled alarm function is available by reading the ALM
OUT bit. The ALM OUT bit is D7 of the Minutes timekeep-
ing register. A logic 1 in ALM OUT indicates the Alarm
function is triggered. There are eight registers associated
with the alarm function—seven programmable Alarm
Threshold registers and one programmable Alarm
Configuration register. The Alarm Configuration register
determines which Alarm Threshold registers are com-
pared to the timekeeping registers, and the ALM OUT bit
sets if the compared registers are equal. Figure 2 shows
the function of each bit of the Alarm Configuration regis-
ter. Placing a logic 1 in any given bit of the Alarm
Configuration register enables the respective alarm func-
tion. For example, if the Alarm Configuration register is set
to 0000 0011, ALM OUT is set when both the minutes and
seconds indicated in the Alarm Threshold registers match
the respective timekeeping registers. Once set, ALM OUT
stays high until it is cleared by reading or writing to the
Alarm Configuration register, or by reading or writing to
any of the Alarm Threshold registers. The Alarm
Configuration register is written with address 15h, and
read with address 95h.
MAX6902
SPI-Compatible RTC in a TDFN
______________________________________________________________________________________ 11
Using the On-Board RAM
The static RAM is 31 x 8 bits addressed consecutively
in the RAM Address/Command space. Table 2 details
the specific hex Address/Commands for Reads and
Writes to each of the 31 locations of RAM. The contents
of the RAM are static and remain valid for V
CC
down to
2V. All RAM data are lost if power is cycled. The Write-
Protect Bit (bit 7 of the Control register), when high, dis-
allows any writes to RAM.
SPI-Compatible Serial
Interface
Interface the MAX6902 with a microcontroller using a
serial, 4-wire, SPI interface. SPI is a synchronous bus
for address and data transfer, and is used with
Motorola or other microcontrollers that have an SPI
port. Four connections are required for the interface:
DOUT (Serial Data Out); DIN (Serial Data In); SCLK
(Serial Clock); and CS (Chip Select). In an SPI applica-
tion, the MAX6902 acts as a slave device and the
microcontroller acts as the master. CS is asserted low
by the microcontroller to initiate a transfer, and
deasserted high to terminate a transfer. DIN transfers
input data from the microcontroller to the MAX6902.
DOUT transfers output data from the MAX6902 to the
microcontroller. A shift clock, SCLK, is used to synchro-
nize data movement between the microcontroller and
the MAX6902. SCLK, which is generated by the micro-
controller, is active only during address and data trans-
fer to any device on the SPI bus. The inactive clock
polarity is usually programmable on the microcontroller
side of the SPI interface. In the MAX6902, input data
are latched on the positive edge, and output data are
shifted out on the negative edge. There is one clock
cycle for each bit transferred. Address and data bits
are transferred in groups of eight.
The SPI protocol allows for one of four combinations of
serial clock phase and polarity from the microcontroller,
through a 2-bit selection in its SPI Control register. The
clock polarity is specified by the CPOL Control bit,
which selects active-high or active-low clock, and has
no significant effect on the transfer format. The Clock
Phase Control bit, CPHA, selects one of two different
transfer formats. The clock phase and polarity must be
identical for the master and the slave. For the
MAX6902, set the control bits to CPHA = 1 and CPOL =
1. This configures the system for data to be launched
on the negative edge of SCLK and sampled on the
positive edge. With CPHA equal to 1, CS can remain
low between successive data byte transfers, allowing
burst-mode data transfers to occur.
Address and data bytes are shifted MSB first into DIN
of the MAX6902, and out of DOUT. Data are shifted out
at the negative edge of SCLK, and shifted in or sam-
pled at the positive edge of SCLK. Any transfer
requires an Address/Command byte followed by one or
more bytes of data. Data are transferred out of DOUT
for a read operation, and into DIN for a write operation.
DOUT transmits data only after an Address/Command
byte specifies a read operation; otherwise, it is high
impedance.
Data Transfer Write timing is shown in Figure 3. Data
Transfer Read timing is shown in Figure 4. Detailed
Read and Write Timing is shown in Figure 5.
SCLK
0 R* A5 A4 A3 A2 A1 1 D7 D6 D5 D4 D3 D2 D1 D0
DIN
DOUT
ADDRESS/COMMAND BYTE DATA BYTE
HIGH IMPEDANCE; NO ACTIVITY ON DOUT LINE DURING WRITES.
CS
* R = RAM/REGISTER SELECT BIT; RAM = 1, REGISTER = 0.
Figure 3a. Single Write
MAX6902
SPI-Compatible RTC in a TDFN
12 ______________________________________________________________________________________
1 1 1 1 1 1 D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2
ADDRESS/COMMAND BYTE** DATA BYTE 1 DATA BYTE N
HIGH IMPEDANCE; NO ACTIVITY ON DOUT LINE DURING WRITES.
D1 D00R*
CS
SCLK
DIN
DOUT
* R = RAM/REGISTER SELECT BIT; RAM = 1, REGISTER = 0.
** ONLY ONE ADDRESS/COMMAND BYTE IS REQUIRED PER BURST TRANSACTION.
Figure 3b. Burst Write
SCLK
1R*
A5 A4 A3 A2 A1
1
DIN
DOUT
ADDRESS/COMMAND BYTE
HIGH IMPEDANCE
DATA BYTE
D7 D6 D5 D4 D3 D2 D1 D0
CS
* R = RAM/REGISTER SELECT BIT; RAM = 1, REGISTER = 0.
Figure 4a. Single Read
111111
ADDRESS/COMMAND BYTE**
D7 D6 D5 D4 D3 D2 D1 D0
D7 D6 D5 D4 D3 D2
DATA BYTE 1
DATA BYTE N
HIGH IMPEDANCE
1R*
D1 D0
CS
SCLK
DIN
DOUT
* R = RAM/REGISTER SELECT BIT; RAM = 1, REGISTER = 0.
** ONLY ONE ADDRESS/COMMAND BYTE IS REQUIRED PER BURST TRANSACTION.
Figure 4b. Burst Read

MAX6902ETA+T

Mfr. #:
Manufacturer:
Maxim Integrated
Description:
IC RTC CLK/CALENDAR SPI 8-TDFN
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet