PCA2125_1 © NXP B.V. 2008. All rights reserved.
Product data sheet Rev. 01 — 28 July 2008 16 of 36
NXP Semiconductors
PCA2125
SPI Real-time clock/calendar
If a new value of n is written before the end of the current timer period, then this value will
take immediate effect. NXP Semiconductors does not recommend changing n without first
disabling the counter (by setting bit TE = 0). The update of n is asynchronous with the
timer clock, therefore changing it without setting bit TE = 0 will result in a corrupted value
loaded into the countdown counter which results in an undetermined countdown period for
the first period. The countdown value n will however be correctly stored and correctly
loaded on subsequent timer periods.
When the countdown timer flag is set, an interrupt signal on INT will be generated
provided that this mode is enabled. See Section 8.7.2 for details on how the interrupt can
be controlled.
When starting the timer for the first time, the first period will have an uncertainty which is a
result of the enable instruction being generated from the interface clock which is
asynchronous with the timer source clock. Subsequent timer periods will have no such
delay. The amount of delay for the first timer period will depend on the chosen source
clock; see Table 29.
At the end of every countdown, the timer sets the countdown timer flag (bit TF). Bit TF can
only be cleared by software. The asserted bit TF can be used to generate an interrupt
(INT). The interrupt can be generated as a pulsed signal every countdown period or as a
permanently active signal which follows the condition of bit TF. Bit TI_TP is used to control
this mode selection and the interrupt output can be disabled with bit TIE.
In the example it is assumed that the timer flag is cleared before the next countdown period expires
and that the INT is set to pulsed mode.
Fig 10. General countdown timer behavior
Table 29. First period delay for timer counter value n
Timer source clock Minimum timer period Maximum timer period
4096 Hz n n + 1
64 Hz n n + 1
1 Hz (n 1) +
1
64
Hz n +
1
64
Hz
1
60
Hz (n 1) +
1
64
Hz n +
1
64
Hz
001aaf906
n
duration of first timer period after
enable may range from n 1 to n + 1
03xx 02 01 03 02 01 03 02 01 03
n
03xxcountdown value, n
timer source clock
countdown counter
TE
TF
INT
PCA2125_1 © NXP B.V. 2008. All rights reserved.
Product data sheet Rev. 01 — 28 July 2008 17 of 36
NXP Semiconductors
PCA2125
SPI Real-time clock/calendar
When reading the timer, the current countdown value is returned and not the initial
value n. For accurate read back of the countdown value, the SPI-bus clock (SCL) must be
operating at a frequency of at least twice the selected timer clock. Since it is not possible
to freeze the countdown timer counter during read back, it is recommended to read the
register twice and check for consistent results.
8.6.3 Timer flags
When a minute or second interrupt occurs, bit MSF is set to logic 1. Similarly, at the end of
a timer countdown, bit TF is set to logic 1. These bits maintain their value until overwritten
by software. If both countdown timer and minute/second interrupts are required in the
application, the source of the interrupt can be determined by reading these bits. To
prevent one flag being overwritten while clearing another, a logic AND is performed during
a write access. The flag is reset by writing a logic 0 but its value is not affected by writing a
logic 1.
Three examples are given for clearing the flags. Flags MSF and TF are cleared by a write
command, therefore bits 7, 6, 4, 1 and 0 must be written with their previous values.
Repeatedly re-writing these bits has no influence on the functional behavior.
Table 31, Table 32 and Table 33 show what instruction must be sent to clear the
appropriate flag.
Clearing the alarm flag (bit AF) operates in exactly the same way; see Section 8.5.1.
8.7 Interrupt output
An active LOW interrupt signal is available at pin INT. Operation is controlled via the bits
of control register 2. Interrupts can be sourced from three places: second/minute timer,
countdown timer and alarm function.
Bit TI_TP configures the timer generated interrupts to be either a pulse or to follow the
status of the interrupt flags (bits TF and MSF).
Table 30. Flag location in register Control_2
Register Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Control_2 - - MSF - AF TF - -
Table 31. Example to clear only TF (bit 2) in register Control_2
Register Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Control_2 - - 1 - 1 0 - -
Table 32. Example to clear only MSF (bit 5) in register Control_2
Register Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Control_2 - - 0 - 1 1 - -
Table 33. Example to clear both TF and MSF (bits 2 and 5) in register Control_2
Register Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Control_2 - - 0 - 1 0 - -
PCA2125_1 © NXP B.V. 2008. All rights reserved.
Product data sheet Rev. 01 — 28 July 2008 18 of 36
NXP Semiconductors
PCA2125
SPI Real-time clock/calendar
Remark: Note that the interrupts from the three groups are wired-OR, meaning they will
mask one another; see Figure 11.
8.7.1 Minute and second interrupts
The pulse generator for the minute/second interrupt operates from an internal 64 Hz clock
and consequently generates a pulse of
1
64
second duration.
If the MSF flag is clear before the end of the INT pulse, then the INT pulse is shortened.
This allows the source of a system interrupt to be cleared immediately it is serviced i.e.
the system does not have to wait for the completion of the pulse before continuing; see
Figure 12. Instructions for clearing MSF are given in Section 8.6.3.
When bits SI, MI, TIE and AIE are all disabled, pin INT will remain high-impedance.
Fig 11. Interrupt scheme
001aaf907
SECONDS COUNTER
SI
0
1
MSF: MINUTE
SECOND FLAG
CLEAR
SET
PULSE
GENERATOR 1
CLEAR
TRIGGER
TE
SI MI
MINUTES COUNTER
COUNTDOWN COUNTER
MI
from interface:
clear MSF
to interface:
read MSF
AF: ALARM
FLAG
CLEAR
SET
to interface:
read AF
0
1
TF: TIMER
CLEAR
SET
PULSE
GENERATOR 2
CLEAR
TRIGGER
TIE
INT
from interface:
clear TF
from interface:
clear AF
set alarm
flag, AF
to interface:
read TF
TI_TP
AIE

PCA2125TS/1,112

Mfr. #:
Manufacturer:
NXP Semiconductors
Description:
IC RTC CLK/CALENDAR SPI 14-TSSOP
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet