TMS320VC5503/5507/5509 DSP Real-Time Clock (RTC) Reference Guide
TMS320VC5503/5507/5509 DSP Real-Time Clock (RTC) Reference Guide
TMS320VC5503/5507/5509 DSP Real-Time Clock (RTC) Reference Guide
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications,
enhancements, improvements, and other changes to its products and services at any time and to discontinue
any product or service without notice. Customers should obtain the latest relevant information before placing
orders and should verify that such information is current and complete. All products are sold subject to TI’s terms
and conditions of sale supplied at the time of order acknowledgment.
TI warrants performance of its hardware products to the specifications applicable at the time of sale in
accordance with TI’s standard warranty. Testing and other quality control techniques are used to the extent TI
deems necessary to support this warranty. Except where mandated by government requirements, testing of all
parameters of each product is not necessarily performed.
TI assumes no liability for applications assistance or customer product design. Customers are responsible for
their products and applications using TI components. To minimize the risks associated with customer products
and applications, customers should provide adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right,
copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process
in which TI products or services are used. Information published by TI regarding third-party products or services
does not constitute a license from TI to use such products or services or a warranty or endorsement thereof.
Use of such information may require a license from a third party under the patents or other intellectual property
of the third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of information in TI data books or data sheets is permissible only if reproduction is without
alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction
of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for
such altered documentation.
Resale of TI products or services with statements different from or beyond the parameters stated by TI for that
product or service voids all express and any implied warranties for the associated TI product or service and
is an unfair and deceptive business practice. TI is not responsible or liable for any such statements.
Following are URLs where you can obtain information on other Texas Instruments products and application
solutions:
Products Applications
Amplifiers amplifier.ti.com Audio www.ti.com/audio
Data Converters dataconverter.ti.com Automotive www.ti.com/automotive
DSP dsp.ti.com Broadband www.ti.com/broadband
Interface interface.ti.com Digital Control www.ti.com/digitalcontrol
Logic logic.ti.com Military www.ti.com/military
Power Mgmt power.ti.com Optical Networking www.ti.com/opticalnetwork
Microcontrollers microcontroller.ti.com Security www.ti.com/security
Telephony www.ti.com/telephony
Video & Imaging www.ti.com/video
Wireless www.ti.com/wireless
Notational Conventions
This document uses the following conventions:
- In most cases, hexadecimal numbers are shown with the suffix h. For
example, the following number is a hexadecimal 40 (decimal 64):
40h
Similarly, binary numbers often are shown with the suffix b. For example,
the following number is the decimal number 4 shown in binary form:
0100b
- If a signal or pin is active low, it has an overbar. For example, the RESET
signal is active low.
- Bits and signals are sometimes referenced with the following notations:
The following documents describe the C55x devices and related support tools.
Copies of these documents are available on the Internet at www.ti.com.
Tip: Enter the literature number in the search box provided at www.ti.com.
TMS320VC5503 Fixed-Point Digital Signal Processor Data Manual (litera-
ture number SPRS245) describes the features of the TMS320VC5503
fixed-point DSP and provides signal descriptions, pinouts, electrical
specifications, and timings for the device.
TMS320VC5507 Fixed-Point Digital Signal Processor Data Manual (litera-
ture number SPRS244) describes the features of the TMS320VC5507
fixed-point DSP and provides signal descriptions, pinouts, electrical
specifications, and timings for the device.
Trademarks
TMS320, TMS320C5000, TMS320C55x, and C55x are trademarks of
Texas Instruments.
Contents
Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Figures
1 Real-Time Clock Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2 Seconds Register (RTCSEC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3 Seconds Alarm Register (RTCSECA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4 Minutes Register (RTCMIN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5 Minutes Alarm Register (RTCMINA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6 Hours Register (RTCHOUR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
7 Hours Alarm Register (RTCHOURA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
8 Day of the Week and Day Alarm Register (RTCDAYW) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
9 Day of the Month (Date) Register (RTCDAYM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
10 Month Register (RTCMONTH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
11 Year Register (RTCYEAR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
12 Periodic Interrupt Selection Register (RTCPINTR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
13 Interrupt Enable Register (RTCINTEN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
14 Interrupt Flag Register (RTCINTFL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Tables
1 Real-Time Clock Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2 Time/Calendar Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3 Time/Calendar Alarm Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4 Real-Time Clock Alarm Example Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5 RTC Periodic Interrupt Rates Based on RATE Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6 Real-Time Clock Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
7 Seconds Register (RTCSEC) Field Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
8 Seconds Alarm Register (RTCSECA) Field Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
9 Minutes Register (RTCMIN) Field Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
10 Minutes Alarm Register (RTCMINA) Field Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
11 Hours Register (RTCHOUR) Field Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
12 Hours Alarm Register (RTCHOURA) Field Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
13 Day of the Week and Day Alarm Register (RTCDAYW) Field Values . . . . . . . . . . . . . . . . . . 32
14 Day of the Month (Date) Register (RTCDAYM) Field Values . . . . . . . . . . . . . . . . . . . . . . . . . 32
15 Month Register (RTCMONTH) Field Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
16 Year Register (RTCYEAR) Field Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
17 Periodic Interrupt Selection Register (RTCPINTR) Field Values . . . . . . . . . . . . . . . . . . . . . . 34
18 Interrupt Enable Register (RTCINTEN) Field Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
19 Interrupt Flag Register (RTCINTFL) Field Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
- Counts seconds, minutes, hours, day of the week, date, month, and year
with leap year compensation
- Periodic interrupt
The RTC provides a time reference to an application running on the DSP. The
current date and time is tracked in a set of counter registers that update once
per second. The time can be represented in 12-hour or 24-hour mode. The
calendar and time registers are buffered during reads and writes so that
updates do not interfere with the accuracy of the time and date. For information
on how to set the time and date, see section 2.3 on page 15.
11
Introduction to the Real-Time Clock (RTC)
The clock reference for the RTC is an external 32.768-kHz crystal (connected
between signals RTCINX1 and RTCINX2) or an external clock source of the
same frequency. The RTC also has a separate power supply that is isolated
from the rest of the DSP. When the DSP is without power, the RTC can remain
powered to preserve the current time and calendar information.
Figure 1 shows a block diagram of the RTC. Table 1 lists and describes the
signals.
C55x DSP
RTCINX2 32
kHz Clock Clock
Oscillator divider selector
RTCINX1 Periodic
2 Hz interrupt
Update
interrupt
Time/calendar/ Interrupt RTC IRQ
alarm counters control to CPU
Alarm
interrupt
Control and
Write Read status
buffer buffer registers
Peripheral bus
The source for the RTC reference clock may be provided by a crystal or by an
external clock source. The RTC has an internal oscillator to support operation
with a crystal. The crystal is connected between pins RTCINX1 and RTCINX2.
RTCINX1 is the input to the on-chip oscillator and RTCINX2 is the output from
the oscillator back to the crystal. For more information about the RTC crystal
connection, see the data manual for the DSP being used.
The RTC Seconds Register (RTCSEC) stores the seconds value of the current
time. The minutes register (RTCMIN) stores the minutes value of the current
time. The seconds and minutes are encoded BCD values 00 (0000b 0000b)
through 59 (0101b 1001b).
The RTC Hours Register (RTCHOUR) stores the hours value of the current
time. The hours are encoded BCD values 01 (0000b 0001b) through 12
(0001b 0010b) in 12-hour mode, or 00 (0000b 0000b) through 23
(0010b 0011b) in 24-hour mode. Selection of 12-hour or 24-hour mode is
described in section 2.2.
The RTC Day of the Week and Day Alarm Register (RTCDAYW) stores the day
of the week value of the current date. The DAY field of RTCDAYW is 3 bits and
encodes the day of the week as BCD values 1 (001b) through 7 (111b). The
days of the week are represented as Sunday (1) though Saturday (7).
The RTC Day of the Month Register (RTCDAYM) stores the day of the month
for the current date. The day of the month is encoded as BCD values 01
(0000b 0001b) through 31 (0011b 0001b).
The RTC Month Register (RTCMONTH) stores the month for the current date.
The month is encoded as BCD values 01 (0000b 0001b) through 12
(0001b 0010b).
The RTC Year Register (RTCYEAR) stores the year for the current date. The
year is encoded as BCD values 00 (0000b 0000b) through 99 (1001b 1001b).
The SET bit in RTCINTEN controls the isolation of the read and write buffers
from the time/calendar registers. When SET = 0, the read and write buffers are
directly connected to the time/calendar registers. In this state, the current
time/date can be read directly but there is no protection of the read data during
an update cycle. In other words, if the RTC updates the current time/date while
the CPU is reading the time/calendar registers, an inaccurate time/date could
be read. When SET = 1, the time/calendar registers are copied to the read
buffer and then the read buffer is isolated form the time/calendar registers. So
even if the RTC updates the current time/date, the read value is preserved in
the read buffers. Procedures for reading and writing the time/calendar
registers are described in the sections that follow.
- Set the SET bit in RTCINTEN to isolate the write buffer from the
time/calendar registers.
- Write the desired time and date to the time/calendar registers (RTCSEC,
RTCMIN, RTCHOUR, RTCDAYW, RTCDAYM, RTCMONTH and
RTCYEAR). Since SET = 1, these values actually go to the write buffer.
- Clear the SET bit to copy the write buffer values to the time/calendar
registers.
- Set the SET bit in RTCINTEN to copy the current time/date into the read
buffer and isolate the read buffer from the time/calendar registers.
- Read the current time and date from the time/calendar registers
(RTCSEC, RTCMIN, RTCHOUR, RTCDAYW, RTCDAYM, RTCMONTH
and RTCYEAR). Since SET = 1, these values are actually being read from
the read buffer.
- Clear the SET bit reconnect the read buffer to the time/calendar registers.
This method will provide the time/date that was current when the SET bit was
set and prevents reading an incorrect time due to an RTC update.
2.3.3 How to Read the Time/Calendar Without Using the SET Bit
To read the current time/date without using the SET bit, use the following
procedure:
- Read the RTCSEC for the seconds value of the current time/date.
- Read RTCSEC again and compare to the previous value. If both values
are the same, an RTC update did not occur while the other registers were
being read and the all of the values read represent the current time. If the
seconds have changed, this indicates an RTC update occurred while the
registers were being read and the process should be repeated.
This method provides the time/date that was current when the registers were
read.
Bit 7 represents a “don’t care” condition and causes an alarm to occur every
day. Therefore, while DAR values 0h through 7h cause an alarm to occur on
the specified day of the week, DAR values 8h through Fh cause an alarm to
occur every day.
In 12-hour mode (TM = 0 in RTCINTEN), the HAR field contains the hour of
the desired alarm time and the AMPM bit indicates whether the alarm should
occur in the morning or evening. When AMPM = 0, the value in the HAR field
represents AM. When AMPM = 1, the value in the HAR field represents PM.
In 24-hour mode (TM = 1 in RTCINTEN), the HAR field contains the hour of
the desired alarm time and the AMPM bit should be cleared.
When an interrupt event occurs, the corresponding flag bit (PF, AF, or UF) is
set in the interrupt flag register (RTCINTFL). PF is associated with the periodic
interrupt, AF is associated with the alarm interrupt, and UF is associated with
the update-ended interrupt. These flag bits are set independent of the state of
the corresponding enable bit in RTCINTEN. The flag bit can be used in a
polling mode without enabling the corresponding enable bits.
If one of the three flag bits becomes active and the corresponding enable bit
is set, an RTC interrupt to the CPU occurs. The RTC interrupt is asserted as
long as at least one of the three interrupt flag bits and enable bits are set. The
IRQF bit in RTCINTFL is set to 1 when the RTC interrupt to the CPU is
asserted. The IRQF bit indicates that one or more interrupts have been
initiated by the RTC. When an interrupt occurs from the RTC, the source of the
interrupt can be determined by reading the flag bits in RTCINTFL.
Note:
On the TMS320VC5503/5507/5509 and TMS320VC5509A DSPs, the RTC
interrupt is shared with external interrupt 4 (INT4) in interrupt flag register 1
(bit 3 in IFR1). The presence of an interrupt flag in this bit indicates that either
INT4 or the RTC interrupt has occurred. The source of an RTC interrupt can
be identified by reading RTCINTFL. If no RTC interrupt flags are present, the
interrupt source was INT4.
This interrupt should not be used for both INT4 and RTC at the same time
because some interrupt events may be missed if both interrupt sources
occur near the same time. In this case, when the interrupt service is entered,
the CPU clears the interrupt flag in the CPU. After the return from the interrupt
service routine, the second interrupt source is not serviced since the interrupt
flag in the CPU was cleared.
RTCPINTR Bits
RATE(4−0) Periodic Interrupt Rate
00000 No interrupt
00001 Reserved
00010 Reserved
1xxxx 1 minute
- Select the desired interrupt rate using by configuring the RATE bits in
RTCPINTR.
- Enable the RTC periodic interrupt by setting the PIE bit in RTCINTEN.
- Enable the RTC interrupt in the CPU interrupt enable register 1 (IER1).
When the periodic interrupt occurs, the PF and IRQF flags in RTCINTFL are
set and the RTC interrupt is sent to the CPU.
- Select the desired alarm time by configuring the RTC alarm registers.
- Enable the RTC alarm interrupt by setting the AIE bit in RTCINTEN.
- Enable the RTC interrupt in the CPU interrupt enable register 1 (IER1).
When the alarm interrupt occurs, the AF and IRQF flags in RTCINTFL are set
and the RTC interrupt is sent to the CPU.
- Enable the RTC interrupt in the CPU interrupt enable register 1 (IER1).
When the update-ended interrupt occurs, the UF and IRQF flags in RTCINTFL
are set and the RTC interrupt is sent to the CPU.
- The first method uses the update-ended interrupt enable (UIE) bit in
RTCINTEN. If the update-ended interrupt is enabled, an interrupt occurs
after every update cycle. When the interrupt occurs, the update flag (UF)
is set, indicating that an update has just been completed.
- The second method uses the update-in-progress (UIP) bit in the periodic
interrupt selection register (RTCPINTR) to determine if the update cycle
is in progress. When UIP goes high, an update occurs within 244 µs.
When UIP returns low again, the update has been completed.
01−12 This BCD value sets the hour of the current time in conjunction with the
AMPM bit. For AM, AMPM bit must be cleared to 0; for PM, AMPM bit
must be set to 1.
00−23 This BCD value sets the hour of the current time. The AMPM bit must be
cleared to 0.
6−0 HAR Hours alarm select bits. This BCD value sets the hour of the alarm time.
When bits 7 and 6 are set to 1, a “don’t care” condition is set and the RTC
generates an interrupt every hour.
01−12 This BCD value sets the hour of the alarm time in conjunction with the
AMPM bit. For AM, AMPM bit must be cleared to 0; for PM, AMPM bit
must be set to 1.
00−23 This BCD value sets the hour of the alarm time. The AMPM bit must be
cleared to 0.
Table 13. Day of the Week and Day Alarm Register (RTCDAYW) Field Values
BCD
Bit Field Value Description
7−4 DAR 1−7 Day-of-the-week alarm select bits. This BCD value sets the
day-of-the-week alarm (Sunday = 1).
When bit 7 is set to 1 (values 1000b-1111b), a “don’t care” condition is
set and the RTC generates an interrupt every day.
2−0 DAY 1−7 Day-of-the-week select bits. This BCD value sets the current day of the
week (Sunday = 1).
Table 14. Day of the Month (Date) Register (RTCDAYM) Field Values
BCD
Bit Field Value Description
7−0 DATE 01−31 Date select bits. This BCD value sets the date of the calendar.
Table 17. Periodic Interrupt Selection Register (RTCPINTR) Field Values (Continued)
Bit Field Value Description
4−0 RATE Periodic interrupt rate select bits.
00000 No interrupt.
00001 Reserved.
00010 Reserved.
7 6 5 4 3 2 1 0
SET PIE AIE UIE Reserved TM Reserved
R/W−U R/W−0 R/W−0 R/W−0 R−0 R/W−U R−0
7 SET SET bit isolates or connects the write and read buffers from the time,
calendar, and alarm registers. The SET bit is a read/write bit that is not
affected by the DSP RESET signal.
0 The write and read buffers are connected to the time, calendar, and
alarm registers.
1 The write and read buffers are isolated from the time, calendar, and
alarm registers so that a read or write operation can be executed
independent of the update cycle.
6 PIE Periodic interrupt enable bit allows the periodic interrupt flag (PF) bit in
the interrupt flag register (RTCINTFL) to cause an RTC interrupt to the
DSP CPU. The PIE bit is a read/write bit that is cleared by a DSP reset.
5 AIE Alarm interrupt enable (AIE) bit allows the alarm interrupt flag (AF) bit in
the interrupt flag register (RTCINTFL) to cause an RTC interrupt to the
DSP CPU. The AIE bit is a read/write bit that is cleared by a DSP reset.
4 UIE Update-ended interrupt enable (UIE) bit allows the update-ended flag
(UF) bit in the interrupt flag register (RTCINTFL) to cause an RTC
interrupt to the DSP CPU. The UIE bit is a read/write bit that is cleared
by a DSP reset.
1 TM Time mode bit indicates whether the hour byte is in 24-hour mode or
12-hour mode. The TM bit is a read/write bit that is not affected by a DSP
reset.
0 12-hour mode.
1 24-hour mode.
1 One or more of the interrupt flags and the corresponding enables are set.
Any time the IRQF bit is set, an RTC interrupt request is sent to the DSP
CPU. To clear an interrupt flag, write a 1 to the interrupt flag bit that
caused the interrupt.
1 Periodic interrupt has occurred. The PF bit can only be set if the PIE bit
in the interrupt enable register (RTCINTEN) is also set (enabled). The
PF bit is cleared by a DSP reset or by writing a 1 into this bit.
1 Alarm interrupt has occurred. The AF bit can only be set if the AIE bit in
the interrupt enable register (RTCINTEN) is also set (enabled). The AF
bit is cleared by a DSP reset or by writing a 1 into this bit.
1 Update-ended interrupt has occurred. The UF bit can only be set if the
UIE bit in the interrupt enable register (RTCINTEN) is also set (enabled).
The UF bit is cleared by a DSP reset or by writing a 1 into this bit.
Revision History
The scope of this revision was limited to adding support for the
TMS320VC5503/5507 devices, and some minor edits.
Page Additions/Modifications/Deletions
Index
E M
emulation modes 26 minutes alarm 19
minutes alarm register (RTCMINA) 29
minutes alarm select bits (MAR) 29
F minutes register (RTCMIN) 28
minutes select bits (MIN) 28
figure of real-time clock 12
month register (RTCMONTH) 33
month select bits (MONTH) 33
H
HAR bits of RTCHOURA
P
described in table 31
periodic interrupt enable bit (PIE)
shown in figure 30
described in table 36
hours alarm 19 shown in figure 35
hours alarm register (RTCHOURA) 30 periodic interrupt flag bit (PF)
hours alarm select bits (HAR) described in table 37
described in table 31 shown in figure 37
shown in figure 30 periodic interrupt rate select bits (RATE)
hours register (RTCHOUR) 29 described in table 35
shown in figure 34
hours select bits (HR)
described in table 30 periodic interrupt rates 23
shown in figure 29 periodic interrupt request 22
periodic interrupt selection register
(RTCPINTR) 34
I PF bit of RTCINTFL
described in table 37
interrupt enable and flag bits 21 shown in figure 37
interrupt enable register (RTCINTEN) 35 PIE bit of RTCINTEN
described in table 36
interrupt flag register (RTCINTFL) 37
shown in figure 35
interrupt rate select bits (RATE)
power considerations 26
described in table 35
shown in figure 34 power supply 13
interrupt rates, periodic 23
interrupt registers 34
interrupt request status flag bit (IRQF)
R
described in table 37 RATE bits of RTCPINTR
shown in figure 37 described in table 35
interrupt requests 21 shown in figure 34
introduction to real-time clock 11 reading time/calendar
IRQF bit of RTCINTFL using SET bit 16
described in table 37 without using SET bit 17
shown in figure 37 reference clock source 13
registers time/calendar
descriptions 27 data format 14
using time/calendar alarm registers 18 how to set 16
using time/calendar registers 14 registers, using 14
reset, effects on real-time clock 26 time/calendar alarm
RTCDAYM 32 data format 18
example settings 20
RTCDAYW 32
registers, reading/writing 20
RTCHOUR 29 using 18
RTCHOURA 30 TM bit of RTCINTEN
RTCINTEN 35 described in table 36
RTCINTFL 37 shown in figure 35
RTCMIN 28
RTCMINA 29 U
RTCMONTH 33
RTCPINTR 34 UF bit of RTCINTFL
described in table 37
RTCSEC 27 shown in figure 37
RTCSECA 28 UIE bit of RTCINTEN
RTCYEAR 33 described in table 36
shown in figure 35
T
Y
time mode bit (TM)
described in table 36 year register (RTCYEAR) 33
shown in figure 35 year select bits (YEAR) 33