No part of this material may be reproduced or duplicated in any form or by any means without the written permission of Seiko
Epson. Seiko Epson reserves the right to make changes to this material without notice. Seiko Epson does not assume any liability
of any kind arising out of any inaccuracies contained in this material or due to its application or use in any product or circuit and,
further, there is no representation that this material is applicable to products requiring high level reliability, such as, medical products. Moreover, no license to any intellectual property rights is granted by implication or otherwise, and there is no representation
or warranty that anything made in accordance with this material will be free from any patent or copyright infringement of a third
party. When exporting the products or technology described in this material, you should comply with the applicable export control
laws and regulations and follow the procedures required by such laws and regulations. You are requested not to use, to resell, to
export and/or to otherwise dispose of the products (and any technical information furnished, if any) for the development and/or
manufacture of weapon of mass destruction or for other military purposes.
All brands or product names mentioned herein are trademarks and/or registered trademarks of their respective companies.
This is a technical manual for designers and programmers who develop a product using the S1C17F13. This
document describes the functions of the IC, embedded peripheral circuit operations, and their control methods.
For the CPU functions and instructions, refer to the “S1C17 Family S1C17 Core Manual.” For the functions
and operations of the debugging tools, refer to the respective tool
loads” website provides the downloadable manuals.)
manuals. (Our “Products: Document Down-
Notational conventions and symbols in this manual
Register address
Peripheral circuit chapters do not provide control register addresses. Refer to “Peripheral Circuit Area” in
the “Memory and Bus” chapter or “List of Peripheral Circuit Control Registers” in the Appendix.
Register and control bit names
In this
Register table contents and symbols
manual, the register and control bit names are described as shown below to distinguish from signal
and pin names.
XXX register: Represents a register including its all bits.
XXX.YYY bit: Represents the one control bit YYY in the XXX register.
XXX.ZZZ[1:0] bits: Represents the two control bits ZZZ1 and ZZZ0 in the XXX register.
Initial: Value set at initialization
Re
set: Initialization condition. The initialization condition depends on the reset group (H0, H1, or S0).
For more information on the reset groups, refer to “Initialization Conditions (Reset Groups)” in the
“Power Supply, Reset, and Clocks” chapter.
R/W: R = Read only bit
W = Write only bit
WP = Write only bit with a write protection using the MSCPROT.PROT[15:0] bits
R/W = Read/write bit
R/WP = Read/
Control bit read/write values
This manual describes control bit values in a hexadecimal notation except for one-bit values (and except
when decimal or binary notation is required in terms of explanation). The values are described as shown
below according to the control bit width.
1 bit: 0 or 1
2 to 4 bits: 0x0 to 0xf
5 to 8 bits:
9 to 12 bits: 0x000 to 0xfff
13 to 16 bits: 0x0000 to 0xffff
Decimal: 0 to 9999...
Binary: 0b0000... to 0b1111...
Channel number
Multiple channels may be implemented in some peripheral circuits (e.g., 16-bit timer, etc.). The peripheral
circuit chapters use ‘n’ as the value that represents the channel number in the register and pin names regard-
less of the number of channel actually i
If there is a channel that has different functions from others, the channel number is specified clearly.
Example) T16_nCTL register of the 16-bit timer
If one channel is implemented (Ch.0 only): T16_nCTL = T16_0CTL only
If two channels are implemented (Ch.0 and Ch.1): T16_nCTL = T16_0CTL and T16_1CTL
0x00 to 0xff
write bit with a write protection using the MSCPROT.PROT[15:0] bits
mplemented. Normally, the descriptions are applied to all channels.
For the number of channels impl
“Overview” chapter.
ii
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
emented in the peripheral circuits of this IC, refer to “Features” in the
Page 5
CONTENTS
– Contents –
Configuration of product number..............................................................................................i
Preface ..................................................................................................................................... ii
Notational conventions and symbols in this manual ............................................................... ii
The S1C17F13 is an ultra low-power MCU equipped with a display memory and an EPD timing controller to send
display data for using the active EPD panels. This IC includes the synchronous serial interface, parallel interface,
UART, and I
ronmental conditions such as a temperature and humidity
age measurement using the supply voltage detector and brownout reset circuits.
ModelS1C17F13
CPU
CPU coreSeiko Epson original 16-bit RISC CPU core S1C17
Multiplier/Divider (COPRO)16-bit × 16-bit multiplier
OtherOn-chip debugger
Embedded Flash memory
Capacity128K bytes (for both instructions and data) *1
Erase/program count50 times (min.) * Programming by the debugging tool ICDmini
OtherSecurity function
Embedded RAM
Capacity6K bytes (area accessed by CPU only)
Clock generator (CLG)
System clock source5 sources (OSC3B, OSC3A, OSC1B, OSC1A, and EXOSC)
System clock frequency (operating frequency)
OSC3B internal high-speed oscillator circuit
(boot clock source)
OSC1B internal low-speed oscillator circuit 32 kHz (typ.)
OSC3A high-speed oscillator circuit20 MHz (max.) crystal or ceramic oscillator circuit
OSC1A low-speed oscillator circuit32.768 kHz (typ.) crystal oscillator circuit
EXOSC clock input 20 MHz (max.) square or sine wave i
OtherConfigurable system clock division ratio
I/O port (PPORT)
Number of
Number of input interrupt ports8 bits
OtherAll pins contain a pull-up/down re
Display control
EPD timing controller (EPD Tcon)Controls display on the active-matrix EPD via the embedded SPI or PIO.
C to communicate with an EPD panel and other devices. This IC allows measurement of various envi-
measurement using the R/F converter, and a supply volt-
Features1.1
1.1 FeaturesTable 1.
16-bit × 16-bit + 32-bit multiply and accumulation unit
16-bit ÷ 16-bit divider
to protect from reading/programming by ICDmini
nput
(Pins are shared with the peripheral I/O.)
sistor that can be enabled/disabled via software.
ion interface for EPD Tcon
general-purpose I/O
ces
ports37
On-board programming function using ICDmini
Embedded Flash voltage booster to generate the Flash erasing/programming voltage
14K bytes (area accessed by CPU and EPD Tcon)
20 MHz (max.)
20/16/12/8 MHz (typ.) selectable via software
Configurable system clock (except for OSC1A and OSC1B) used at wake up from
SLEEP state
Operating clock frequency for the CPU and all peripheral circuits is selectable.
bits (max.)
16 bits contain an interrupt function and a chattering filter function.
Includes a display data read function from the embedded RAM (area for both CPU
and EPD Tcon).
Can be controlled with the dedicated API library.
IrDA1.0 supported
Embedded baud-rate generator
Configurable as the communication interface for EPD Tcon (SPI Ch.1)
Master and slave operations supported
Embedded baud-rate generator
Data width: 8 bits (max.)
Control signals: #CE, #RD, #WR
Configurable as the communicat
Real-time clock (RTC)Hour, minute, and second counters
Theoretical regulation function (TR)Time adjustment function in -31/32,768 to +32/32,768 second units (applied to T16A3,
16-bit PWM timer (T16A3)2 channels
Supply voltage detector (SVD)
Detection level19 values (1.8 to 3.6 V)
OtherIntermittent operation mode
R/F converter (RFC)
Conversion methodCR oscillation type with 24-bit counters
Numb
er of conversion channels2 channels (Up to four sensors can be connected.)
Supported sensorsDC-bias resistive sensors and AC-bias resistive sensors
Temperature detection circuit (TEM)
Resolution/accuracy1 °C steps, ±5 °C accuracy
Reset
#RESET pinReset when the reset pin is set to low.
Power-on resetReset at power-on.
Brownout resetReset when brownout (V
Key entry resetReset whe
Watchdog timer resetReset when the watchdog timer overflows (can be enabled/disabled using a register).
Supply voltage detector reset
Interrupt
Non-maskable interrupt4 systems (Reset, addres
Programmable interruptExternal interrupt: 1 system (8 levels)
Assigned signal: The signal listed at the top of each pin is assigned in the initial state. The pin function must be
switched via software to assign another signal (see the “I/O Ports” chapter).
I/O: I = Input
O = Output
I/O = Input/output
P = Power supply
A = Analog signal
Hi-Z = High impedance state
Initial state: I (Pull-up) = Input with pulled up
I (Pull-down) = Input with pulled down
Hi-Z = High impedance state
O (H) = High level output
O (L) = Low level output
3.3.1 Pin descriptionTable 1.
Pin/pad
name
Assigned signalI/OInitial state
VDDVDDP––Power supply (+)
V
SSVSSP––GND
V
D1VD1A––
VOSCVOSCA––
VPPVPPP––
C1NC1NA––Capacitor connect pin for Flash voltage booster
C
1PC1PA––Capacitor connect pin for Flash voltage booster
C
1HC1HA––Capacitor connect pin for Flash voltage booster
C
2NC2NA––Capacitor connect pin for Flash voltage booster
C
2PC2PA––Capacitor connect pin for Flash voltage booster
REGMONOTheoretical regulation clock monitor output
RFCLKO1OR/F converter Ch.1 clock monitor output
EXSVDAExternal power supply voltage detection input
P32P32I/OHi-
Z
TOUTB1/CAPB1I/O
PIOA0OParallel interface address output
P33P33I/OHi-Z
TOUTA1/CAPA1I/O
PIOA1OParallel interface address output
P34P34I/OHi-Z
USIN0IUART Ch.0 data input
PIOA2OParallel inter
P35P35I/OHi-Z
USOUT0OUART Ch.0 data output
PIOA3OParallel interface address output
P36P36I/OHi-Z
SCL0I/OI
PIOD0I/OParallel interface data input/output
P37P37I/OHi-Z
SDA0I/OI
PIOD1I/OParallel interface data input/output
P40P40I/OHi-Z
USIN0IU
PIOD2I/OParallel interface data input/output
P41P41I/OHi-Z
USOUT0OUART Ch.0 data output
PIOD3I/OParallel interface data input/output
PD0DST2OO (L)
PD0I/OGeneral-purpose I/O port
PD1DSIOI/OI (pull-up)
PD1I/OGeneral-purpose I/O port
PD2DCLKOO (H)
PD2OGeneral-purpose I/O
Tolerant
fail-safe
structure
✓
✓
✓
✓
✓
✓
✓
✓
–
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
Function
General-purpose I/O port
General-purpose I/O port
General-purpose I/O port
Synchronous serial interface Ch.1 slave select input
General-purpose I/O port
General-purpose I/O port
General-purpose I/O port
General-purpose I/O port
General-purpose I/O port
General-purpose I/O port
General-purpose I/O port
16-bit PWM timer Ch.1 TOUTB signal output/capture B trigger
signal input
General-purpose I/O port
16-bit PWM timer Ch.1 TOUTA signal output/capture A trigger
signal input
General-purpose I/O port
face address output
General-purpose I/O port
General-purpose I/O port
2
C Ch.0 clock input/output
General-purpose I/O port
2
C Ch.0 data input/output
General-purpose I/O port
ART Ch.0 data input
General-purpose I/O port
On-chip debugger status output
On-chip debugger data input/output
On-chip debugger clock output
port
Note: In the peripheral circuit descriptions, the assigned signal name is used as the pin name.
1-8
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 22
2 POWER SUPPLY, RESET, AND CLOCKS
PWG
Internal logic and
high-speed oscillator
circuits
Low-speed
oscillator circuit
VD1
regulator
VDD
VD1
VD1
VSS
VD1ECO
VOSC
regulator
VOSC
VOSC
Flash voltage
booster
C1P
VPP
C1N
C1H
C2P
C2N
Flash memory
CPW1
CPW2
CPW3
CPW4
CPW5
CPW6
VSS
VDD
VSS
VPP
CPW7
Power Supply, Reset, and Clocks2
The power supply, reset, and clocks in this IC are managed by the embedded power generator, system reset controller, and clock generator, respectively.
Power Generator (PWG)2.1
Overview2.1.1
PWG is the power generator that controls the internal power supply system to drive this IC with stability and low
power. The main features of PWG are outlined below.
• Embed
• Embedded V
• Embedded voltage booster for generating the Flash erasing/programming voltage
ded VD1 regulator
- The V
- The V
D1 regulator generates the VD1 voltage to drive internal circuits, this makes it possible to keep current
consumption constant independent of the V
D1 regulator supports two operation modes, normal mode and economy mode, and setting the VD1 regu-
DD voltage level.
lator into economy mode at light loads helps achieve low-power operations.
OSC regulator
- The V
OSC regulator drives the low-speed oscillator circuit in low power consumption and achieves stabilized
low-speed clock that is used for timers such as RTC.
Flash programming power supply
(Leave the pin open during normal operation.)
For the VDD operating voltage range and recommended external parts, refer to “Recommended Operating Conditions, Power supply voltage V
DD” in the “Electrical Characteristics” chapter and the “Basic External Connection
Diagram” chapter, respectively.
V2.1.3 D1 Regulator
The VD1 regulator generates the operating voltage for the internal logic and high-speed oscillator circuits. This
regulator always operates. The V
Setting the V
D1 regulator into economy mode at light loads helps achieve low-power operations. Table 2.1.3.1 lists
examples of light load conditions in which economy mode can be set.
1.3.1 Examples of Light Load Conditions in which Economy Mode Can be Set Table 2.
SLEEP mode (when all oscillators are stopped, or OSC1 only is active) When a clock source except for
HALT mode (when OSC1 only is active)
RUN mode (when OSC1 only is active)
D1 regulator supports two operation modes, normal mode and economy mode.
Light load conditionExceptions
OSC1 is active
The VD1 regulator also supports automatic mode in which the hardware detects a light load condition and automatically switches between normal mode and economy mode. Use the V
D1 regulator in automatic mode when no special
control is required.
V2.1.4 OSC Regulator
The VOSC regulator generates the operating voltage for the low-speed oscillator circuit. This regulator always operates.
Flash Programming Power Supply (V2.1.5 PP)
VPP is the power supply for erasing/programming the embedded Flash memory. The VPP voltage may be applied
from an external power supply to the V
PP pin or internally generated by the embedded Flash voltage booster (con-
trolled from the Flash programming function of the debugger or self-programming module).
For the V
internally, refer to “Recommended Operating Conditions, Flash programming voltage V
age V
Note: Leave the V
PP voltage value to be applied from an external power supply or the VDD requirements for generating VPP
PP and Power supply volt-
DD” in the “Electrical Characteristics” chapter.
PP pin open during normal operation.
System Reset Controller (SRC)2.2
Overview2.2.1
SRC is the system reset controller that resets the internal circuits according to the requests from the reset sources to
archive steady IC operations. The main features of SRC are outlined below.
• Embedded reset hold circuit maintains reset state to boot the system safely while
stable after power on or the oscillation frequency is unstable after the clock source is initiated.
the internal power supply is un-
2-2
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 24
2 POWER SUPPLY, RESET, AND CLOCKS
Reset hold
circuit
SRC
#RESET
Key-entry reset
Watchdog timer reset
Supply voltage detector reset
Software reset 0
Software reset n
Internal reset signals
(Reset group)
SYSRST_H0
SYSRST_H1
SYSRST_S0_0
SYSRST_S0_n
To CPU and peripheral circuits
To CPU and peripheral circuits
To peripheral circuit 0
To peripheral circuit n
Noise filter
Reset
decoder
POR
BOR
Clock generator
Boot clock
OSC3BCLK
Reset request
signals
V
DD
VSS
• Supports reset requests from multiple reset sources.
- #RESET pin
- POR and BOR
- Key-entry reset
- Watchdog timer reset
- Supply voltage detector reset
- Peripheral circuit software reset (supports some peripheral circuits only)
• The CPU registers and peripheral circuit control bits will be reset with an appropriate initialization condition according to changes in status.
Figure 2.2.1.1 shows the SRC
configuration.
2.1.1 SRC ConfigurationFigure 2.
Input Pin2.2.2
Table 2.2.2.1 shows the SRC pin.
2.2.1 SRC PinTable 2.
Pin nameI/OInitial statusFunction
#RESET II (Pull-up)Reset input
The #RESET pin is connected to the noise filter that removes pulses not conforming to the requirements. An internal pull-up resistor is connected to the #RESET pin, so the pin can be left open. For the #RESET pin characteristics, refer to “#RESET pin characteristics” in the “Electrical Characteristics” chapter.
The reset source refers to causes that request system initialization. The following shows the reset sources.
#RESET pin
Inputting a reset signal with a certain low level period to the #RESET pin issues a reset request.
POR and BOR
POR (Power On Reset) issues a reset request when the rise of VDD is detected. BOR (Brownout Reset) issues
a reset request when a certain V
system will be reset properly when the power is turned on and the supply voltage is out of the operating voltage
range. Figure 2.2.3.1 shows an example of POR and BOR internal reset operation according to variations in V
DD voltage level is detected. Reset requests from these circuits ensure that the
DD.
2-3
Page 25
2 POWER SUPPLY, RESET, AND CLOCKS
Internal state
VRST-: Reset detection voltageVRST+: Reset canceling voltageIndefinite (operating limit)RESET stateCPU RUN state
XRSTRU N
VDD
VSS
VRST-VRST-VRST-
VRST+
VRST+
XXXRSTRSTRSTRSTRU NRU NRUN
2.3.1 Example of Internal Reset by POR and BORFigure 2.
For the POR and BOR electrical specifications, refer to “POR/BOR characteristics” in the “Electrical Charac-
teristics” chapter.
Key-entry reset
Inputting a low level signal of a certain period to the I/O port pins configured to a reset input issues a reset re-
quest. This function must be enabled using an I/O port register. For more informatio
n, refer to the “I/O Ports”
chapter.
Watchdog timer reset
Setting the watchdog timer into reset mode will issue a reset request when the counter overflows. This helps return the runaway CPU to a normal operating state. For more information, refer to the “Watchdog timer” chapter.
Supply voltage detector reset
By enabling the low power supply voltage detection reset function, the supply voltage detector will issue a reset
request when a drop in the power supply voltage is detected. This makes it possible to put the system into reset
state if the IC must be stopped under a low voltage condition. For more information, refer to the “Supply Voltage Detector” chapter.
Peripheral circuit software reset
Some peripheral circuits provide a control bit for software reset (MODEN or SFTRST). Setting this bit initial-
izes the peripheral circuit control bits. Note, however, that the software reset operations depend on the peripheral circuit. For more information, refer to “Control Registers” in each peripheral circuit chapter.
Note: The MODEN bit of some peripheral circuits does not issue software reset.
Initialization Conditions (Reset Groups)2.2.4
A different initialization condition is set for the CPU registers and peripheral circuit control bits, individually. The
reset group refers to an initialization condition. Initialization is performed when a reset source included in a reset
group issues a reset request. Table 2.2.4.1 lists the reset groups. For the reset group to initialize the registers and
control bits, refer to the “CPU and Debugger” chapter or “Control Registers” in each periph
2.4.1 List of Reset GroupsTable 2.
Reset groupReset sourceReset cancelation timing
H0#RESET pin
POR and BOR
Supply voltage detector reset
Key-entry reset
Watchdog timer reset
H1#RESET pin
POR and BOR
S0Peripheral circuit software reset
(MODEN and SFTRST bits. The
software reset operations depend on the peripheral circuit.
Reset state is maintained for the reset
hold time t
canceled.
Reset state is canceled imme
after the reset request is canceled.
RSTR after the reset request is
eral circuit chapter.
diately
2-4
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 26
2 POWER SUPPLY, RESET, AND CLOCKS
CLG
Internal data bus
OSC1BCLK
SYSCLK
SLEEP, WAKEUP
OSC1
OSC2
EXOSC
FOUT
OSC1ENOSC1SEL
CLKSRC[1:0]
CLKDIV[1:0]
WUPMD
CLKSRC[x:0]
CLKDIV[x:0]
WUPSRC[1:0]
WUPDIV[1:0]
FOUTDIV[2:0]
OSC1B
oscillator
circuit
Divider
Clock
selector
System
clock
controller
OSC1ACLK
F1 (1 [Hz])
F256 (1/256 [Hz])
OSC1CLK
X’tal1
OSC3BCLK
OSC3BEN
OSC3B
oscillator
circuit
OSC1A
oscillator
circuit
Divider
OSC3ACLK
OSC3AEN
OSC3A
oscillator
circuit
Divider
Divider
EXOSCCLK
EXOSCEN
EXOSC
clock input
circuit
FOUTEN
EXOSC
clock input
circuit
Clock
selector
Peripheral circuit 1
CLKSRC[x:0]
CLKDIV[x:0]
Clock
selector
Peripheral circuit n
To CPU and bu s
To some
p
eripheral circuits
OSC3
OSC4
X’tal3/Ceramic3
Theoretical regulationRTC reset
Clock Generator (CLG)2.3
Overview2.3.1
CLG is the clock generator that controls the clock sources and manages clock supply to the CPU and the peripheral
circuits. The main features of CLG are outlined below.
• Supports multiple clock sources.
- OSC3B oscillator circuit that oscillates with a fast startup and no external parts required
- Low-power OSC1B oscillator circuit that oscillates with no ext
- High-precision and low-power OSC1A oscillator circuit that uses a 32.768 kHz crystal resonator
- OSC3A oscillator circuit that supports high-speed crystal and ceramic resonators up to 20 MHz
- EXOSC clock input circuit that allows input of square wave and sine wave clock signals
• The system clock (SYSCLK), which is used as the operating clock for the CPU and bus, and the periph
cuit operating clocks can be configured individually by selecting the suitable clock source and division ratio.
• OSC3BCLK output from the OSC3B oscillator circuit is used as the boot clock for fast booting.
• Controls the oscillator and clock input circuits to enable/disable according to the operating mode, RUN or
SLEEP mode.
• Provides a flexible system clock switching function at SLEEP mo
- The clock sources to be stopped in SLEEP mode can be selected.
- SYSCLK to be used at SLEEP mode cancelation can be selected from all clock sources (OSC3B, OSC3A,
and EXOSC).
- The oscillator and clock input circuit on/off state can be maintained or changed at SLEEP mode cancelation.
• Provides the FOUT function to output an internal clock for driving external ICs or for monitoring t
state.
* Indicates the status when the pin is configured for CLG.
If the port is shared with the CLG input/output function and other functions, the CLG function must be assigned to
the port. For more information, refer to the “I/O Ports” chapter.
Clock Sources2.3.3
OSC3B oscillator circuit
The OSC3B oscillator circuit features a fast startup and no external parts are required for oscillating. Figure
2.3.3.1 shows the configuration of the OSC3B oscillator circuit.
The OSC3B oscillator circuit output clock OSC3BCLK is used as SYSCLK at booting.
The OSC3BCLK frequency can be selected using the CLGOSC3B.OSC3BFREQ[1:0] bits.
For more information on the oscillation characteristics, refer to “OSC3B oscillator circuit characteristics” in the
“Electrical Characteristics” chapter.
OSC3A oscillator circuit
The OSC3A oscillator circuit is a high-speed oscillator circuit that uses a crystal or ceramic resonator. Figure
2.3.3.2 shows the configuration of the OSC3A oscillator circuit.
A crystal resonator (X’tal3) or ceramic resonator (Ceramic3) should be connected between the OSC3 and OSC4
pins. Additionally, two capacitors (C
The embedded gain-controlled oscillation inverter allows selection of the resonator from a wide frequency range.
For the recommended
chapter and “OSC3A oscillator circuit characteristics” in the “Electrical Characteristics” chapter, respectively.
2-6
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
parts and the oscillation characteristics, refer to the “Basic External Connection Diagram”
G3 and CD3) should be connected between the OSC3/OSC4 pins and VSS.
Page 28
2 POWER SUPPLY, RESET, AND CLOCKS
OSC1A oscillator circuit
OSC1 oscillator circuit
External gate
capacitor C
G1
Internal
gate capacitor C
GI1
Feedback
resistor R
F1
Drain
resistor R
D1
External drain
capacitor C
D1
Internal
drain capacitor C
DI1
V
SS
V
SS
OSC1EN
Oscillation
stabilization
waiting circuit
Interrupt
control circuit
OSC1WT[1:0]
OSC1WT[1:0]
OSC1
OSC2
X’tal1
OSC1STAIE
OSC1STAIF
Interrupt
controller
OSC1CLK
Internal data bus
OSC1B oscillator circuit
Clock
oscillator
Oscillation
stabilization
waiting circuit
OSC1BCLK
OSC1ACLK
OSC1SEL
Regulated
clock
generation
V
SS
V
DD
V
DD
V
SS
EXOSC clock
input circuit
Input control
circuit
EXOSCEN
EXOSC
EXOSCCLK
Internal data bus
OSC1 oscillator circuit
OSC1 is a low-power oscillator circuit that generates the timer operating clock and the system clock for low-
speed operations. The OSC1 oscillator circuit consists of two oscillators, OSC1A and OSC1B, and the oscillator to be used should be selected using the CLGOSC1.OSC1SEL bit. Figure 2.3.3.3 shows the configuration of
the OSC1 oscillator circuit.
The OSC1A oscillator circuit is a high-precision and low-power oscillator circuit that uses a 32.768 kHz
crystal resonator. A crystal resonator (X’tal1) should be connected between the OSC1 and OSC2 pins. Additionally, two capacitors (C
the recomme
nded parts and the oscillation characteristics, refer to the “Basic External Connection Dia-
G1 and CD1) should be connected between the OSC1/OSC2 pins and VSS. For
gram” chapter and “OSC1A oscillator circuit characteristics” in the “Electrical Characteristics” chapter,
respectively.
OSC1B oscillator circuit
The OSC1B oscillator circuit generates about 32 kHz clock without external components.
EXOSC clock input
EXOSC is an external clock input circuit that supports square wave and sine wave clocks. Figure 2.3.3.4 shows
the configuration of the EXOSC clock input circuit.
EXOSC has no oscillation stabilization waiting circuit included, therefore, it must be enabled when a stabilized
clock is being supplied. For the input clock characteristics, refer to “EXOSC external clock input characteristics” in the “Electrical Characteristics” chapter.
Oscillation start time and oscillation stabilization waiting time
The oscillation start time refers to the time after the oscillator circuit is enabled until the oscillation signal is ac-
tually sent to the internal circuits. The oscillation stabilization waiting time refers to the time it takes the clock
to stabilize after the oscillation starts. To avoid malfunctions of the inter
during this period, the oscillator circuit includes an oscillation stabilization waiting circuit that can disable supplying the clock to the system until the designated time has elapsed. Figure 2.3.4.1 shows the relationship between the oscillation start time and the oscillation stabilization waiting time.
3.4.1 Oscillation Start Time and Oscillation Stabilization Waiting TimeFigure 2.
nal circuits due to an unstable clock
The oscillation stabilization waiting times for the OSC1 (OSC1A and OSC1B) and OSC3A oscillator circuits
can be set using the CLGOSC1.OSC1WT[1:0] and CLGOSC3A.OSC3AWT[1:0] bits, respectively. Allow an
ample margin for the setting value according to the resonator type used. To check whether the oscillation stabiliza
tion waiting time is set properly and the clock is stabilized immediately after the oscillation starts or not,
monitor the oscillation clock using the FOUT output function. The oscillation stabilization waiting time for the
OSC3B oscillator circuit is fixed at 128 OSC3BCLK clocks.
When the oscillation stabilization waiting operation has completed, the oscillator circuit sets the oscillation sta-
bi
lization waiting completion flag and starts clock supply to the internal circuits.
Note: The oscillation stabilization waiting time is always expended at start of oscillation even if the os-
cillation stabilization waiting completion flag has not be cleared to 0.
Oscillation start procedure for the OSC3B oscillator circuit
Follow the procedure shown below to start oscillation of the OSC3B oscillator circuit.
1. Write 1 to the CLGINTF.OSC3BSTAIF bit. (Clear interrupt flag)
2. Write 1 to the CLGINTE.OSC3BSTAIE bit. (Enable interrupt)
3. Write 0x0096 to the MSCPROT.PROT[15:0] bits. (Remove system protection)
4. Configure the CLGOSC3B.OSC3BFREQ bit. (Select frequency)
5. Write a value other than 0x0096 to the MSCPROT.PROT[15:0] bits. (Set system protection)
6. Write 1 to the CLGOSC.OSC3BEN bit. (Start osc
7. OSC3BCLK can be used if the CLGINTF.OSC3BSTAIF bit = 1 after an interrupt occurs.
Oscillation start procedure for the OSC3A oscillator circuit
Follow the procedure shown below to start oscillation of the OSC3A oscillator circuit.
2-8
(Rev. 1.0)
1. Write 1 to the CLGINTF.OSC3ASTAIF bit. (Clear interrupt flag)
2. Write 1 to the CLGINTE.OSC3ASTAIE bit. (Enable interrupt)
3. Write 0x0096 to the MSCPROT.PROT[
4. Configure the following CLGOSC3A register bits according to the resonator used.
- Set the CLGOSC1.OSC1SEL bit to 1. (Select OSC1B)
5. Write a value other than 0x0096 to the MSCPROT.PROT[15:0] bits. (Set system protection)
6. Write 1 to the CLGOSC.OSC1EN bit. (Start oscillation)
7. OSC1CLK can be used if the CLGINTF.OSC1STAIF bit = 1 after an interrupt occurs.
Oscillation start procedure for the OSC1A oscillator circuit
Follow the procedure shown below to start oscillation of the OSC1A oscillator circuit.
1. Write 1 to the CLGINTF.OSC1STAIF bit. (Clear interrupt flag)
2. Write 1 to the CLGINTE.OSC1STAIE bit. (Enable interrupt)
3. Write 0x0096 to the MSCPROT.PROT[15:0] bits. (Remove system protection)
4. Configure the following CLGOSC1 register bits according to the resonator used:
- CLGOSC1.OSC1WT[1:0] bits (Set oscillation
- Set the CLGOSC1.OSC1SEL bit to 0. (Select OSC1A)
5. Write a value other than 0x0096 to the MSCPROT.PROT[15:0] bits. (Set system protection)
6. Write 1 to the CLGOSC.OSC1EN bit. (Start oscillation)
7. OSC1CLK can be used if the CLGINTF.OSC1STAIF bit = 1 after an interrupt occurs.
stabilization waiting time)
The setting value of the CLGOSC1.OSC1WT[1:0] bits should be determined after performing evalua
tion using
the populated circuit board.
System clock switching
The CPU boots using OSC3BCLK as SYSCLK. After booting, the clock source of SYSCLK can be switched
according to the processing speed required
. The SYSCLK frequency can also be set by selecting the clock
source division ratio, this makes it possible to run the CPU at the most suitable performance for the process to
be executed. The CLGSCL
K.CLKSRC[1:0] and CLGSCLK.CLKDIV[1:0] bits are used for this control. The
CLGSCLK register bits are protected against writings by the system protect function, therefore, the system protection must be removed by writing 0x0096 to the MSCPROT.PROT[15:0] bits before the register setting can
be altered. For the transition between the operating modes including the system clock switching, refer to “Ope
r-
ating Mode.”
Clock control in SLEEP mode
The CPU enters SLEEP mode when it executes the slp instruction. Whether the clock sources being operated
are stopped or not at this point can be selected in each source individually. This allows the CPU to fast switch
between SLEEP mode and RUN mode, and the peripheral circuits to continue operating without disabling the
clock in SLEEP mode. The CLGOSC.OSC
CLGOSC.EXOSCSLPC bits are used for this control. Figure 2.3.4.2 shows a control example.
3.4.2 Clock Control Example in SLEEP ModeFigure 2.
The SYSCLK condition (clock source and division ratio) at wake-up from SLEEP mode to RUN mode can also
be configured. This allows flexible clock control according to the wake-up process. Configure the clock using
the CLGSCLK.WUPSRC[1:0] and CLGSCLK.WUPDIV[1:0] bits, and write 1 to the CLGSCLK.WUPMD bit
to enable this function.
3.4.3 Clock Control Example at SLEEP CancelationFigure 2.
Note: When OSC1 (OSC1A or OSC1B) is configured to stop in SLEEP mode (CLGOSC.OSC1SLPC
bit = 1), executing the slp instruction while a timer is running with OSC1 as the clock source will
destabilize the timer operation at restarting from SLEEP mode. When switching to SLEEP mode
with CLGOSC.OSC1SLPC bit set to 1, stop the timer before executing
not necessary to stop the timer when OSC1 is configured to operate in SLEEP mode.
Clock external output (FOUT)
The FOUT pin can output the clock generated by a clock source or its divided clock to outside the IC. This al-
lows monitoring the oscillation frequency of the oscillator circuit or supplying an operating clock to external
ICs. Follow the procedure shown below to
1. Assign the FOUT function to the port. (Refer to the “I/O Ports” chapter.)
Figure 2.4.1.1 shows the initial boot sequence after power is turned on.
4.1.1 Initial Boot SequenceFigure 2.
Note: The reset cancelation time at power-on varies according to the power rise time and reset request
cancelation time.
For the reset hold time t
Transition between Operating Modes2.4.2
State transitions between operating modes shown in Figure 2.4.2.1 take place in this IC.
RUN mode
RUN mode refers to the state in which the CPU is executing the program. A transition to this mode takes place
when the system reset request from the system reset controller is canceled. RUN mode is classified into “OSC3B
RUN,” “OSC1 RUN,” “OSC3A RUN,” and “EXOSC RUN” by the SYSCLK clock source.
HALT mode
When the CPU executes the halt instruction, it suspends program execution and stops operating. This state is
HALT mode. In this mode, the clock sources and peripheral circuits keep operating. This mode can be set while
no software processing is required and it reduces power consumption as compared with RUN mode. HALT
mode is classified into “OSC3B HALT,” “OSC1 HALT,” “OSC3A HALT,” and “EXOSC HALT” by the SYSCLK clock source.
SLEEP mode
When the CPU executes the slp instruction, it suspends program execution and stops operating. This state is
SLEEP mode. In this mode, the clock sources stop operating as well. However, the clock source in which the
CLGOSC.OSC3BSLPC/OSC1SLPC/OSC3ASLPC/EXOSCSLPC bit is set to 0 keeps operating, so the peripheral circuits with the clock being supplied can also operate. By setting this mode when no software processing
and peripheral circuit
Note: The current consumption when a clock source is active in SLEEP mode by setting the CLGOSC.
OSC3BSLPC/OSC1SLPC/OSC3ASLPC/EXOSCSLPC bit to 0 is equivalent to the value in HALT
mode with the same clock source condition (refer to “Current Consumption, Current consumption in HALT mode I
DEBUG mode
When a debug interrupt occurs, the CPU enters DEBUG mode. DEBUG mode is canceled when the retd in-
struction is executed. For more information on DEBUG mode, refer to “Debugger” in the “CPU and Debugger”
chapter.
When the OSC3B oscillation stabilization waiting
operation has completed after the oscillation starts
When the OSC1 oscillation stabilization waiting operation has completed after the oscillation starts
When the OSC3A oscillation stabilization waiting
operation has completed after the oscillation starts
Writing 1
Writ
ing 1
Writing 1
2-12
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 34
2 POWER SUPPLY, RESET, AND CLOCKS
CLG provides interrupt enable bits corresponding to each interrupt flag. An interrupt request is sent to the interrupt
controller only when the interrupt flag, of which interrupt has been enabled by the interrupt enable bit, is set. For
more information on interrupt control, refer to the “Interrupt Controller” chapter.
Control Registers2.6
PWG VD1 Regulator Control Register
Register nameBitBit nameInitialResetR/WRemarks
PWGVD1CTL15–8 –0x00–R–
7–2 –0x00–R
1–0 REGMODE[1:0]0x0H0R/WP
Bits 15–2 Reserved
Bits 1–0 REGMODE[1:0]
These bits control the internal regulator operating mode.
This bit enables the SYSCLK switching function at wake-up.
1 (R/WP): Enable
0 (R/WP): Disable
When the CLGSCLK.WUPMD bit = 1, setting values of the CLGSCLK.WUPSRC[1:0] bits and the
CLGSCLK.WUPDIV[1:0] bits are loaded to the CLGSCLK.CLKSRC[1:0] bit
CLKDIV[1:0] bits, respectively, at wake-up from SLEEP mode to switch SYSCLK. When the CLGSCLK.WUPMD bit = 0, the CLGSCLK.CLKSRC[1:0] and CLGSCLK.CLKDIV[1:0] bits are not
altered at wake-up.
Note: When the CLGSCLK.WUPMD bit = 1, the clock source enable bits (CLGOSC.EXOSCEN, CL-
GOSC.OSC3AEN, CLGOSC.OSC1EN, CLGOSC.OSC3BEN) except for the SYSCLK source
selected by the CLGSCLK.CLKSRC[1:0] bits wil
l be cleared to 0 to stop the clocks after a
system wake-up. However, the enable bit of the clock source being operated during SLEEP
mode by setting the CLGOSC.****SLPC bit retains 1 after a wake-up.
Bit 14 Reserved
s and the CLGSCLK.
Bits 13–12 WUPDIV[1:0]
These bits select the SYSCLK division ratio for resetting the CLGSCLK.CLKDIV[1:0] bits at wake-up.
This setting is ineffective when the CLGSCLK.WUPMD bit = 0.
These bits select the SYSCLK clock source for resetting the CLGSCLK.CLKSRC[1:0] bits at wake-up.
When a currently stopped clock source is selected, it will automatically start oscillating or clock input
at wake-up. However, this setting is ineffective when the CLGSCLK.WUPMD bit = 0.
6.2 SYSCLK Clock Source and Division Ratio Settings at Wake-upTable 2.
2OSC3ASTAIF0H0R/WCleared by writing 1.
1OSC1STAIF0H0R/W
0OSC3BSTAIF0H0R/W
Bits 15–3 Reserved
Bit 2 OSC3ASTAIF
Bit 1 OSC1STAIF
Bit 0 OSC3BSTAIF
These bits indicate the oscillation stabilization waiting completion interrupt cause occurrence status in
each clock source.
1 (R): Cause of interrupt occurred
0 (R): No cause of interrupt occurred
1 (W): Clear flag
0 (W): Ineffective
2-16
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 38
2 POWER SUPPLY, RESET, AND CLOCKS
Each bit corresponds to the clock source as follows:
CLGINTF.OSC3ASTAIF bit: OSC3A oscillator circuit
CLGINTF.OSC1STAIF bit: OSC1 oscillator circuit
CLGINTF.OSC3BSTAIF bit: OSC3B oscillator circuit
Note: The CLGINTF.OSC3BSTAIF bit is 0 after system reset is canceled, but OSC3BCLK has al-
These bits enable the oscillation stabilization waiting completion interrupt of each clock source.
1 (R/W): Enable interrupts
0 (R/W): Disable interrupts
Each bit corresponds to the clock source as follows:
CLGINTE.OSC3ASTAIE bit: OSC3A oscillator circuit
CLGINTE.OSC1STAIE bit: OSC1 oscillator circuit
CLGINTE.OSC3BS
The CPU includes eight general-purpose registers and three special registers (Table 3.2.1.1).
2.1.1 Initialization of CPU RegistersTable 3.
CPU register nameInitialReset
General-purpose registersR0 to R70x000000H0
Special
registers
For details on the CPU registers, refer to the “S1C17 Family S1C17 Core Manual.” For more information on the
reset vector, refer to the “Interrupt Controller” chapter.
The CPU instruction codes are all fixed to 16 bits in length which, combined with pipelined processing, allows the
most important instructions to be executed in one cycle. For details on the instructions, refer to the “S1C17 Family
S1C17 Core Manual.”
Program counterPCThe reset vector is automatically loaded.H0
Stack pointerSP0x000000H0
Processor status register PSR0x00H0
Instruction Set3.2.2
Reading PSR3.2.3
The PSR contents can be read through the MSCPSR register. Note, however, that data cannot be written to PSR
through the MSCPSR registe
r.
I/O Area Reserved for the S1C17 Core3.2.4
The address range from 0xfffc00 to 0xffffff is the I/O area reserved for the S1C17 core. Do not access this area except when it is required.
Debugger3.3
Debugging Functions3.3.1
The debugger provides the following functions:
• Instruction break: A debug interrupt is generated immediately before the set instruction address is executed. An
instruction br
• Single step: A debug interrupt is generated after each instruction has been executed.
• Forcible break: A debug interrupt is generated using an external input signal.
• Software break: A debug interrupt is generated when the brk instruction is executed.
When a debug interrupt occurs, the CPU enters DEBUG mode. The peripheral circuit operations in DEBUG mode
de
pend on the setting of the DBRUN bit provided in the clock control register of each peripheral circuit. For more
information on the DBRUN bit, refer to “Clock Supply in DEBUG Mode” in each peripheral circuit chapter. DEBUG mode continues until a cancel command is sent from the personal computer or the CPU executes the retd instruction. Neither hardware interrupts nor NMI are accepted during DEBU
eak can be set at up to four addresses.
G mode.
Resource Requirements and Debugging Tools3.3.2
Debugging work area
Debugging requires a 64-byte debugging work area. For more information on the work area location, refer to
the “Memory and Bus” chapter. The start address of this debugging work area can be read from the DBRAM
register.
3-2
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 42
3 CPU AND DEBUGGER
DCLK
DSIO
DST2
DCLK
DSIO
DST2
VDD
ICDmini
(S5U1C17001H)
S1C17
R
DBG
Debugging tools
To perform debugging, connect ICDmini (S5U1C17001H) to the input/output pin for the debugger embedded
in this IC and control it from the personal computer. This requires the tools shown below.
• S1C17 Family In-Circuit Debugger ICDmini (S5U1C17001H)
• S1C17 Family C Compiler Package (e.g., S5U1C17001C)
List of debugger input/output pins3.3.3
Table 3.3.3.1 lists the debug pins.
3.3.1 List of Debug PinsTable 3.
Pin nameI/OInitial stateFunction
DCLKOOOn-chip debugger clock output pin
Outputs a clock to the ICDmini (S5U1C17001H).
DSIOI/OIOn-chip debugger data input/output pin
Used to input/output debugging data and input the break signal.
DST2OOOn-chip debugger status output pin
Outputs the processor status during debugging.
The debugger input/output pins are shared with general-purpose I/O ports and are initially set as the debug pins. If
the debugging function is not used, these pins can be switched to general-purpose I/O port pins. For details, refer to
the “I/O Ports” chapter.
External Connection3.3.4
Figure 3.3.4.1 shows a connection example between this IC and ICDmini when performing debugging.
3.4.1 External ConnectionFigure 3.
For the recommended pull-up resistor value, refer to “Recommended Operating Conditions, DSIO pull-up resistor R
DBG” in the “Electrical Characteristics” chapter. RDBG is not required when using the DSIO pin as a general-
The value (0 or 1) of the PSR C (carry) flag can be read out with this bit.
Bit 2 PSRV
The value (0 or 1) of the PSR V (overflow) flag can be read out with this bit.
Bit 1 PSRZ
The value (0 or 1) of the PSR Z (zero) flag can be read out with this bit.
Bit 0 PSRN
The value (0 or 1) of the PSR N (negative) flag can be read out with this bit.
Debug RAM Base Register
Register nameBitBit nameInitialResetR/WRemarks
DBRAM31–24 –0x00–R–
23–0 DBRAM[23:0]*1H0R
*1 Debugging work area start address
Bits 31–24 Reserved
Bits 23–0 DBRAM[23:0]
The start address of the debugging work area (64 bytes) can be read out with these bits.
3-4
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 44
Memory and Bus4
Overview4.1
This IC supports up to 16M bytes of accessible memory space for both instructions and data.
The features are listed below.
• Embedded Flash memory that supports on-board programming
• Almost all memory and control registers are accessible in 16-bit width and one cycle.
• Write-protect function to protect system control registers
Figure 4.1.1 shows the memory map.
0xff ffff
0xff ff80
0xff ff7f
0x08 3800
0x08 37ff
0x08 0000
0x07 ffff
0x02 8000
0x02 7fff
Reserved for core I/O area (1K bytes)
(Device size: 32 bits)
Reserved
RAM area 2 (14K bytes)
(Device size: 32 bits)
Reserved
*1
*1
4 MEMORY AND BUS
Flash area (128K bytes)
(Device size: 16 bits)
0x00 8000
0x00 7fff
0x00 6000
0x00 5fff
Peripheral circuit area (8K bytes)
0x00 4000
0x00 3fff
0x00 1000
0x00 17ff
0x00 17c0
0x00 17bf
0x00 0000
*1 RAM area 2 is a shared area for the CPU and EPD timing controller, and
CPU access cycle (two-cycle access) if this area is accessed from both simultaneously.
Debug RAM area (64 bytes)
Reserved
(Device size: 16 bits)
Reserved
RAM area 1 (6K bytes)
(Device size: 32 bits)
one wait cycle will be inserted to the
1.1 Memory MapFigure 4.
Note: Be sure to avoid data writing operations to the Reserved areas.
Bus Access Cycle4.2
The CPU uses the system clock for bus access operations. First, “Bus access cycle,” “Device size,” and “Access
size” are defined as follows:
• Bus access cycle: On
• Device size: Bit width of the memory and peripheral circuits that can be accessed in one cycle
• Access size: Access size designated by the CPU instructions (e.g., ld %rd, [%rb] → 16-bit data transfer)
e system clock period = 1 cycle
Table 4.2.1 lists numbers of bus access cycles by different device size and access size. The peripheral circuits can
be accessed with an 8-bit, 16-bit, or 32-bit inst
Note: When data is transferred to a memory in 32-bit access, the eight high-order bits are written to
the memory as 0x00 since the bit width of the S1C17 core general-purpose registers is 24 bits.
Conversely when sending from a memory to a register, the eight
high-order bits are ignored.
The CPU performs 32-bit access for stack operations in an interrupt handling. In this case, the
CPU read/write 32-bit data that consists of the PSR value as the eight high-order bits and the
return address as the 24 low-order bits. For more information, refer to the “S1C17 Family S1C17
Core Manual.”
The CPU adopts Harvard architecture that allows simultaneous processin
g of an instruction fetch and a data access. However, they are not performed simultaneously under one of the conditions listed below. This prolongs the
instruction fetch cycle for the number of data area bus cycles.
• When the CPU executes an instruction stored in the Flash area and accesses data in the Flash area
• When the CPU executes an instruction stored in the internal RAM area and accesses d
ata in the internal RAM
area
Flash Memory4.3
The Flash memory is used to store application programs and data. Address 0x8000 in the Flash area is defined as
the vector table base address by default, therefore a vector table must be located beginning from this address. For
more information on the vector table, refer to “Vector Table” in the “Interrupt Controller” chapter.
Flash Bus Access Cycle Setting4.3.1
There is a limit of frequency to access the Flash memory with no wait cycle, therefore, the number of bus access
cycles for reading must be changed according to the system clock frequency. The number of bus access cycles for
reading can be configured using the FLASHCWAIT.RDWAIT[1:0] bits. Select a setting for higher frequency than
the system clock.
Flash Programming4.3.2
The Flash memory supports on-board programming, so it can be programmed with the ROM data by using the debugger through an ICDmini. Figure 4.3.2.1 shows a connection diagram for on-board programming.
3.2.1 External ConnectionFigure 4.
For detailed information on ROM data programming method, refer to the “(S1C17 Family C Compiler Package)
S5U1C17001C Manual.” The IC can also be shipped after being programmed in the factory with the ROM data
developed. Should you desire to ship the IC with ROM data programmed from the factory, please contact our customer support.
4-2
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 46
4 MEMORY AND BUS
Development environment
GNU17 IDE
Factory shipment inspection
process
UserEPSON
file.PA
Mask data file
Specify the unprotecting password.
(6–12 alphanumeric characters (A–Z, a–z, 0–9))
ROM data and password are recorded.
Programming with
ROM data and password
IC with protected Flash
Shipment
Submission
Flash Security Function4.3.3
This IC provides a security function to protect the internal Flash memory from unauthorized reading and tampering
by using the debugger through ICDmini. Figure 4.3.3.1 shows a Flash security function setting flow.
3.3.1 Shipment of IC with ROM Data Programmed and Flash Security Function Setting FlowFigure 4.
The following shows the status of the IC with protected Flash:
• The Flash memory data is undefined if it is read from the debugger.
• An error occurs if an attempt is made to program the Flash memory through ICDmini.
However, the Flash security function can be disabled by entering the unprotecting passwor
d predefined to GNU17
IDE (the security function will take effect again after a reset). For setting the password, refer to the “(S1C17 Family
C Compiler Package) S5U1C17001C Manual.”
Note: Disable the Flash security function before debugging an IC with protected Flash via ICDmini. The
debugging functions may not run normally if the Flash security function is enabled.
RAM14.4
RAM1 can be used to execute the instruction codes copied from another memory as well as storing variables or
other data. This allows higher speed processing and lower power consumption than Flash memory. RAM1 can only
be accessed by the CPU.
Note: The 64 bytes at the end of RAM1 is reserved as the debug RAM area. When using the debug
functions under application development, do not access this area from the application program.
This area can be used for applications of mass-produced devices that do not need debugging.
The RAM1 size used by the application can be configured to equal or less than the implemented size using the
MSCIRAMSZ.IRAMSZ[2:0] bits. For example, this function can be used to prevent creating programs that seek
to access areas outside the RAM area of the target model when developing an application for a
RAM size is smaller than this IC.
After the limitation is applied, accessing an address outside the RAM1 area results
model in which the
in the same operation (undefined value is read out) as when a reserved area is accessed.
RAM24.5
The embedded RAM2 is used to store display data for the EPD. RAM2 allows the EPD timing controller to read
data as well as accesses from the CPU.
The entire RAM2 area
or the area unused for display data can be used as a general-purpose RAM.
The control registers for the peripheral circuits are located in the 8K-byte area beginning with address 0x4000.
Table 4.6.1 shows the control register map. For details of each control register, refer to “List of Peripheral Circuit
Registers” in the Appendix or “Control Registers” in
0 SVDCLKSVD Clock Control Register
0x4102 SVDCTLSVD Control Register
0x4104 SVDINTFSVD Status and Interrupt Flag Register
0x4106 SVDINTESVD Interrupt Enable Register
16-bit timer (T16) Ch.00x4160 T16_0CLKT16 Ch.0 Clock Control Register
0x4162 T16_0MODT16 Ch.0 Mode Register
0x4164 T16_0CTLT16 Ch.0 Control Register
0x4166 T16_0TRT16 Ch.0 Reload Data Register
0x4168 T16_0TCT16 Ch.0 Counter Data Register
0x416a T16_0INT
Flash controller (FLASHC)0x41b0 FLASHCWAITFLASHC Flash Read Cycle Register
I/O ports (PPORT)0x4200 P0DATP0 Port Data Register
0x4202 P0IOENP0 Port Enable Register
0x4204 P0RCTLP0 Port Pull-up/down Control Register
0x4206 P0INTFP0 Port Interrupt Flag Register
0x4208 P0INTCTLP0 Port Interrupt Control Register
0x420a P0CHATENP0 Port
Chattering Filter Enable Register
0x420c P0MODSELP0 Port Mode Select Register
0x420e P0FNCSELP0 Port Function Select Register
0x4210 P1DATP1 Port Data Register
0x4212 P1IOENP1 Port Enable Register
0x4214 P1RCTLP1 Port Pull-up/down Control Register
0x4216 P1INTFP1 Port Interrupt Flag Register
0x4218 P1INTCTLP1 Port Interrupt Control Register
0x421a P1CHATENP1 Port Chattering Filter Enable Register
0x421c P1MODSELP1
Port Mode Select Register
4-4
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 48
4 MEMORY AND BUS
Peripheral circuitAddressRegister name
I/O ports (PPORT)0x421e P1FNCSELP1 Port Function Select Register
0x4220 P2DATP2 Port Data Register
0x4222 P2IOENP2 Port Enable Register
0x4224 P2RCTLP2 Port Pull-up/down Control Register
0x422c P2MODSELP2 Port Mode Select Register
0x422e P2FNCSELP2 Port Function Select Register
0x4230 P3DATP3 Port Data Register
0x4232 P3IOENP3 Port Enable Register
0x4234 P3RCTLP3 Port Pull-up/
down Control Register
0x423c P3MODSELP3 Port Mode Select Register
0x423e P3FNCSELP3 Port Function Select Register
0x4240 P4DATP4 Port Data Register
0x4242 P4IOENP4 Port Enable Register
0x4244 P4RCTLP4 Port Pull-up/down Control Register
0x424c P4MODSELP4 Port Mode Select Register
0x424e P4FNCSELP4 Port Function Select Register
0x42d0 PDDATPd Port Data Register
0x42d2 PDIOENPd Port Enable Register
0x42d4 PDRCTLPd Port
Pull-up/down Control Register
0x42dc PDMODSELPd Port Mode Select Register
0x42de PDFNCSELPd Port Function Select Register
0x42e0 PCLKP Port Clock Control Register
0x42e2 PINTFGRPP Port Interrupt Flag Group Register
UART (UART)0x4380 UA0CLKUART Ch.0 Clock Control Register
0x4382 UA0MODUART Ch.0 Mode Register
0x4384 UA0BRUART Ch.0 Baud-Rate Register
0x4386 UA0CTLUART Ch.0 Control Register
0x4388 UA0TXDUART Ch.0 Trans
mit Data Register
0x438a UA0RXDUART Ch.0 Receive Data Register
0x438c UA0INTFUART Ch.0 Status and Interrupt Flag Register
0x438e UA0INTEUART Ch.0 Interrupt Enable Register
16-bit timer (T16) Ch.10x43a0 T16_1CLKT16 Ch.1 Clock Control Register
0x43a2 T16_1MODT16 Ch.1 Mode Register
0x43a4 T16_1CTLT16 Ch.1 Control Register
0x43a6 T16_1TRT16 Ch.1 Reload Data Register
0x43a8 T16_1TCT16 Ch.1 Counter Data Register
0x43aa T
0x43b2 SPI0CTLSPI Ch.0 Control Register
0x43b4 SPI0TXDSPI Ch.0 Transmit Data Register
0x43b6 SPI0RXDSPI Ch.0 Receive Data Register
0x43b8 SPI0INTFSPI Ch.0 Interrupt Flag Register
0x43ba SPI0INTESPI Ch.0 Interrupt Enable Register
2
C (I2C)0x43c0 I2C0CLKI2C Ch.0 Clock Control Register
I
0x43c2 I2C0MODI2C Ch.0 Mode Register
0x43c4 I2C0BRI2C Ch.0 Baud-Rate Register
0x43c8 I2C0OADRI2C Ch.0 Own Address Register
0x43ca I2C0CTLI2C Ch.0 Control Register
0x43cc I2C0TXDI2C Ch.0 Transmit Data Register
0x43ce I2C0RXDI2C Ch.0 Receive Data Register
0x43d0 I2C0INTFI2C Ch.0 Status and Interrupt Flag Register
0x43d2 I2C0INTEI2C Ch.0 Interrupt Enable Register
16-bit PWM timer (T16A3) Ch.00x5000 T16A0CLK
T16A3 Ch.0 Clock Control Register
0x5002 T16A0CTL T16A3 Counter Ch.0 Control Register
0x5004 T16A0TC T16A3 Counter Ch.0 Data Register
0x5006 T16A0CCCTL
T16A3 Comparator/Capture Ch.0 Control Register
0x5008 T16A0CCA T16A3 Comparator/Capture Ch.0 A Data Register
0x500a T16A0CCB T16A3 Comparator/Capture Ch.0 B Data Register
0x500c T16A0INTF T16A3 Ch.0 Interrupt Flag Register
0x5292 SPI2CTLSPI Ch.2 Control Register
0x5294 SPI2TXDSPI Ch.2 Transmit Data Register
0x5296 SPI2RXDSPI Ch.2 Receive Data Register
0x5298 SPI2INTFSPI Ch.2 Interrupt Flag Register
0x529a SPI2INTESPI Ch.2 Interrupt Enable Register
Parallel interface (PIO)0x52e0 PIOCLKPIO Clock Control Register
0x52e2 PIOMODPIO Mo
de Register
0x52e4 PIOCTLPIO Control Register
0x52e6 PIOWRDATPIO Address/Write Data Register
0x52e8 PIORDDATPIO Read Data Register
0x52ea PIOSTATPIO Status Register
EPD timing controller (EPD Tcon)0x5380 EPDCTLEPD Tcon Control Register
0x5382 EPDINTFEPD Tcon Interrupt Flag and Status Register
0x5384 EPDINTEEPD Tcon Interrupt Enable Register
R/F converter (RFC) Ch.00x5440 RFC0CLKRFC Ch.0 Clock Control Register
42 RFC0CTLRFC Ch.0 Control Register
0x54
0x5444 RFC0TRGRFC Ch.0 Oscillation Trigger Register
0x5446 RFC0MCLRFC Ch.0 Measurement Counter Low Register
0x5448 RFC0MCHRFC Ch.0 Measurement Counter High Register
0x544a RFC0TCLRFC Ch.0 Time Base Counter Low Register
0x544c RFC0TCHRFC Ch.0 Time Base Counter High Register
0x544e RFC0INTFRFC Ch.0 Interrupt Flag Register
0x5450 RFC0INTERFC Ch.0 Interrupt Enable Register
R/F conv
erter (RFC) Ch.10x5460 RFC1CLKRFC Ch.1 Clock Control Register
0x5468 RFC1MCHRFC Ch.1 Measurement Counter High Register
0x546a RFC1TCLRFC Ch.1 Time Base Counter Low Register
0x546c RFC1TCHRFC Ch.1 Time Base Counter High Register
0x546e RFC1INTFRFC Ch.1 Interrupt Flag Register
0x5470 RFC1INTERFC Ch.1 Interrupt Enable Register
Temperature detection circuit
(TEM) 0x54c0 TEMCLKTEM Clock Control Register
0x54c2 TEMTMGTEM Timing Register
0x54c4 TEMCTLTEM Control Register
0x54c6 TEMRSLTTEM Conversion Result Register
0x54c8 TEMINTFTEM Interrupt Flag and Status Register
0x54ca TEMINTETEM Interrupt Enable Register
System-Protect Function4.6.1
The system-protect function protects control registers and bits from writings. They cannot be rewritten unless write
protection
deadlock that may occur when a system-related register is altered by a runaway CPU. See “Control Registers” in
each peripheral circuit to identify the registers and bits with write protection.
Note: Once write protection is removed using the MSCPROT.PROT[15:0] bits, write enabled status is
is removed by writing 0x0096 to the MSCPROT.PROT[15:0] bits. This function is provided to prevent
maintained unt
il write protection is applied again. After the registers/bits required have been al-
tered, apply write protection.
Control Registers4.7
MISC System Protect Register
Register nameBitBit nameInitialResetR/WRemarks
MSCPROT15–0 PROT[15:0]0x0000H0R/W–
Bits 15–0 PROT[15:0]
These bits protect the control registers related to the system against writings.
0x0096 (R/W): Disable system protection
Other than 0x0096 (R/W): Enable system protection
While the system protection is enabled, any data will not be written to the affected control bits (bits
with “WP” or “R/WP” appearing in the R/W column).
MISC IRAM Size Register
Register nameBitBit nameInitialResetR/WRemarks
MSCIRAMSZ15–9 –0x00–R–
8(reserved)0H0R/WP Always set to 0.
7
–0–R
6–4 (reserved)0x4–R
3–0–R
2–0 IRAMSZ[2:0]0x4H0R/WP
Bits 15–3 Reserved
Bits 2–0 IRAMSZ[2:0]
These bits set the internal RAM size that can be used.
Note: Be sure to set the FLASHCWAIT.RDWAIT[1:0] bits before the system clock is configured.
4-8
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 52
5 INTERRUPT CONTROLLER (ITC)
CPU core
ITC
Watchdog timer
Interrupt request
Interrupt level
Vector number
Interrupt request
NMI
ILVx[2:0]
Interrupt
control
circuit
ILVy[2:0]
Interrupt request
• • •
• • •
Peripheral circuit
Peripheral circuit
Internal data bus
Interrupt Controller (ITC)5
Overview5.1
The features of the ITC are listed below.
• Honors interrupt requests from the peripheral circuits and outputs the interrupt request, interrupt level and vector
number signals to the CPU.
• The interrupt level of each interrupt source is selectable from among eight levels.
• Priorities of the simultaneously generated interrupts are established from the interr
• Handles the simultaneously generated interrupts with the same interrupt level as smaller vector number has high-
er priority.
Figure 5.1.1 shows the configuration of the ITC.
upt level.
1.1 ITC ConfigurationFigure 5.
Vector Table5.2
The vector table contains the vectors to the interrupt handler routines (handler routine start address) that will be
read by the CPU to execute the handler when an interrupt occurs.
Table 5.2.1 shows the vector table.
2.1 Vector TableTable 5.
TTBR initial value = 0x8000
Vector number/
Software interrupt
number
0 (0x00)TTBR + 0x00 Reset• Low input to the #RESET pin
The MSCTTBRL and MSCTTBRH registers are provided to set the base (start) address of the vector table in which
interrupt vectors are programmed. “TTBR” described in Table 5.2.1 means the value set to these registers. After an
initial reset, the MSCTTBRL and MSCTTBRH registers are set to address 0x8000. Therefore, even when the vector table location is changed, it is necessary that at least the reset vector be written to the above address. Bits 7 to 0
in the MSCTTBRL register are
fixed at 0, so the vector table always begins from a 256-byte boundary address.
Initialization5.3
The following shows an example of the initial setting procedure related to interrupts:
1. Execute the di instruction to set the CPU into interrupt disabled state.
2. If the vector table start address is different from the default address, set it to the MSCTTBRL and MSCTTBRH
registers after removing syst
em protection by writing 0x0096 to the MSCPROT.PROT[15:0] bits. Then, write a
value other than 0x0096 to the MSCPROT.PROT[15:0] bits to set system protection.
3. Set the interrupt enable bit of the peripheral circuit to 0 (interrupt disabled).
4. Set the interrupt level for the peripheral circuit using the ITCLVx.ILVx[2:0] bits in the ITC.
5. Configure the peripheral circuit and start its operation.
6
. Clear the interrupt factor flag of the peripheral circuit.
7. Set the interrupt enable bit of the peripheral circuit to 1 (interrupt enabled).
8. Execute the ei instruction to set the CPU into interrupt enabled state.
Maskable Interrupt Control and Operations5.4
Peripheral Circuit Interrupt Control5.4.1
The peripheral circuit that generates interrupts includes an interrupt enable bit and an interrupt flag for each interrupt cause.
Interrupt flag: The flag is set to 1 when the interrupt cause occurs. The clear condition depends on the periph-
eral circuit.
Interrupt enable bit: By setting this bit to 1 (interrupt enabled), an interrupt request will be sent to the ITC when the
interrupt flag is set to 1. When this bit is set to 0 (interrupt disabled), no interrupt request will
be sent to the
ITC if the status is changed to interrupt enabled when the interrupt flag is 1.
ITC even if the interrupt flag is set to 1. An interrupt request is also sent to the
For specific information on causes of interrupts, interrupt flags, and interrupt enable bits, refer to the respective peripheral circuit descriptions.
Note: To prevent occurrence of unnecessary interrupts, always clear the corresponding interrupt flag
before setting the interrupt enable bit to 1 (interrupt enabled) and before terminating the interrupt
handler routine.
ITC Interrupt Request Processing5.4.2
On receiving an interrupt signal from a peripheral circuit, the ITC sends an interrupt request, the interrupt level,
and the vector number to the
cause, as shown in Table 5.2.1. The interrupt level is a value to configure the priority, and it can be set to between 0
(low) and 7 (high) using the ITCLVx.ILVx[2:0] bits provided for each interrupt source. The default ITC settings are
level 0 for all maskable interrupts. Interrupt requests are not accepted by the
Note: Wake-up operations (SLEEP/HALT cancellation) by an interrupt cannot be disabled even if the
interrupt level is set to 0.
The ITC outputs the interrupt request with the highest priority to the CPU in accordance with the following conditions if interrupt requests are input to the ITC simultaneously from two or more peripheral circuits.
• The interrupt with the highest interr
• If multiple interrupt requests are input with the same interrupt level, the interrupt with the lowest vector number
takes precedence.
The other interrupts occurring at the same time are held until all interrupts with higher priority levels have been accepted by the CPU.
If an interrupt cause with higher priority occurs while the ITC is outputting an interrupt request si
(before being accepted by the CPU), the ITC alters the vector number and interrupt level signals to the setting information on the more recent interrupt. The previously occurring interrupt is held. The held interrupt is canceled
and no interrupt is generated if the interrupt flag in the peripheral circuit is cleared via software.
CPU. Vector numbers are determined by the ITC internal hardware for each interrupt
CPU if the level is 0.
upt level takes precedence.
gnal to the CPU
Note: Before changing the interrupt level, make sure th
be generated (the interrupt enable bit of the peripheral circuit is set to 0 or the peripheral circuit
is deactivated).
at no interrupt of which the level is changed can
Conditions to Accept Interrupt Requests by the CPU5.4.3
The CPU accepts an interrupt request sent from the ITC when all of the following conditions are met:
• The IE (Interrupt Enable) bit of the PSR has been set to 1.
• The interru
Level) bits of the PSR.
• No other interrupt request having higher priority, such as NMI, has occurred.
pt request that has occurred has a higher interrupt level than the value set in the IL[2:0] (Interrupt
NMI5.5
The watchdog timer embedded in this IC can generate a non-maskable interrupt (NMI). This interrupt takes precedence over other interrupts and is unconditionally accepted by the CPU.
Fo
r detailed information on generating NMI, refer to the “Watchdog Timer” chapter.
Software Interrupts5.6
The CPU provides the “int imm5” and “intl imm5, imm3” instructions allowing the software to generate any interrupts. The operand imm5 specifies a vector number (0–31) in the vector table. In addition to this, the intl instruction
has the operand imm3 to specify the interrupt level (0–7) to be set to the IL[2:
rupt cannot be disabled (non-maskable interrupt). The processor performs the same interrupt processing operation
as that of the hardware interrupt.
0] bits in the PSR. The software inter-
5-4
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 56
5 INTERRUPT CONTROLLER (ITC)
Interrupt Processing by the CPU5.7
The CPU samples interrupt requests for each cycle. On accepting an interrupt request, the CPU switches to interrupt processing immediately after execution of the current instruction has been completed.
Interrupt processing involves the following steps:
1. The PSR and current program counter (PC) values are saved to the stack.
2. The PSR IE bit is cleared to 0 (dis
abling subsequent maskable interrupts).
3. The PSR IL[2:0] bits are set to the received interrupt level. (The NMI does not affect the IL bits.)
4. The vector for the interrupt occurred is loaded to the PC to execute the interrupt handler routine.
When an interrupt is accepted, Step 2 prevents subsequent maskable interrupts. Setting the IE bit to 1 in the interrupt handler routine allows handling of
multiple interrupts. In this case, since the IL[2:0] bits are changed by Step 3,
only an interrupt with a higher level than that of the currently processed interrupt will be accepted.
Ending interrupt handler routines using the reti instruction returns the PSR to the state before the interrupt occurred.
The program resumes processing following the instruction being executed at the time the interrup
t occurred.
Note: At wake-up from HALT or SLEEP mode, the CPU jumps to the interrupt handler routine after
executing one instruction. To execute the interrupt handler routine immediately after wake-up,
place the nop instruction at just behind the halt/slp instruction.
Control Registers5.8
MISC Vector Table Address Low Register
Register nameBitBit nameInitialResetR/WRemarks
MSCTTBRL15–8 TTBR[15:8]0x80H0R/WP –
7–0 TTBR[7:0]0x00H0R
Bits 15–0 TTBR[15:0]
These bits set the vector table base address (16 low-order bits).
MISC Vector Table Address High Register
Register nameBitBit nameInitialResetR/WRemarks
MSCTTBRH15–8 –0x00–R–
7–0 TTBR[23:16]0x00H0R/WP
Bits 15–8 Reserved
Bits 7–0 TTBR[23:16]
These bits set the vector table base address (eight high-order bits).
ITC Interrupt Level Setup Register x
Register nameBitBit nameInitialResetR/WRemarks
ITCLVx15–11 –0x00–R–
10–8 ILVy
7–3 –0x00–R
2–0 ILVy
Bits 15–11 Reserved
Bits 7–3 Reserved
Bits 10–8 ILVy
Bits 2–0 ILVy
1[2:0] (y1 = 2x +1)
0[2:0] (y0 = 2x)
These bits set the interrupt level of each interrupt.
Peripheral I/O function 0 I/O control
Peripheral I/O function 1 I/O control
Peripheral I/O function 2 I/O control
Peripheral I/O function 3 I/O control
General-purpose
I/O control
GPIO function
I/O cell
control signal
Output signal
Input signal
PxOUTy
PxyMUX[1:0]
GPIO/
peripheral I/O
function
switching
circuit
PxOENy
PxIENy
PxPDPUy
PxRENy
PxINy
KRSTCFG[1:0]
CLKSRC[1:0]
CLKDIV[3:0]
PxSELy
Clock
generator
Interrupt
controller
System reset
controller
DBRUN
Pxy
CLK_PPORT
I/O cell
Internal data bus
Exist only in the ports that supports the interrupt function.
Chattering
filter
Interrupt
control circuit
Key-entry
reset control
circuit
PxCHATENy
PxEDGEy
PxIFy
PxIEy
PxINT
Key-entry
reset signal
I/O Ports (PPORT)6
Overview6.1
PPORT controls the I/O ports. The main features are outlined below.
• Allows port-by-port function configurations.
- Each port can be configured with or without a pull-up or pull-down resistor.
- Each port can be configured with or without a chattering filter.
- Allows selection of the function (general-purpose I/O port (GPIO) function, up to four peripheral I/O functions) to be assigned to each port.
• Ports, except for those shared with debug pins, are initially placed into Hi-Z state.
(No current passes through the pin during this Hi-Z state.)
• Over voltage tolerant fail-safe design allowing interface with the signal without passing unnecessary current even
if a voltage exceeding V
Note: ‘x’, which is used in the port names Pxy, register names, an
= 0, 1, 2, ··· , d) and ‘y’ refers to a port number (y = 0, 1, 2, ··· , 7).
Figure 6.1.1 shows the configuration of PPORT.
Port configuration in this IC
• Port groups included: P0[7:0], P1[7:0], P2[7:0], P3[7:0], P4[1:0], Pd[2:0]
• Ports with general-purpose I/O function (GPIO): P0[7:0], P1[7:0], P2[7:0], P3[7:0], P4[1:0], Pd[2:0]
Refer to “Pin Descriptions” in the “Overview” chapter for the cell type, either the over voltage tolerant fail-safe
type I/O cell or the standard I/O cell, included in each port.
Schmitt Input6.2.1
The input functions are all configured with the Schmitt interface level. When a port is set to input disable status
(PxIOEN.PxIENy bit = 0), unnecessary current is n
Over Voltage Tolerant Fail-Safe Type I/O Cell6.2.2
The over voltage tolerant fail-safe type I/O cell allows interfacing without passing unnecessary current even if a
voltage exceeding V
ased without supplying V
operating power supply voltage to the port.
Pull-Up/Pull-Down6.2.3
The GPIO port has a pull-up/pull-down function. Either pull-up or pull-down may be selected for each port individually. This function may also be disabled for the port that does not require pulling up/down.
When the port level is switched from low to high through the pull-up resistor in
to low through the pull-down resistor, a delay will occur in the waveform rising/falling edge depending on the time
constant by the pull-up/pull-down resistance and the pin load capacitance. The rising/falling time is commonly determined by the following equation:
PR: Rising time (port level = low → high) [second]
PF: Falling time (port level = high → low) [second]
T+: High level Schmitt input threshold voltage [V]
T-: Low level Schmitt input threshold voltage [V]
INU/RIND: Pull-up/pull-down resistance [W]
IN: Pin capacitance [F]
BOARD: Parasitic capacitance on the board [F]
ot consumed if the Pxy pin is placed into floating status.
DD is applied to the port. Also unnecessary current is consumed when the port is externally bi-
DD. However, be sure to avoid applying a voltage exceeding the recommended maximum
cluded in the I/O cell or from high
Page 60
6 I/O PORTS (PPORT)
CMOS Output and High Impedance State6.2.4
The I/O cells except for analog output can output signals in the VDD and VSS levels. Also the GPIO ports may be
put into high-impedance (Hi-Z) state.
Clock Settings6.3
PPORT Operating Clock6.3.1
When using the chattering filter for entering external signals to PPORT, the PPORT operating clock CLK_PPORT
must be supplied to PPORT from the clock generator.
T
he CLK_PPORT supply should be controlled as in the procedure shown below.
1. Enable the clock source in the clock generator if it is stopped (refer to “Clock Generator” in the “Power Supply,
Reset, and Clocks” chapter).
2. Write 0x0096 to the MSCPROT.PROT[15:0] bits. (Remove system protection)
3. Set the following PCLK register bits:
- PCLK.CLKSRC[1:0] bits (Clock source selection)
- PCLK.CLKDIV[3:0] b
4. Write a value other than 0x0096 to the MSCPROT.PROT[15:0] bits. (Set system protection)
Settings in Step 3 determine the input sampling time of the chattering filter.
its (Clock division ratio selection = Clock frequency setting)
Clock Supply in SLEEP Mode6.3.2
When using the
configured so that it will keep
source.
If the
CLGOSC.xxxxSLPC bit for the CLK_PPORT clock source is 1, the CLK_PPORT clock source is deactivated during SLEEP mode and it disables the
bit setting (chattering filter enabled/disabled).
chattering filter function during SLEEP mode, the PPORT operating clock CLK_PPORT must be
suppling by writing 0 to the
chattering filter function regardless of the PxCHATEN.PxCHATENy
CLGOSC.xxxxSLPC bit for the CLK_PPORT clock
Clock Supply in DEBUG Mode6.3.3
The CLK_PPORT supply during DEBUG mode should be controlled using the PCLK.DBRUN bit.
The CLK_PPORT supply to PPORT is suspended when the CPU enters DEBUG mode if the PCLK.DBRUN bit
= 0. After the CPU returns to normal mode, the CLK_PPORT supply resumes. The PPORT chattering filter stops
operating when the CLK_PPORT supply is suspended. If the chattering filter is enabled in PPORT, the input port
function is also deactivated. Howeve
PPORT supply is not suspended and the chattering filter will keep operating in DEBUG mode.
r, the control registers can be altered. If the PCLK.DBRUN bit = 1, the CLK_
Operations6.4
Initialization6.4.1
After a reset, the ports except for the debugging function are configured as shown below.
• Port input: Disabled
• Port output: Disabled
• Pull-up: Off
• Pull-down: Off
• Port pins: High impedance state
Port function: Configured to GPIO
•
This status continues until the ports are configured via software. The debugging function ports are configured for
debug signal input/output.
Initial settings when using a port for a peripheral I/O function
When using the Pxy port for a peripheral I/O function, perform the following software initial settings:
1. Set the following PxIOEN register bits:
Set the PxIOEN.PxIENy bit to 0. (Disable input)
Set the PxIOEN.PxOENy bit to 0. (Disable output)
2. Set the PxMODSEL.PxSELy bit to 0. (Disable peripheral I/O function)
3. Initialize the periph
eral circuit that uses the pin.
4. Set the PxFNCSEL.PxyMUX[1:0] bits. (Select peripheral I/O function)
5. Set the PxMODSEL.PxSELy bit to 1. (Enable peripheral I/O function)
For the list of the peripheral I/O functions that can be assigned to each port of this IC, refer to “Control Register
and Port Function Configuration of this IC.” For the specific information on the peripheral I/O functions, refer
to the respective peripheral circuit chapter.
Initial settings when using a port as a general-purpose output port
(only for the ports with GPIO function)
When using the Pxy port pin as a general-purpose output pin, perform the following software initial settings:
1. Set the PxIOEN.PxOENy bit to 1. (Enable output)
2. Set the PxMODSEL.PxSELy bit to 0. (Enable GPIO function)
Initial settings when using a port as a general-purpose input port
(only for the ports with GPIO function)
When using the Pxy port pin as a general-purpose input pin, perform the following software initial settings:
1. Write 0 to the PxINTCTL.PxIEy bit. * (Disable interrupt)
2. When using the chattering filter, configure the PPORT operating clock (see “PPORT Operating Clock”) and
set the PxCHATEN.PxCHATENy bit to 1. *
When the
erating clock is not required).
3. Configure the following PxRCTL register bits when pulling up/down the port using the internal pull-up or
down resistor:
- PxRCTL.PxPDPUy bit (Select pull-up or pull-down resistor)
- Set the PxRCTL.PxRENy bit to 1. (Enable pull-up/down)
Set the PxRCTL.PxRENy bit to 0 if the in
4. Set the PxMODSEL.PxSELy bit to 0. (Enable GPIO function)
5. Configure the following bits when using the port input interrupt: *
- Write 1 to the PxINTF.PxIFy bit. (Clear interrupt flag)
- PxINTCTL.PxEDGEy bit (Select interrupt edge (input rising edge/falling edge))
- Set the PxINTCTL.PxIEy bit to 1. (Enable interrupt)
6. Set the following PxIOEN register b
- Set the PxIOEN.PxOENy bit to 0. (Disable output)
- Set the PxIOEN.PxIENy bit to 1. (Enable input)
* Steps 1 and 5 are required for the ports with an interrupt function. Step 2 is required for the ports with a chat-
tering filter function.
chattering filter is not used, set the PxCHATEN.PxCHATENy bit to 0 (supply of the PPORT op-
ternal pull-up/down resistors are not used.
its:
Table 6.4.1.1 lists the port status according to the combination of data input/output control and pull-up/down
control.
6-4
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 62
6 I/O PORTS (PPORT)
4.1.1 GPIO Port Control ListTable 6.
PxIOEN.
PxIENy bit
000×DisabledOff (Hi-Z) *1
0010DisabledPulled down
0011DisabledPulled up
100×EnabledDisabledOff (Hi-Z) *2
1010EnabledDisabledPulled down
1011EnabledDisabledPulled up
010×DisabledEnabledOff
0110DisabledEnabledOff
0111DisabledEnabledOff
1110EnabledEnabledOff
1111EnabledEnabledOff
*1: Initial status. Curren
*2: Use of the pull-up or pull-down function is recommended, as undesired current will flow if the port input is set to floating status.
PxIOEN.
PxOENy bit
t does not flow if the pin is placed into floating status.
PxRCTL.
PxRENy bit
PxRCTL.
PxPDPUy bit
InputOutput
Pull-up/pull-down
condition
Note: If the PxMODSEL.PxSELy bit for the port without a GPIO function is set to 0, the port goes into
initial status (refer to “Initial Settings”). The GPIO control bits are configured to a read-only bit alwa
ys read out as 0.
Port Input/Output Control6.4.2
Peripheral I/O function control
The port for which a peripheral I/O function is selected is controlled by the peripheral circuit. For more infor-
mation, refer to the respective peripheral circuit chapter.
Setting output data to a GPIO port
Write data (1 = high output, 0 = low output) to be output from the Pxy pin to the PxDAT.PxOUTy bit.
Reading input data from a GPIO port
The data (1 = high input, 0 = low input) input from the Pxy pin can be read out from the PxDAT.PxINy bit.
Chattering filter function
Some GPIO ports have a chattering filter function and it can be controlled in each port. This function is enabled
by setting the PxCHATEN.PxCHATENy bit to 1. The input sampling time to remove chattering is determined
by the CLK_PPORT frequency co
nfigured using the PCLK register in common to all ports. The chattering filter
removes pulses with a shorter width than the input sampling time.
3
Input sampling time = ———————————— [second] (Eq.6.2)
CLK_PPORT frequency [Hz]
Make sure the Pxy port interrupt is disabled before altering the PCLK register and PxCHATEN.PxCHATENy
bit settings. A Pxy port interrupt may erroneously occur if these settings are altere
d in an interrupt enabled status. Furthermore, enable the interrupt after a lapse of four or more CLK_PPORT cycles from enabling the chattering filter function.
If the clock generator is configured so that it will supply CLK_PPORT to PPORT in SLEEP mode, the chatter-
ing filter of the port will function even in SLEEP mode. If CLK_PPORT is configured to stop in SLEEP mode,
PPORT inactivates the ch
attering filter during SLEEP mode to input pin status transitions directly to itself.
Key-entry reset function
This function issues a reset request when low-level pulses are input to all the specified ports simultaneously.
Make the following settings when using this function:
1. Configure the ports to be used for key-entry reset as general-purpose input ports (refer to “Initial settings
when using a
2. Configure the input pin combination for key-entry reset using the PCLK.KRSTCFG[1:0] bits.
Note: When enabling the key-entry reset function, be sure to configure the port pins to be used for it
as general-purpose input pins before setting the PCLK.KRSTCFG[1:0] bits.
port as a general-purpose input port (only for the ports with GPIO function)”).
PPORT issues a reset request immediately after all the input pins specified by the PCLK.KRSTCFG[1:0] are
set to a low level if the chattering filter function is disabled (initial status). To issue a reset request only when
low-level signals longer than the time configured are input, enable the chattering filter function for all the ports
used for key-entry reset.
The pins configured for key-entry
reset can also be used as general-purpose input pins.
Interrupts6.5
When the GPIO function is selected for the port with an interrupt function, the port input interrupt function can be
used.
PINTFGRP.PxINTSetting an interrupt flag in the port groupClearing PxINTF.PxIF
Interrupt edge selection
Port input interrupts will occur at the falling edge of the input signal when setting the PxINTCTL.PxEDGEy bit
to 1, or the rising edge when setting to 0.
Interrupt enable
PPORT provides interrupt enable bits (PxINTCTL.PxIEy bit) corresponding to each interrupt flag. An inter-
rupt request is sent to the interrupt controller only when the interrupt flag, of which interrupt has been enabled
by the interrupt enable bit, is set. For more information on interrupt control, refer to the “Interrupt Controller”
chapter.
y
Rising or falling edge of the input signalWriting 1
y
Interrupt check in port group unit
When interrupts are enabled in two or more port groups, check the PINTFGRP.PxINT bit in the interrupt han-
dler first. It helps minimize the handler codes for finding the port that has generated an interrupt. If this bit is
set to 1, an interrupt has occurred in the port group. Next, check the PxINTF.PxIFy bit set to 1 in the port group
to determine the port that has generated an interrupt. Clearing the PxINTF.
PxIFy bit also clears the PINTFGRP.
PxINT bit. If the port is set to interrupt disabled status by the PxINTCTL.PxIEy bit, the PINTFGRP.PxINT bit
will not be set even if the PxINTF.PxIFy bit is set to 1.
Control Registers6.6
This section describes the same control registers of all port groups as a single register. For the register and bit configurations in each port group and their initial values,
this IC.”
Px Port Data Register
Register nameBitBit nameInitialResetR/WRemarks
PxDAT15–8 PxOUT[7:0]0x00H0R/W–
7–0 PxIN[7:0]0x00H0R
*1: This register is effective when the GPIO function is selected.
*2: The bit configuration differs depending on the port group.
*3: The initial value may be changed by the port.
Bits 15–8 PxOUT[7:0]
These bits are used to set data to be output from the GPIO port pins.
1 (R/W): Output high level from the port pin
0 (R/W): Output low level from the port pin
refer to “Control Register and Port Function Configuration of
When output is enabled (PxIOEN.PxOENy bit = 1), the port pin outputs the data set here. Although
data can be written when output is disabled (PxIOEN.PxOENy bit = 0), it does not affect the pin status.
These bits do not affect the outputs when the port is used as a peripheral I/O function.
6-6
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 64
6 I/O PORTS (PPORT)
Bits 7–0 PxIN[7:0]
The GPIO port pin status can be read out from these bits.
1 (R): Port pin = High level
0 (R): Port pin = Low level
The port pin status can be read out when input is enabled (PxIOEN.PxIENy bit = 1). When input is
disabled (PxIOEN.PxIENy bit = 0), these bits are always read as 0.
When the port is used for a peripheral I/O function, the input value cannot be read out from these bits.
Px Port Enable Register
Register nameBitBit nameInitialResetR/WRemarks
PxIOEN15–8 PxIEN[7:0]0x00H0R/W–
7–0 PxOEN[7:0]0x00H0R/W
*1: This register is effective when the GPIO function is selected.
*2: The bit configuration differs depending on the port group.
Bits 15–8 PxIEN[7:0]
These bits enable/disable the GPIO port input.
1 (R/W): Enable (The port pin status is input.)
0 (R/W): Disable (Input data is fixed at 0.)
When both data output and data input are enabled, the pin output status cont
rolled by this IC can be
read.
These bits do not affect the input control when the port is used as a peripheral I/O function.
Bits 7–0 PxOEN[7:0]
These bits enable/disable the GPIO port output.
1 (R/W): Enable (Data is output from the port pin.)
0 (R/W): Disable (The port is placed into Hi-Z.)
These bits do not affect the output control when the port is used as a peripheral I/O function.
Px Port Pull-up/down Control Register
Register nameBitBit nameInitialResetR/WRemarks
PxRCTL15–8 PxPDPU[7:0]0x00H0R/W–
7–0 PxREN[7:0]0x00H0R/W
*1: This register is effective when the GPIO function is selected.
*2: The bit configuration differs depending on the port group.
Bits 15–8 PxPDPU[7:0]
These bits select either the pull-up resistor or the pull-down resistor when using a resistor built into
the port.
1 (R/W): Pull-up resistor
0 (R/W): Pull-down resistor
The selected pull-up/down resistor is enabled
Bits 7–0 PxREN[7:0]
These bits enable/disable the port pull-up/down control.
1 (R/W): Enable (The built-in pull-up/down resistor is used.)
0 (R/W): Disable (No pull-up/down control is performed.)
when the PxRCTL.PxRENy bit = 1.
Enabling this function pulls up or down the port when output is disabled (PxIOEN.PxOENy bit = 0).
When output is enabled (PxIOEN.PxOENy bit = 1), the PxRCTL.PxRENy bit setting is ineffectiv
e re-
gardless of how the PxIOEN.PxIENy bit is set and the port is not pulled up/down.
These bits do not affect the pull-up/down control when the port is used as a peripheral I/O function.
*1: This register is effective when the GPIO function is selected.
*2: The bit configuration differs depending on the port group.
Bits 15–8 Reserved
Bits 7–0 PxIF[7:0]
These bits indicate the port input interrupt cause occurrence status.
1 (R): Cause of interrupt occurred
0 (R): No cause of interrupt occurred
1 (W): Clear flag
0 (W): Ineffective
Px Port Interrupt Control Register
Register nameBitBit nameInitialResetR/WRemarks
PxINTCTL15–8 PxEDGE[7:0]0x00H0R/W–
7–0 PxIE[7:0]0x00H0R/W
*1: This register is effective when the GPIO function is selected.
*2: The bit configuration differs depending on the port group.
Bits 15–8 PxEDGE[7:0]
These bits select the input signal edge to generate a port input interrupt.
1 (R/W): An interrupt will occur at a falling edge.
0 (R/W): An interrupt will occur at a rising edge.
Bits 7–0 PxIE[7:0]
These bits enable port input int
1 (R/W): Enable interrupts
0 (R/W): Disable interrupts
Note: To prevent generating unnecessary interrupts, clear the corresponding interrupt flag before en-
abling interrupts.
errupts.
Px Port Chattering Filter Enable Register
Register nameBitBit nameInitialResetR/WRemarks
PxCHATEN15–8 –0x00–R–
7–0 PxCHATEN[7:0]0x00H0R/W
*1: The bit configuration differs depending on the port group.
Bits 15–8 Reserved
Bits 7–0 PxCHATEN[7:0]
These bits enable/disable the chattering filter function.
1 (R/W): Enable (The chattering filter is used.)
0 (R/W): Disable (The chattering filter is bypassed.)
Px Port Mode Select Register
Register nameBitBit nameInitialResetR/WRemarks
PxMODSEL15–8 –0x00–R–
7–0 PxSEL[7:0]0x00H0R/W
*1: The bit configuration differs depending on the port group.
*2: The initial value may be changed by the port.
Bits 15–8 Reserved
6-8
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 66
6 I/O PORTS (PPORT)
Bits 7–0 PxSEL[7:0]
These bits select whether each port is used for the GPIO function or a peripheral I/O function.
1 (R/W): Use peripheral I/O function
0 (R/W): Use GPIO function
This bit sets whether the PPORT operating clock is supplied in DEBUG mode or not.
1 (R/WP): Clock supplied in DEBUG mode
0 (R/WP): No clock supplied in DEBUG mode
Bits 7–4 CLKDIV[3:0]
These bits select the division ratio of the PPORT operating clock (chattering filter clock).
Bits 3–2 KRSTCFG[1:0]
These bits configure the key-entry rese
6.2 Key-Entry Reset Function SettingsTable 6.
PCLK.KRSTCFG[1:0] bitskey-entry reset
0x3Reset when P0[3:0] inputs = all low
0x2Reset when P0[2:0] inputs = all low
0x1Reset when P0[1:0] inputs = all low
0x0Disable
These bits select the clock source of PPORT (chattering filter).
The PPORT operating clock should be configured by selecting the clock source using the PCLK.
CLKSRC[1:0] bits and the clock division ratio using the PCLK.CLKDIV[3:0] bits as shown in Table
6.6.3. These settings determine the input sampling time of the chattering filter.
6.3 Clock Source and Division Ratio SettingsTable 6.
The Pd port group consists of three ports Pd0–Pd2 and they are configured as a debugging function port at initialization. These three ports support the GPIO function. The GPIO function of the Pd2 port supports output only,
therefore, the pull-up/down function cannot be used.
WDT restarts the system if a problem occurs, such as when the program cannot be executed normally.
The features of WDT are listed below.
• Includes a 10-bit up counter to count NMI/reset generation cycle.
• A counter clock source and clock division ratio are selectable.
• Counter overflow generates a reset or NMI.
Figure 7.1.1 shows the configuration of WDT.
1.1 WDT ConfigurationFigure 7.
Clock Settings7.2
WDT Operating Clock7.2.1
When using WDT, the WDT operating clock CLK_WDT must be supplied to WDT from the clock generator.
The CLK_WDT supply should be controlled as in the procedure shown below.
1. Write 0x0096 to the MSCPROT.PROT[15:0] bits. (Remove system protection)
2. Enable the clock source in the clock generator if it is stopped (refer to “Clo
Reset, and Clocks” chapter).
3. Set the following WDTCLK register bits:
WDTCLK.CLKSRC[1:0] bits (Clock source selection)
WDTCLK.CLKDIV[1:0] bits (Clock division ratio selection = Clock frequency setting)
4. Write a value other than 0x0096 to the MSCPROT.PROT[15:0] bits. (Set system protection)
Use the following equation to calculate the WDT counter overflow cycle (
The CLK_WDT supply during DEBUG mode should be controlled using the WDTCLK.DBRUN bit.
The CLK_WDT supply to WDT is suspended when the CPU enters DEBUG mode if the WDTCLK.DBRUN bit = 0.
After the CPU returns to normal mode, the CLK_WDT supply resumes. Although WDT stops operating when the
CLK_WDT supply is suspended, the register retains the status before DEBUG mode
If the WDTCLK.DBRUN bit = 1, the CLK_WDT supply is not suspended and WDT will keep operating in DEBUG mode.
was entered.
Operations7.3
WDT Control7.3.1
Starting up WDT
WDT should be initialized and started up with the procedure listed below.
1. Write 0x0096 to the MSCPROT.PROT[15:0] bits. (Remove system protection)
2. Configure the WDT operating clock.
3. Configure the WDTCTL.NMIXRST bit. (Select
4. Write 1 to the WDTCTL.WDTCNTRST bit. (Reset WDT counter)
5. Write a value other than 0xa to the WDTCTL.WDTRUN[3:0] bits. (Start up WDT)
6. Write a value other than 0x0096 to the MSCPROT.PROT[15:0] bits. (Set system protection)
NMI or reset mode)
Resetting WDT
WDT generates a system reset (WDTCTL.NMIXRST bit = 0) or NMI (WDTCTL.NMIXRST bit = 1) when the
counter overflows. To avert system restart by
ware while WDT is running.
1. Write 0x0096 to the MSCPROT.PROT[15:0] bits. (Remove system protection)
2. Write 1 to the WDTCTL.WDTCNTRST bit. (Reset WDT counter)
3. Write a value other than 0x0096 to the MSCPROT.PROT[15:0] bits. (Set system protection)
A location should be provided for periodically processing this routine. Process this ro
cycle. After resetting, WDT starts counting with a new NMI/reset generation cycle.
If WDT is not reset within the t
or reset, the interrupt vector is read out, and the interrupt handler routine is executed.
If the counter overflows and generates an NMI without WDT being reset, the WDTCTL.STATNMI bit
WDT cycle for any reason, the CPU is switched to interrupt processing by NMI
WDT, its embedded counter must be reset periodically via soft-
utine within the tWDT
is set to 1.
Operations in HALT and SLEEP Modes7.3.2
During HALT mode
WDT
operates in HALT mode. HALT mode is therefore cleared by an NMI or reset if it continues for more than the
NMI/reset generation cycle and the NMI or reset handler is executed. To disable
writing 0xa to the
o
perations after HALT mode is cleared.
WDTCTL.WDTRUN[3:0] bits
before executing the halt instruction. Reset
During SLEEP mode
WDT operates in SLEEP mode if the selected clock source is running. In this case SLEEP mode is cleared by an NMI
or reset if it continues for more than the NMI/reset generation cycle and the NMI or reset handler is executed. Therefore, stop
If the clock source s
clearing SLEEP mode, reset
the
WDT
by setting the
tops in SLEEP mode, WDT stops. To prevent generation of an unnecessary NMI or reset after
This bit sets whether the WDT operating clock is supplied in DEBUG mode or not.
1 (R/WP): Clock supplied in DEBUG mode
0 (R/WP): No clock supplied in DEBUG mode
Bits 7–6 Reserved
Bits 5–4 CLKDIV[1:0]
These bits select the division ratio of the WDT operating clock (counter clock). The clock frequency
should be set to around 256 Hz.
Bits 3–2 Reserved
Bits 1–0 CLKSRC[1:0]
Thes
e bits select the clock source of WDT.
4.1 Clock Source and Division Ratio SettingsTable 7.
This bit indicates that a counter overflow and NMI have occurred.
1 (R): NMI (counter overflow) occurred
0 (R): NMI not occurred
When the NMI generation function of WDT is used, read this bit in the NMI handler routine to con-
firm that WDT was the source of the NMI.
The STATNMI set to 1 is cleared to 0 by resetting WDT.
Bits 7–5 Reserved
Bit 4 WDTCNTRST
This bit resets WDT.
1 (WP): Reset
0 (WP): Ignored
0 (R): Always 0 w
hen being read
Bits 3–0 WDTRUN[3:0]
These bits control WDT to run and stop.
0xa (R/WP): Stop
Values other than 0xa (R/WP): Run
Always 0x0 is read if a value other than 0xa is written.
Since an NMI or reset may be generated immediately after running depending on the counter value,
WDT should also be reset concurrently when running WDT.
7-4
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 77
8 SUPPLY VOLTAGE DETECTOR (SVD)
SVD
To system reset circuit
To interrupt controller
SVDMD[1:0]
Sampling timing
generator
Voltage
comparator
circuit
Interrupt/reset
control circuit
Detection
result counter
MODEN
SVDC[4:0]
VDSEL
SVDSC[1:0]
SVDIE
SVDIF
SVDDT
SVDRE[3:0]
CLKSRC[1:0]
CLKDIV[2:0]
Clock generator
CLK_SVD
V
DD
EXSVD
DBRUN
Internal data bus
Supply Voltage Detector (SVD)8
Overview8.1
SVD is a supply voltage detector to monitor the power supply voltage on the VDD pin or the voltage applied to an
external pin. The main features are listed below.
• Power supply voltage to be detected: Selectable from V
• Detectable voltage level: Selectable from among 19 levels (1.8 to 3.6 V)
• Detection results: - C
an be read whether the power supply voltage is lower than the detection
voltage level or not.
- Can generate an interrupt or a reset when low power supply voltage is detected.
• Interrupt: 1 system (Low power supply voltage detection interrupt)
• Supports intermittent operations: - Three detection cycles are selectable.
- Low power supply voltage detection count function to generate an interrup
t/reset when low power supply voltage is successively detected the
EXSVDAA (Hi-Z)External power supply voltage detection pin
* Indicates the status when the pin is configured for SVD.
If the port is shared with the EXSVD pin and other functions, the EXSVD function must be assigned to the port before SVD can be activated. For more information, refer to the “I/O Ports” chapter.
External Connection8.2.2
For the EXSVD pin input voltage range, refer to “Supply Voltage Detector Characteristics, EXSVD pin input voltage range V
When using SVD, the SVD operating clock CLK_SVD must be supplied to SVD from the clock generator.
The CLK_SVD sup
1. Write 0x0096 to the MSCPROT.PROT[15:0] bits. (Remove system protection)
2. Enable the clock source in the clock generator if it is stopped (refer to “Clock Generator” in the “Power Supply,
3. Set the following SVDCLK register bits:
4. Write a value other than 0x0096 to the MSCPROT.PROT[15:0] bits. (Set system protection)
The CLK_SVD frequency should be set to around 32 kHz.
When using SVD
keep supplying by writing 0 to the
If the
ing SLEEP mode and
the CPU returns to normal mode, CLK_SVD is supplied and the SVD operation resumes.
2.2.1 Connection between EXSVD Pin and External Power SupplyFigure 8.
EXSVD” in the “Electrical Characteristics” chapter.
Clock Settings8.3
SVD Operating Clock8.3.1
ply should be controlled as in the procedure shown below.
during SLEEP mode, the SVD operating clock CLK_SVD must be configured so that it will
CLGOSC.xxxxSLPC bit for the CLK_
CLGOSC.xxxxSLPC bit for the CLK_
SVD stops with the register settings maintained at those before entering SLEEP mode. After
SVD
clock source is 1, the CLK_
division ratio selection = Clock frequency setting)
SVD
clock source.
SVD
clock source is deactivated dur-
8-2
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 79
8 SUPPLY VOLTAGE DETECTOR (SVD)
Clock Supply in DEBUG Mode8.3.3
The CLK_SVD supply during DEBUG mode should be controlled using the SVDCLK.DBRUN bit.
The CLK_SVD supply to SVD is suspended when the CPU enters DEBUG mode if the SVDCLK.DBRUN bit =
0. After the CPU returns to normal mode, the CLK_SVD supply resumes. Although SVD stops operating when the
CLK_SVD supply is suspended, the registers retain the status before DEBUG mode
was entered.
If the SVDCLK.DBRUN bit = 1, the CLK_SVD supply is not suspended and SVD will keep operating in DEBUG
mode.
Operations8.4
SVD Control8.4.1
Starting detection
SVD should be initialized and activated with the procedure listed below.
1. Write 0x0096 to the MSCPROT.PROT[15:0] bits. (Remove system protection)
2. Configure the operating clock using the SVDCLK.CLKSRC[1:0] and SVDCLK.CLKDIV[
3. Set the following SVDCTL register bits:
- SVDCTL.VDSEL bit (Select detection voltage (V
DD or EXSVD))
- SVDCTL.SVDSC[1:0] bits (Set low power supply voltage detection counter)
4. Set the following bits when using the interrupt:
- Wr
ite 1 to the SVDINTF.SVDIF bit. (Clear interrupt flag)
- Set the SVDINTE.SDVIE bit to 1. (Enable SVD interrupt)
5. Set the SVDCTL.MODEN bit to 1. (Enable SVD detection)
6. Write a value other than 0x0096 to the MSCPROT.PROT[15:0] bits. (Set system protection)
2:0] bits.
Terminating detection
Follow the procedure shown below to stop SVD operation.
1. Write 0x0096 to the MSCPROT.PROT[15:0] bits. (Remove system prot
ection)
2. Write 0 to the SVDCTL.MODEN bit. (Disable SVD detection)
3. Write a value other than 0x0096 to the MSCPROT.PROT[15:0] bits. (Set system protection)
Reading detection results
The following two detection results can be obtained by reading the SVDINTF.SVDDT bit:
• Power supply voltage (V
• Power supply voltage (V
Before reading the SVDINTF.SVDDT bit, wait for at least SVD circuit enable response time after 1 is written
to the SVDCTL.MODEN bit (refer to “Supply Voltage Detector Characteristics, SVD circuit enable response
time t
SVDEN” in the “Electrical Characteristics” chapter).
After the SVDCTL.SVDC[4:0] bits setting value is altered to change the comparison voltage
SVDCTL.MODEN bit = 1, wait for at least SVD circuit response time before reading the SVDINTF.SVDDT
bit (refer to “Supply Voltage Detector Characteristics, SVD circuit response time t
acteristics” chapter).
DD or EXSVD) ≥ Comparison voltage when SVDINTF.SVDDT bit = 0
DD or EXSVD) < Comparison voltage when SVDINTF.SVDDT bit = 1
when the
SVD” in the “Electrical Char-
8-3
Page 80
8 SUPPLY VOLTAGE DETECTOR (SVD)
VSVDVSVD
VDD
SVDCTL.MODEN
SVD operating status
SVDINTF.SVDDT
Low power supply voltage
detection interrupt
DET
VSVD : Level set using the SVDCTL.SVDC[4:0] bits: Voltage detection masking time
: Voltage detection operation
DET
VSVDVSVD
VDD
SVDCTL.MODEN
SVD operating status
SVDINTF.SVDDT
Low power supply voltage
detection interrupt
DET
DET
SVD Operations8.4.2
Continuous operation mode
SVD operates in continuous operation mode by default (SVDCTL.SVDMD[1:0] bits = 0x0). In this mode,
SVD operates continuously while the SVDCTL.MODEN bit is set to 1 and it keeps loading the detection results to the SVDINTF.SVDDT bit. During this period, the current detection results can be obtained by reading
the SVDINTF.SVDDT bit as necessary. Furthe
a reset (if the SVDCTL.SVDRE[3:0] bits = 0xa) can be generated when the SVDINTF.SVDDT bit is set to 1 (low
power supply voltage is detected).
Intermittent operation mode
SVD operates in intermittent operation mode when the SVDCTL.SVDMD[1:0] bits are set to 0x1 to 0x3. In
this mode, SVD turns on at an interval set using the SVDCTL.SVDMD[1:
and then it turns off while the SVDCTL.MODEN bit is set to 1. During this period, the latest detection results
can be obtained by reading the SVDINTF.SVDDT bit as necessary. Furthermore, an interrupt or a reset can be
generated when SVD has successively detected low power supply voltage the number of times specified by the
SVDCTL.SVDSC[1:0] bits.
(1) When the SVDCTL.SVDMD[1:0] bits = 0x0 (continuous operation mode)
rmore, an interrupt (if the SVDCTL.SVDRE[3:0] bits ≠ 0xa) or
0] bits to perform detection operation
(2) When the SVDCTL.SVDMD[1:0] bits ≠ 0x0 (intermittent operation mode)
SVD Interrupt and Reset8.5
SVD Interrupt8.5.1
Setting the SVDCTL.SVDRE[3:0] bits to a value other than 0xa allows use of the low power supply voltage detection interrupt function.
SVD provides the interrupt enable bit (
SVDIF bit
the interrupt is enabled by the
Controller” chapter.
8-4
(Rev. 1.0)
). An interrupt request is sent to the interrupt controller only when the
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
4.2.1 SVD OperationsFigure 8.
5.1.1 Low Power Supply Voltage Detection Interrupt FunctionTable 8.
SVDINTF.SVDIFIn continuous operation mode
When the SVDINTF.SVDDT bit is 1
In intermittent operation mode
When low power supply voltage is successively detected the specified number of times
SVDINTE.SVDIE
SVDINTE.SVDIE
bit. For more information on interrupt control, refer to the “Interrupt
bit) corresponding to the interrupt flag (
Writing 1
SVDINTF.
SVDINTF.SVDIF bit is set
while
Page 81
8 SUPPLY VOLTAGE DETECTOR (SVD)
Once the SVDINTF.SVDIF bit is set, it will not be cleared even if the power supply voltage subsequently returns to
a value exceeding the comparison voltage value. An interrupt may occur due to a temporary power supply voltage
drop, check the power supply voltage status by reading the SVDINTF.SVDDT bit in the interrupt handler routine.
SVD Reset8.5.2
Setting the SVDCTL.SVDRE[3:0] bits to 0xa allows use of the SVD reset issuance function.
The reset issuing timing is the same as that of the
After a reset has been issued, SVD enters continuous operation mode even if it was operating in intermittent operation mode, and continues operating. Issuing an SVD reset initializes the port assignment. However, when EXSVD
is being detected, the i
nput of the port for the EXSVD pin is sent to SVD so that SVD will continue the EXSVD
detection operation.
If the power supply voltage reverts to the normal level, the SVDINTF.SVDDT bit goes 0 and the reset state is canceled. After that, SVD resumes operating in the operation mode set previously via the initialization routine.
During reset state, the SVD control bits are set as shown in Table 8.5.
5.2.1 SVD Control Bits During Reset StateTable 8.
Control registerControl bitSetting
SVDCLKDBRUNReset to the initial values.
CLKDIV[2:0]
CLKSRC[1:0]
SVDCTLVDSELThe set value is retained.
SVDSC[1:0]Cleared to 0. (The set value becomes invalid as SVD en-
SVDC[4:0]The set value is retained.
SVDRE[3:0]The set value (0xa) is retained.
SVDMD[1:0]Cleared to 0 to set continuous operation mode.
MODENThe set value (1) is retained.
SVD
INTFSVDIFThe status (1) before being reset is retained.
SVDINTESVDIECleared to 0.
SVDINTF.SVDIF bit being set when a low voltage is detected.
This bit sets whether the SVD operating clock is supplied in DEBUG mode or not.
1 (R/WP): Clock supplied in DEBUG mode
0 (R/WP): No clock supplied in DEBUG mode
Bit 7 Reserved
Bits 6–4 CLKDIV[2:0]
These bits select the division ratio of the SVD operating clock.
0x3Low power supply voltage is successively detected eight times.
0x2Low power supply voltage is successively detected four times.
0x1Low power supply voltage is successively detected twice.
0x0Low power supply voltage is successively detected once.
This setting is ineffective in continuous operation mode (SVDCTL.SVDMD[1:0] bits = 0x0).
Bits 12–8 SVDC[4:0]
Thes
e bits select a comparison voltage for detecting low voltage.
6.3 Comparison Voltage SettingTable 8.
SVDCTL.SVDC[4:0] bitsComparison voltage [V]
0x1fHigh
0x1e↑
:
0x0d↓
0x0cLow
0x0b–0x00Use prohibited
For more information, refer to “Supply Voltage Detector Characteristics, SVD detection voltage
V
SVD” in the “Electrical Characteristics” chapter.
8-6
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 83
8 SUPPLY VOLTAGE DETECTOR (SVD)
Bits 7–4 SVDRE[3:0]
These bits enable/disable the reset issuance function when a low power supply voltage is detected.
0xa (R/WP): Enable (Issue reset)
Other than 0xa (R/WP): Disable (Generate interrupt)
For more information on the SVD reset issuance function, refer to “SVD Reset.”
Bit 3 Reserved
Bits 2–1 SVDMD[1:0]
These bits select intermittent operation mode and its detection cycle.
For more information on intermittent and continuous operation modes, refer to “SVD Operations.”
Bit 0 MODEN
This bit enables/disables for the SVD circuit to operate.
1 (R/WP): Enable (Start detect
ion operations)
0 (R/WP): Disable (Stop detection operations)
After this bit has been altered, wait until the value written is read out from this bit without subsequent
operations being performed.
Notes: • Writing 0 to the SVDCTL.MODEN bit resets the SVD hardware. However, the register values
set and the interrupt flag are not cleared. The SVDCTL.MODEN bit is actually set to 0 after
this processing has
finished. If 1 is written to the SVDCTL.MODEN bit continuously without
waiting for the bit being read as 0 at this time, writing 0 may be ignored and a malfunction
may occur as the hardware restarts without resetting.
• The SVD internal circuit is initialized if the SVDCTL.SVDSC[1:0] bits, SVDCTL.SVDRE[3:0]
bits, or SVDCTL.SVDMD[1:0] bits are altered while SVD is in operation after 1 is written t
o the
SVDCTL.MODEN bit.
SVD Status and Interrupt Flag Register
Register nameBitBit nameInitialResetR/WRemarks
SVDINTF15–9 –0x00–R–
8SVDDTx–R
7–1 –0x00–R
0SVDIF0H1R/WCleared by writing 1.
Bits 15–9 Reserved
Bit 8 SVDDT
The power supply voltage detection results can be read out from this bit.
1 (R): Power supply voltage (V
0 (R): Power supply voltage (V
Bits 7–1 Reserved
Bit 0 SVDIF
This bit indicates the low power supply voltage detection interrupt cause occurrence status.
1 (R): Cause of interrupt occ
0 (R): No cause of interrupt occurred
1 (W): Clear flag
0 (W): Ineffective
If the port is shared with the EXCLm pin and other functions, the EXCLm input function must be assigned to the
port before using the event counter function. The EXCLm signal can be input through the chattering filter. For more
information, refer to the “I/O Por
* Indicates the status when the pin is configured for T16.
9-1
Page 86
9 16-BIT TIMERS (T16)
EXCLm pin input
Counter
xx - 1x - 2x - 3
Clock Settings9.3
T16 Operating Clock9.3.1
When using T16 Ch.n, the T16 Ch.n operating clock CLK_T16_n must be supplied to T16 Ch.n from the clock
generator. The CLK_T16_n supply should be controlled as in the procedure shown below.
1. Enable the clock source in the clock generator if it is stopped (refer to “Clock Generator” in the “Power Supply,
Reset, and Clocks” chapter).
- T16_nCLK.CLKDIV[3:0] bits (Clock division ratio selection = Clock frequency setting)
Clock Supply in SLEEP Mode9.3.2
T16_nCLK register bits:
When using T16
supplying by writing 0 to the
If the
CLGOSC.xxxxSLPC bit for the
during SLEEP mode and
SLEEP mode. After the CPU returns to normal mode, CLK_T16_n is supplied and the T16 operation resumes.
during SLEEP mode, the T16 operating clock CLK_T16_n must be configured so that it will keep
CLGOSC.xxxxSLPC bit for the
CLK_T16_n
T16 stops with the register settings and counter value maintained at those before entering
clock source is 1, the
CLK_T16_n
clock source.
CLK_T16_n
clock source is deactivated
Clock Supply in DEBUG Mode9.3.3
The CLK_T16_n supply during DEBUG mode should be controlled using the T16_nCLK.DBRUN bit.
The CLK_T16_n supply to T16 Ch.n is suspended when the CPU enters DEBUG mode if the T16_nCLK.DBRUN
bit = 0. After the CPU returns to normal mode, the CLK_T16_n supply resumes. Although T16 Ch.n stops operating when the CLK_T16_n supply is suspended, the counter and registers retain the status before DEBUG mode
was entered. If the T16_nCLK.DBRUN bit = 1, the CLK_T16_n supply is
operating in DEBUG mode.
not suspended and T16 Ch.n will keep
Event Counter Clock9.3.4
The channel that supports the event counter function counts down at the rising edge of the EXCLm pin input signal
when the T16_nCLK.CLKSRC[1:0] bits are set to 0x3.
3.3.1 Count Down TimingFigure 9.
Note that the EXOSC clock is selected for the channel that does not support the event counter function.
T16 Ch.n should be initialized and started counting with the procedure shown below.
1. Configure the T16 Ch.n operating clock (see “T16 Operating Clock”).
2. Set the T16_nCTL.MODEN bit to 1. (Enable count operation clock)
3. Set
4. Set the T16_nTR register. (Set reload data (counter preset data))
5. Set the following bits when using the interrupt:
9-2
(Rev. 1.0)
Operations9.4
Initialization9.4.1
the T16_nMOD.TRMD bit. (Select operation mode (Repeat mode or One-shot mode)).
- Write 1 to the T16_nINTF.UFIF bit. (Clear interrupt flag)
- Set the T16_nINTE.UFIE bit to 1. (Enable underflow interrupt)
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
Page 87
9 16-BIT TIMERS (T16)
Counter
0xffff
0x0000
Software control
Underflow interrupt
Underflow cycle
Time
T16_nTR
register setting
PRESET = 1
PRUN = 1PRUN = 1
PRUN = 0
6. Set the following T16_nCTL register bits:
- Set the T16_nCTL.PRESET bit to 1. (Preset reload data to counter)
- Set the T16_nCTL.PRUN bit to 1. (Start counting)
Counter Underflow9.4.2
Normally, the T16 counter starts counting down from the reload data value preset and generates an underflow signal
when an underflow occurs. This signal is used to generate an interrupt and may be output to a specif
ic peripheral
circuit as a clock (T16 Ch.n must be set to repeat mode to generate a clock). The underflow cycle is determined by
the T16 Ch.n operating clock setting and reload data (counter initial value) set in the T16_nTR register.
The following shows the equations to calculate the underflow cycle and frequency:
TR + 1 f
T = ————— fT = ————— (Eq. 9.1)
CLK_T16_nTR + 1
f
CLK_T16_n
Where
T: Und
f
T: Underflow frequency [Hz]
erflow cycle [s]
TR: T16_nTR register setting
f
CLK_T16_n: T16 Ch.n operating clock frequency [Hz]
Operations in Repeat Mode9.4.3
T16 Ch.n enters repeat mode by setting T16_nMOD.TRMD bit to 0.
In repeat mode, the count operation starts by writing 1 to the T16_nCTL.PRUN bit and continues until 0 is written.
A counter underflow presets the T16_nTR register value to the coun
this mode to generate periodic underflow interrupts or when using the timer to output a trigger/clock to the peripheral circuit.
ter, so underflow occurs periodically. Select
T16 Ch.n enters one-shot mode by setting the T16_nMOD.TRMD bit to 1.
In one-shot mode, the count operation starts by writing 1 to the T16_nCTL.PRUN bit and stops after the T16_nTR
register value is preset to the counter when an underflow has occurred. At the same time the counter stops, the T16_
nCTL.PRUN bit is cleared
automatically. Select this mode to stop the counter after an interrupt has occurred once,
9-3
Page 88
9 16-BIT TIMERS (T16)
0xffff
0x0000
PRESET = 1
PRUN = 1
PRUN = 1
PRUN = 0
PRUN = 1PRUN = 1
Counter
Software control
Underflow interrupt
Underflow cycle
Time
T16_nTR
register setting
4.4.1 Count Operations in One-shot ModeFigure 9.
Counter Value Read9.4.5
The counter value can be read out from the T16_nTC.TC[15:0] bits. However, since T16 operates on CLK_T16_n,
one of the operations shown below is required to read correctly by the CPU.
- Read the counter value twice or more and check to see if the same value is read.
- Stop the timer and then read the counter value.
Interrupt9.5
Each T16 channel has a function to generate the interrupt shown in Table 9.5.1.
UnderflowT16_nINTF.UFIFWhen the counter underflowsWriting 1
T16 provides interrupt enable bits corresponding to each interrupt flag. An interrupt request is sent to the interrupt
controller only when the interrupt flag, of which interrupt has been enabled by the interrupt enable bit, is set. For
more information on interrupt control, refer to the “
This bit sets whether the T16 Ch.n operating clock is supplied in DEBUG mode or not.
1 (R/W): Clock supplied in DEBUG mode
0 (R/W): No clock supplied in DEBUG mode
Bits 7–4 CLKDIV[3:0]
These bits select the division ratio of the T16 Ch.n operating clock (counter clock).
Bits 3–2 Reserved
Bits 1–0 CLKSRC[1:0]
These bits select the clock source of T16 Ch.n.
9-4
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 89
9 16-BIT TIMERS (T16)
6.1 Clock Source and Division Ratio SettingsTable 9.
By writing 1 to this bit, the timer starts count operations. However, the T16_nCTL.MODEN bit must
be set to 1 in conjunction with this bit or it must be set in advance. While the timer is running, writing
0 to this bit stops count operations. When the counter stops due to a counter underflow in one-shot
mode, this bit is automatically cleared to 0.
Bits 7–2 Reserved
Bit 1 PRESET
This bit presets the reload data stored in the
T16_nTR register to the counter.
1 (W): Preset
0 (W): Ineffective
1 (R): Presetting in progress
0 (R): Presetting finished or normal operation
By writing 1 to this bit, the timer presets the T16_nTR register value to the counter. However, the
T16_nCTL.MODEN bit must be set to 1 in conjunction with this bit or it must be set in advance. This
bit retains 1 during presetting and is automatically cle
ared to 0 after presetting has finished.
Bit 0 MODEN
This bit enables the T16 Ch.n operations.
1 (R/W): Enable (Start supplying operating clock)
0 (R/W): Disable (Stop supplying operating clock)
T16 Ch.n Reload Data Register
Register nameBitBit nameInitialResetR/WRemarks
T16_nTR15–0 TR[15:0]0xffffH0R/W–
Bits 15–0 TR[15:0]
These bits are used to set the initial value to be preset to the counter.
The value set to this register will be preset to the counter when 1 is written to the T16_nCTL.PRESET
bit or when the counter underflows.
Note: The T16_nTR register cannot be altered while the timer is running (T16_nCTL.PRUN bit = 1), as
an incorrect initial value may be preset to the counter.
T16 Ch.n Counter Data Register
Register nameBitBit nameInitialResetR/WRemarks
T16_nTC15–0 TC[15:0]0xffffH0R–
Bits 15–0 TC[15:0]
The current counter value can be read out from these bits.
T16 Ch.n Interrupt Flag Register
Register nameBitBit nameInitialResetR/WRemarks
T16_nINTF15–8 –0x00–R–
7–1 –0x00–R
0UFIF0H0R/WCleared by writing 1.
Bits 15–1 Reserved
Bit 0 UFIF
This bit indicates the T16 Ch.n underflow interrupt cause occurrence status.
1 (R): Cause of interrupt occurred
0 (R): No cause of interrupt occurred
1 (W): Clear flag
0 (W): Ineffective
9-6
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
Page 91
9 16-BIT TIMERS (T16)
T16 Ch.n Interrupt Enable Register
Register nameBitBit nameInitialResetR/WRemarks
T16_nINTE15–8 –0x00–R–
7–1 –0x00–R
0UFIE0H0R/W
Bits 15–1 Reserved
Bit 0 UFIE
This bit enables T16 Ch.n underflow interrupts.
1 (R/W): Enable interrupts
0 (R/W): Disable interrupts
Note: To prevent generating unnecessary interrupts, clear the corresponding interrupt flag before
USINnII (Hi-Z)UART Ch.n data input pin
USOUTnOO (High)UART Ch.n data output pin
* Indicates the status when the pin is configured for the UART.
If the port is shared with the UART pin and other functions, the UART input/output function must be assigned to
the port before activating the UART. For more information, refer to the “I/O Ports” chapter.
External Connections10.2.2
Figure 10.2.2.1 shows a connection diagram between the UART in this IC and an external UART device.
2.2.1 Connections between UART and an External UART DeviceFigure 10.
Input Pin Pull-Up Function10.2.3
The UART includes a pull-up resistor for the USINn pin. Setting the UAnMOD.PUEN bit to 1 enables the resistor
to pull up the USINn pin.
Output Pin Open-Drain Output Function 10.2.4
The USOUTn pin supports the open-drain output function. Default configuration is a push-pull output and it is
switch
ed to an open-drain output by setting the UAnMOD.OUTMD bit to 1.
Clock Settings10.3
UART Operating Clock10.3.1
When using the UART Ch.n, the UART Ch.n operating clock CLK_UARTn must be supplied to the UART Ch.n
from the clock generator. The CLK_UARTn supply should be controlled as in the procedure shown below.
1. Enable the clock source in the clock generator if it is stopped (refer to “Clock Gene
Reset, and Clocks” chapter).
- UAnCLK.CLKDIV[1:0] bits (Clock division ratio selection = Clock frequency setting)
The UART operating clock should be selected so that the baud rate generator will be configured easily.
rator” in the “Power Supply,
Clock Supply in SLEEP Mode10.3.2
When using the UART
will keep supplying by writing 0 to the
10-2
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
(Rev. 1.0)
during SLEEP mode, the UART operating clock CLK_UARTn must be configured so that it
CLGOSC.xxxxSLPC bit for the
CLK_UARTn
clock source.
Page 94
10 UART (UART)
Clock Supply in DEBUG Mode10.3.3
The CLK_UARTn supply during DEBUG mode should be controlled using the UAnCLK.DBRUN bit.
The CLK_UARTn supply to the UART Ch.n is suspended when the CPU enters DEBUG mode if the UAnCLK.
DBRUN bit = 0. After the CPU returns to normal mode, the CLK_UARTn supply resumes. Although the UART
Ch.n stops operating when the CLK_UARTn supply is suspended, the output pin and re
fore DEBUG mode was entered. If the UAnCLK.DBRUN bit = 1, the CLK_UARTn supply is not suspended and
the UART Ch.n will keep operating in DEBUG mode.
gisters retain the status be-
Baud Rate Generator10.3.4
The UART includes a baud rate generator to generate the transfer (sampling) clock. The transfer rate is determined
by the UAnBR.BRT[7:0] and UAnBR.FMD[3:0] bit settings. Use the following equation
CLK_UART: UART operating clock frequency [Hz]
bps: Transfer rate [bit/s]
BRT: UAnBR.BRT[7:0] setting value (0 to 255)
FMD: UAnBR.FMD[3:0] setting value (0 to 15)
—————— - FMD - 16) ÷ 16 (Eq. 10.1)
(
s to calculate the setting
For the transfer rate range configurable in the UART, refer to “UART Cha
and U
BRT2” in the “Electrical Characteristics” chapter.
racteristics, Transfer baud rates UBRT1
Data Format10.4
The UART allows setting of the data length, stop bit length, and parity function. The start bit length is fixed at one
bit.
Data length
With the UAnMOD.CHLN bit, the data length can be set to seven bits (UAnMOD.CHLN bit = 0) or eight bits
(UAnMOD.CHLN bit = 1).
Stop bit length
With the UAnMOD.STPB bit, the stop bit length can be set to one bit (UAnMOD.STPB bit = 0) or two bits
(UAnMOD.STPB bit = 1).
Parity function
The parity function is configured using the UAnMOD.PREN and UAnMOD.PRMD bits.
The UART Ch.n should be initialized with the procedure shown below.
1. Assign the UART Ch.n input/output function to the ports. (Refer to the “I/O Ports” chapter.)
2. Set the UAnCLK.CLKSRC[1:0] and UAnCLK.CLKDIV[1:0] bits. (Configure operating clock)
3. Configure the following UAnMOD register bits:
- UAnMOD.PUEN bit (Enable/disable USIN
- UAnMOD.OUTMD bit (Enable/disable USOUTn pin open-drain output)
- UAnMOD.IRMD bit (Enable/disable IrDA interface)
- UAnMOD.CHLN bit (Set 7/8-bit data length)
- UAnMOD.PREN bit (Enable/disable parity function)
- UAnMOD.PRMD bit (Even/odd parity selection)
- UAnMOD.STPB bit (Set 1/2-bit stop bit length)
4. Set the UAnBR.BRT[7:0] and UAnBR.FMD[3:0] bits. (Set transfer rate)
5. Set the follow
ing UAnCTL register bits:
- Set the UAnCTL.SFTRST bit to 1. (Execute software reset)
- Set the UAnCTL.MODEN bit to 1. (Enable UART Ch.n operations)
6. Set the following bits when using the interrupt:
- Write 1 to the interrupt flags in the UAnINTF register. (Clear interrupt flags)
- Set the interrupt enable bits in the UAnINTE register to 1. * (Enable interrupts)
* The initial value of the UAnINTF.TBEIF
UAnINTE.TBEIE bit is set to 1.
A data sending procedure and the UART Ch.n operations are shown below. Figures 10.5.2.1 and 10.5.2.2 show a
timing chart and a flowchart, respectively.
Data sending procedure
10-4
(Rev. 1.0)
1. Check to see if the UAnINTF.TBEIF bit is set to 1 (transmit buffer empty).
2. Write transmit data to t
3. Wait for a UART interrupt when using the interrupt.
4. Repeat Steps 1 to 3 (or 1 and 2) until the end of transmit data.
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
Data Transmission10.5.2
he UAnTXD register.
n pin pull-up)
bit is 1, therefore, an interrupt will occur immediately after the
Page 96
10 UART (UART)
USOUTn
UAnINTF.TBEIF
UAnINTF.TBSY
UAnINTF.TENDIF
Software operations
st D0 D1 D2 D3 D4 D5 D6 D7 p sp st D0 D1D7 p spst D0 D1D7 p sp
(st: start bit, sp: stop bit, p: parity bit)
Data (W) → UAnTXDData (W) → UAnTXD
1 (W) → UAnINTF.TENDIFData (W) → UAnTXD
Data transmission
End
Read the UAnINTF.TBEIF bit
Write transmit data to
the UAnTXD register
YES
NO
NO
YES
Tr ansmit data remained?
UAnINTF.TBEIF = 1 ?
Wait for an interrupt request
(UAnINTF.TBEIF = 1)
UART data sending operations
The UART Ch.n starts data sending operations when transmit data is written to the UAnTXD register.
The transmit data in the UAnTXD register is automatically transferred to the shift register and the UAnINTF.
TBEIF bit is set to 1 (transmit buffer empty).
The USOUTn pin outputs a start bit and the UAnINTF.TBSY bit is set to 1 (transmit busy). The shift register
data bit
s are then output successively from the LSB. Following output of MSB, the parity bit (if parity is en-
abled) and the stop bit are output.
Even if transmit data is being output from the USOUTn pin, the next transmit data can be written to the
UAnTXD register after making sure the UAnINTF.TBEIF bit is set to 1.
If no transmit data remains in the UAnTXD register after the stop bit has been output fro
m the USOUTn pin,
the UAnINTF.TBSY bit is cleared to 0 and the UAnINTF.TENDIF bit is set to 1 (transmission completed).
5.2.1 Example of Data Sending OperationsFigure 10.
A data receiving procedure and the UART Ch.n operations are shown below. Figures 10.5.3.1 and 10.5.3.2 show a
timing chart and flowcharts, respectively.
1. Wait for a UART interrupt when using the interrupt.
2. Check to see if the UAnINTF.RB1FIF bit is set to 1 (receive buffer one byte full).
3. Read the received data from the UAnRXD register.
4. Repeat Steps 1 to 3 (or 2 and 3) until the end of data reception.
10-5
Page 97
10 UART (UART)
USINn
UAnINTF.RB1FIF
UAnINTF.RB2FIF
UAnINTF.RBSY
Software operations
st D0···p sp st D0···p sp st D0···p sp st D0···psp
(st: start bit, sp: stop bit, p: parity bit)
data 1data 2data 3data 4
UAnRXD → data 1 (R) UAnRXD → data 3 (R)
UAnRXD → data 2 (R)
Data reception (1 byte read)
End
Wait for an interrupt request
(UAnINTF.RB1FIF = 1)
Read receive data (1 byte) from
the UAnRXD register
NO
YES
Receive data remained?
Data reception (2 bytes read)
End
Wait for an interrupt request
(UAnINTF.RB2FIF = 1)
Read receive data (1 byte) from
the UAnRXD register
Read receive data (1 byte) from
the UAnRXD register
NO
YES
Receive data remained?
Data receiving procedure (read by two bytes)
1. Wait for a UART interrupt when using the interrupt.
2. Check to see if the UAnINTF.RB2FIF bit is set to 1 (receive buffer two bytes full).
3. Read the received data from the UAnRXD register twice.
4. Repeat Steps 1 to 3 (or 2 and 3) until the end of data reception.
UART data receiving operations
The UART Ch.n starts data receiving operations when a start bit is input to the USINn pin.
After the receive circuit has detected a low level as a start bit, it starts sampling the following data bits and
loads the received data into the receive shift register. The UAnINTF.RBSY bit is set to 1 when the start bit is
detected.
The UAnINTF.RBSY bit is cleared to 0 and the receive shift register data is transferred to the receive data buf-
fer at the stop bit r
The receive data buffer consists of a 2-byte FIFO and receives data until it becomes full. When the receive data
buffer receives the first data, it sets the UAnINTF.RB1FIF bit to 1 (receive buffer one byte full). If the second
data is received without reading the first data, the UAnINTF.RB2FIF bit is set to 1 (receive buffer two bytes
full).
eceive timing.
This UART includes an RZI modulator/demodulator circuit enabling implementation of IrDA 1.0-compatible infrared communication function simply by adding simple external circuits.
Set the UAnMOD.IRMD bit to 1 to use the IrDA interface.
Data transfer control is identical to that for normal interface even if the IrDA interface function is
10-6
(Rev. 1.0)
IrDA Interface10.5.4
Seiko Epson Corporation S1C17F13 TECHNICAL MANUAL
5.3.1 Example of Data Receiving OperationsFigure 10.
5.3.2 Data Reception FlowchartsFigure 10.
enabled.
Page 98
10 UART (UART)
USINn
VDD
VSS
USOUTn
RXD
VCC
GND
TXD
LEDA
S1C17 UARTInfrared communication module
AMP
GND
VCC
Modulator input (shift register output)
Modulator output (USOUTn)
UAnMOD.INVIRTX bit = 0
UAnMOD.INVIRTX bit = 1
T
1
T
1
3
16
T
1
3
16
Demodulator input (USINn)
UAnMOD.INVIRRX bit = 0
UAnMOD.INVIRRX bit = 1
Demodulator output (shift register input)
T
2
5.4.1 Example of Connections with an Infrared Communication ModuleFigure 10.
The transmit data output from the UART Ch.n transmit shift register is output from the USOUTn pin after the low
pulse width is converted into 3/16 by the RZI modulator in SIR method and inverted. The USOUTn pin output signal can be inverted by setting the UAnMOD.INVIRTX bit to 1.
5.4.2 IrDA Transmission Signal WaveformFigure 10.
The received IrDA signal is input to the RZI demodulator and the low pulse width is converted into the normal
width before input to the receive shift register. The USINn pin input signal can be inverted prior to being demodulated by setting the UAnMOD.INVIRRX bit to 1.
5.4.3 IrDA Receive Signal WaveformFigure 10.
Note: The low pulse width (T2) of the IrDA signal input must be CLK_UART × 3 cycles or longer.
Receive Errors10.6
Three different receive errors, framing error, parity error, and overrun error, may be detected while receiving data.
Since receive errors are interrupt causes, they can be processed by generating interrupts.
Framing Error10.6.1
The UART determines loss of sync if a stop bit is not detected (when the stop bit is received as 0) and assumes that
a framing error has occurred. The received data that encountered an error is still transferred to the receive data buf-
fer and the UAnINTF.FEIF bit (framing error interrupt flag) is set to 1 when the data becomes ready to read from
the UAnRXD register.
Note: Framing error/parity error interrupt flag set timings
These interrupt flags will be set after the data that encountered an error is transferred to the re-
ceive data buffer. Note, however, that the set timing depends on the buffer status at that point.
• When the receive data buffer is empty
The interrupt flag will be set when the data that encountered an error is transferred to the re-
ceive data buffer.
10-7
Page 99
10 UART (UART)
• When the receive data buffer has a one-byte free space
The interrupt flag will be set when the first data byte already loaded is read out after the data
that encountered an error is transferred to the second byte entry of the receive data buffer.
Parity Error10.6.2
If the parity function is enabled, a parity check is performed when data is received. The UART checks matching
between the data rece
ived in the shift register and its parity bit, and issues a parity error if the result is a non-match.
The received data that encountered an error is still transferred to the receive data buffer and the UAnINTF.PEIF
bit (parity error interrupt flag) is set to 1 when the data becomes ready to read from the UAnRXD register (see the
Note on framing error).
Overrun Error10.6.3
If the receive data buffer is still full (two bytes of received data have not been read) when a data reception to the
shift register has completed, an overrun error occurs as the data cannot be transferred to the receive data buffer.
When an overrun error occurs, the UAnINTF.OEIF bit (overrun error interrupt flag) is set to 1.
Interrupts10.7
The UART has a function to generate the interrupts shown in Table 10.7.1.
End of transmissionUAnINTF.TENDIF When the UAnINTF.TBEIF bit = 1 after
the stop bit has been sent
Framing errorUAnINTF.FEIFRefer to “Receive Errors.”Writing 1, reading received
Parity errorUAnINTF.PEIFRefer to “Receive Errors.”Writing 1, reading received
Overrun errorUAnINTF.OEIFRefer to “Receive Errors.”Writing 1 or software reset
Receive buffer two bytes full UAnINTF.RB2FIF When the second received data byte is
loaded to the receive data buffer in which
the first byte is already received
Receive buffer one byte full UAnINTF.RB1FIF When the first received data byte is load-
ed to the em
Transmit buffer emptyUAnINTF.TBEIF When transmit data written to the trans-
mit data buffer is transferred to the shift
register
ptied receive data buffer
Writing 1 or software reset
data that encountered an
error, or software reset
data that encountere
error, or software reset
Reading received data or
software reset
Reading data to empty
the receive data buffer or
software reset
Writing transmit data
d an
The UART provides interrupt enable bits corresponding to each interrupt flag. An interrupt request is sent to the
interrupt controller only when the interrupt flag,
of which interrupt has been enabled by the interrupt enable bit, is
set. For more information on interrupt control, refer to the “Interrupt Controller” chapter.
This bit sets whether the UART operating clock is supplied in DEBUG mode or not.
1 (R/W): Clock supplied in DEBUG mode
0 (R/W): No clock supplied in DEBUG mode
Bits 7–6 Reserved
Bits 5–4 CLKDIV[1:0]
These bits select the division ratio of the UART operating clock.
Bits 3–2 Reserved
Bits 1–0 CLKSRC[1:0]
These bits select the clock source of the UART.
8.1 Clock Source and Division Ratio SettingsTable 10.
UAnCLK.
CLKDIV[1:0] bits
0x31/81/11/81/1
0x21/41/4
0x11/21/2
0x01/11/1
(Note) The oscillation circuits/external input that are not supported in this IC cannot be
selected as the clock source.
0x00x10x20x3
OSC3BOSC1OSC3AEXOSC
UAnCLK.CLKSRC[1:0] bits
Note: The UAnCLK register settings can be altered only when the UAnCTL.MODEN bit = 0.