TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, WITH REGARD TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. To the extent permitted by applicable law, Cypress reserves the right to make changes to this document without further notice. Cypress does not assume any liability arising out of the application or use of any product or circuit described in
this document. Any information provided in this document, including any sample design information or programming code, is
provided only for reference purposes. It is the responsibility of the user of this document to properly design, program, and test
the functionality and safety of any application made of this information and any resulting product. Cypress products are not
designed, intended, or authorized for use as critical components in systems designed or intended for the operation of weapons, weapons systems, nuclear installations, life-support devices or systems, other medical devices or systems (including
resuscitation equipment and surgical implants), pollution control or hazardous substances management, or other uses where
the failure of the device or system could cause personal injury, death, or property damage ("Unintended Uses"). A critical
component is any component of a device or system whose failure to perform can be reasonably expected to cause the failure
of the device or system, or to affect its safety or effectiveness. Cypress is not liable, in whole or in part, and you shall and
hereby do release Cypress from any claim, damage, or other liability arising from or related to all Unintended Uses of Cypress
products. You shall indemnify and hold Cypress harmless from and against all claims, costs, damages, and other liabilities,
including claims for personal injury or death, arising from or related to any Unintended Uses of Cypress products.
Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, WICED, PSoC, CapSense, EZ-USB, FRAM, and Traveo are trademarks or registered trademarks of Cypress in the United States and other countries. For a more
complete list of Cypress trademarks, visit cypress.com. Other names and brands may be claimed as property of their respective owners.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document Number: 001-32519 Rev. *H2
21.3 Bank 0 Registers ..................................................................................................................164
21.4 Bank 1 Registers ..................................................................................................................212
Section E: Glossary 239
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H8
Section A:Overview
The enCoRe™ V family consists of many On-Chip Controller devices. The CY8C20x46A/46AS/96A/46L/96LCY7C643xx and
CY7C604xx enCoRe V devices have fixed analog and digital resources in addition to a fast CPU, flash program memory, and
SRAM data memory to support various algorithms.
For the most up-to-date ordering, pinout, packaging, or electrical specification information, refer to the enCoRe V device’s
datasheet. For the most current technical reference manual information and newest product documentation, go to the
Cypress web site at http://www.cypress.com >> Documentation.
This section contains:
■ Pin Information on page 15.
Document Organization
This manual is organized into sections and chapters, according to enCoRe V functionality. Each section contains a top-level
architectural diagram and a register summary (if applicable). Most chapters within the sections have an introduction, an architectural/application description, register definitions, and timing diagrams. The sections are as follows:
■ Overview – Presents the top-level architecture, helpful information to get started, and document history and
conventions. The enCoRe V device pinouts are detailed in Pin Information, on page 15.
■ enCoRe V Core – Describes the heart of the enCoRe V device in various chapters, beginning with an architectural over-
view and a summary list of registers pertaining to the enCoRe V core.
■ System Resources – Presents additional enCoRe V system resources, beginning with an overview and a summary list of
registers pertaining to system resources.
■ Registers – Lists all enCoRe V device registers in register mapping tables, and presents bit-level detail of each register in
its own Register Reference chapter. Where applicable, detailed register descriptions are also located in each chapter.
■ Glossary – Defines the specialized terminology used in this manual. Glossary terms are presented in bold, italic font
throughout this manual.
■ Index – Lists the location of key topics and elements that constitute and empower the enCoRe V devices.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H9
Top-Level Architecture
The enCoRe V block diagram on the next page illustrates the top-level architecture of the
CY8C20X46A/46AS/96A/46L/96LCY7C643xx and CY7C604xx devices. Each major grouping in the diagram is covered in this
manual in its own section: enCoRe V Core and System Resources. Banding these two main areas together is the communica-
tion network of the system bus.
enCoRe V Core
The enCoRe V Core is a powerful engine that supports a rich instruction set. It includes the SRAM for data storage, an inter-rupt controller for easy program execution to new addresses, sleep and watchdog timers, a regulated 3.0-V output option for
Port 1 I/Os, and multiple clock sources that include the IMO (internal main oscillator) and ILO (internal low-speed oscillator)
for precision, programmable clocking.
The CPU core, called the M8C, is a powerful processor with speeds up to 24 MHz. The M8C is a four MIPS 8-bit Harvard
architecture microprocessor. Within the CPU core are the SROM and Flash memory components that provide flexible pro-
gramming.
enCoRe V GPIOs provide connection to the CPU and external resources of the device. Each pin’s drive mode is selectable
from four options, allowing great flexibility in external interfacing. Every pin also has the capability to generate a system interrupt on low level and change from last read.
System Resources
The System Resources provide additional enCoRe V capability. These system resources include:
■ Digital clocks to increase flexibility.
■ I2C functionality with “no bus stalling.”
■ Various system resets supported by the M8C.
■ Power-on-reset (POR) circuit protection.
■ SPI master and slave functionality.
■ A programmable timer to provide periodic interrupts.
■ Clock boost network providing a stronger signal to switches.
■ Full-speed USB interface for USB 2.0 communication with 512 bytes of dedicated buffer memory and an internal 3-V reg-
ulator.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H10
enCoRe V Core Top-Level Block Diagram
CAPSENSE
SYSTEM
1K/2K
SRAM
Inte rrupt
Controller
Sleep and
Watchdog
M ultip le Clo ck Sou rce s
Inte rna l Lo w Sp ee d O sc illator (IL O )
6/1 2/24 M H z In terna l M ain O sc illato r
(IM O)
PSoC CORE
CPU Core (M8C)
Supervisory ROM (SROM )
8K/16K/32K Flash
Nonvolatile M emory
SYSTEM RESOURCES
SYSTEM BUS
Analog
Reference
SYSTEM BUS
Port 3Port 2Port 1P or t 0
CapSense
Module
Global Analog Interconnect
1.8/2.5/3V
LDO
Analog
Mux
Two
Com parators
I2C
Slave
SPI
Master/
Slave
POR
and
LVD
USB
System
Resets
Internal
Voltage
References
Three 16-Bit
Program mable
Tim ers
PWRSYS
(Regulator)
Port 4
Digital
Clocks
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H11
Getting Started
The quickest path to understanding enCoRe V is by reading the enCoRe V device’s datasheet and using PSoC Designer™
Integrated Development Environment (IDE). This manual is useful for understanding the details of the enCoRe V integrated
circuit.
Important Note
For the most up-to-date Ordering, Packaging, or Electrical Specification information, refer to the individual
enCoRe V device’s datasheet or go to http://www.cypress.com.
Support
Free support for enCoRe V products is available online at http://www.cypress.com. Resources include Training Seminars,
Discussion Forums, Application Notes, TightLink Technical Support Email/Knowledge Base, and Application Support Technicians.
Technical Support can be reached at http://www.cypress.com/support.
Product Upgrades
Cypress provides scheduled upgrades and version enhancements for PSoC Designer free of charge. You can order the
upgrades from your distributor on CD-ROM or download them directly from http://www.cypress.com under Software. Also pro-
vided are critical updates to system documentation under http://www.cypress.com >> Documentation.
Development Kits
Development Kits are available from the following distributors: Digi-Key, Avnet, Arrow, and Future. The Cypress Online Store
contains development kits, C compilers, and all accessories for enCoRe V development. Go to the Cypress Online Store at
http://www.cypress.com under Order >> USB Kits.
Document History
This section serves as a chronicle of the CY8C20XX6A/AS/LenCoRe™ V and enCoRe™ V LV CY7C643xx and CY7C604xx
Technical Reference Manual.
Technical Reference Manual History
Versio n/
Release Date
** September 2007HMTFirst release of the enCoRe™ V and enCoRe™ V LV CY7C643xx and CY7C604xx Technical Reference Manual.
*A June 2008HMTSecond release of the enCoRe™ V and enCoRe™ V LV CY7C643xx and CY7C604xx Technical Reference Manual.
*B June 2009FSUThird release of the enCoRe™ V and enCoRe™ V LV CY7C643xx and CY7C604xx Technical Reference Manual.
*C September 2009FSUFourth release of the enCoRe™ V and enCoRe™ V LV CY7C643xx and CY7C604xx Technical Reference Manual.
*D November 2009FSUMultiple fixes, primarily to the sleep and I2C chapters.
*E December 2009FSUMultiple fixes, primarily to the External Crystal Oscillator chapter.
*F September 2012ANTGUpdated external clock source description
*G October 2015ASRI
*H November 2018RAJVUpdated the template
OriginatorDescription of Change
Removed all instances of IMODIS related information and provided information for "no glitch protection in the device for
an external clock".
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H12
Documentation Conventions
There are only four distinguishing font types used in this
manual, besides those found in the headings.
■ The first is the use of italics when referencing a docu-
ment title or file name.
■ The second is the use of bold italics when referencing a
term described in the Glossary of this manual.
■ The third is the use of Times New Roman font, distinguish-
ing equation examples.
■ The fourth is the use of Courier New font, distinguish-
ing code examples.
Register Conventions
The following table lists the register conventions that are
specific to this manual. A more detailed set of register conventions is located in the Register Reference chapter on
page 163.
Register Conventions
ConventionExampleDescription
‘x’ in a register
name
RR : 00Read register or bit(s)
WW : 00Write register or bit(s)
ORO : 00Only a read/write register or bit(s).
LRL : 00Logical register or bit(s)
CRC : 00Clearable register or bit(s)
00RW : 00Reset value is 0x00 or 00h
XXRW : XXRegister is not reset
0,0,04hRegister is in bank 0
1,1,23hRegister is in bank 1
x,x,F7h
Empty, grayedout table cell
PRTxIE
Multiple instances/address ranges of the
same register
Register exists in register bank 0 and register bank 1
Reserved bit or group of bits, unless otherwise stated
Numeric Naming
Hexadecimal numbers are represented with all letters in
uppercase with an appended lowercase ‘h’ (for example,
‘14h’ or ‘3Ah’) and hexadecimal numbers may also be represented by a ‘0x’ prefix, the C coding convention. Binary
numbers have an appended lowercase ‘b’ (for example,
01010100b’ or ‘01000011b’). Numbers not indicated by an
‘h’ or ‘b’ are decimal.
Units of Measure
This table lists the units of measure used in this manual.
Units of Measure
SymbolUnit of Measure
°Cdegrees Celsius
dBdecibels
fFfemtofarads
Hzhertz
kkilo, 1000
K
KB1024 bytes
Kbit1024 bits
kHzkilohertz (32.000)
kkilohms
MHzmegahertz
Mmegaohms
Amicroamperes
Fmicrofarads
smicroseconds
Vmicrovolts
Vrmsmicrovolts root-mean-square
mAmilliamperes
msmilliseconds
mVmillivolts
nAnanoampheres
nsnanoseconds
nVnanovolts
ohms
pFpicofarads
pppeak-to-peak
ppmparts per million
spssamples per second
sigma: one standard deviation
Vvolts
210, 1024
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H13
Acronyms
This table lists the acronyms that are used in this manual.
Acronyms
AcronymDescription
ABUSanalog output bus
ACalternating current
ADCanalog-to-digital converter
APIApplication Programming Interface
BRbit rate
BRAbus request acknowledge
BRQbus request
CIcarry in
CMPcompare
COcarry out
CPUcentral processing unit
CRCcyclic redundancy check
DACdigital-to-analog converter
DCdirect current
DIdigital or data input
DMAdirect memory access
DOdigital or data output
ECOexternal crystal oscillator
FBfeedback
GIEglobal interrupt enable
GPIOgeneral-purpose I/O
ICEin-circuit emulator
IDEintegrated development environment
ILOinternal low-speed oscillator
IMOinternal main oscillator
I/Oinput/output
IORI/O read
IOWI/O write
IPORimprecise power-on-reset
IRQinterrupt request
ISRinterrupt service routine
ISSPin system serial programming
IVRinterrupt vector read
LRblast received bit
LRBlast received byte
LSbleast significant bit
LSBleast significant byte
MISOmaster-in-slave-out
MOSImaster-out-slave-in
MSbmost significant bit
MSBmost significant byte
PCprogram counter
PCHprogram counter high
PCLprogram counter low
PDpower down
PMAPSoC® memory arbiter
PORpower-on-reset
Acronyms (continued)
AcronymDescription
PPORprecision power-on-reset
PRSpseudo random sequence
PSSDCpower system sleep duty cycle
RAMrandom access memory
RETIreturn from interrupt
ROrelaxation oscillator
ROMread-only memory
RWread/write
SIEserial interface engine
SE0single-ended zero
SOFstart of frame
SPstack pointer
SPIserial peripheral interconnect
SPIMserial peripheral interconnect master
SPISserial peripheral interconnect slave
SRAMstatic random access memory
SROMsupervisory read-only memory
SSADCsingle slope ADC
SSCsupervisory system call
TCterminal count
USBuniversal serial bus
WDTwatchdog timer
WDRwatchdog reset
XRESexternal reset
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H14
1.Pin Information
P2[5]
P1[7]
P1[5]
P1[3]
P0[3]
P0[7]
Vdd
P0[4]
P1[1]
P1[0]
P1[2]
P2[3]
P1[4]
XRES
P0[1]
Vss
QFN
(Top View)
1
2
3
4
12
11
10
9
161514
13
567
8
This chapter lists, describes, and illustrates all pins and pinout configurations for the CY8C20X46A/46AS/96A/46L/
96LCY7C643xx and CY7C604xx enCoRe V devices. For up-to-date ordering, pinout, and packaging information, refer to the
individual enCoRe V device’s datasheet or go to http://www.cypress.com.
1.1Pinouts
TheCY8C20X46A/46AS/96A/46L/96LCY7C643xx and CY7C604xx enCoRe V devices are available in a variety of packages.
Every port pin (labeled with a “P”), except for Vss, Vdd, and XRES in the following tables and illustrations, is capable of Dig-
ital I/O.
1.1.1 CY7C60413 enCoRe V LV 16-Pin Part Pinout
Table 1-1. 16-Pin QFN/COL Part Pinout
Pin
No.
1IOIP2[5]XTAL Out
2IOIP2[3]XTAL In
3IOHRIP1[7]I2C SCL, SPI SS
4IOHRIP1[5]I2C SDA, SPI MISO
5IOHRIP1[3]SPI CLK
6IOHRIP1[1]
7PowerVssGround pin
8IOHRIP1[0]
9IOHRIP1[2]
10IOHRIP1[4]EXTCLK
11InputXRESActive high external reset with internal pull down
12IOHIP0[4]
13PowerVddPower pin
14IOHIP0[7]
15IOHIP0[3]
16IOHIP0[1]
Legend A = Analog, I = Input, O = Output, H = 5-mA High Output Drive, R = Regulated Output Option.
Typ e
Digital Analog
1
These are the ISSP pins, which are not High-Z at POR.
NameDescription
1
TC CLK
, I2C SCL, SPI MOSI
1
TC DATA
, I2C SDA, SPI CLK
Devices
,
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H15
1.1.2
P0[1]
P2[7]
P2[5]
P2[3]
P2[1]
P3[3]
QFN
(Top View)
9
101112
131415
16
1
2
3
4
5
6
7
8
24
23
22
21
20
19
18
17
32313029282726
25
Vss
P0[3]
P0[7]
Vdd
P0[6]
P0[4]
P0[2]
P3[1]
P1[7]
P0[0]
P2[6]
P3[0]
XRES
P1[5]
P1[3]
P1[1]
Vss
P1[0]
P1[2]
P1[4]
P1[6]
P2[4]
P2[2]
P2[0]
P3[2]
P0[5]
Pin Information
CY7C60445 enCoRe V LV 32-Pin Part Pinout
Table 1-2. 32-Pin QFN Part Pinout
Pin
No.
Digital
1IOHIP0[1]Integrating input
2IOIP2[7]
3IOIP2[5]XTAL Out
4IOIP2[3]XTAL In
5IOIP2[1]
6IOIP3[3]
7IOIP3[1]
8IOHRIP1[7]I2C SCL, SPI SS
9IOHRIP1[5]I2C SDA, SPI MISO
10 IOHRIP1[3]SPI CLK
11IOHRIP1[1]
12PowerVssGround pin
13 IOHRIP1[0]
14 IOHRIP1[2]
15 IOHRIP1[4]EXTCLK
16 IOHRIP1[6]
17InputXRES Active high external reset with internal pull down
18IOIP3[0]
19IOIP3[2]
20IOIP2[0]
21IOIP2[2]
22IOIP2[4]
23IOIP2[6]
24IOHIP0[0]
25IOHIP0[2]
26IOHIP0[4]
27IOHIP0[6]
28PowerVddPower pin
29IOHIP0[7]
30IOHIP0[5]
31IOHIP0[3]
32PowerVssGround pin
Legend A = Analog, I = Input, O = Output, NC = No Connection, H = 5 mA High Output Drive, R = Regulated Output Option.
1
2
NameDescription
Analog
TC CLK
TC DATA
These are the ISSP pins, which are not High-Z at POR.
The center pad on the QFN package must be connected to ground (Vss) for best mechanical, thermal, and electrical performance. If not connected to ground, it must be electrically floated and not connected to any other signal.
2
1
, I2C SCL, SPI MOSI
1
, I2C SDA, SPI CLK
CY7C60445 enCoRe V LV Devices
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H16
1.1.3CY7C64345, CY7C64343, enCoRe V 32-Pin Part Pinout
P0[1]
P2[5]
P2[3]
P2[1]
P1[7]
P1[5]
QFN
(Top View)
9
101112
131415
16
1
2
3
4
5
6
7
8
24
23
22
21
20
19
18
17
32313029282726
25
Vss
P0[3]
P0[7]
Vdd
P0[6]
P0[4]
P0[2]
P1[3]
P1[1]
P0[0]
P2[6]
P3[0]
XRES
Vss
D+
D-
Vdd
P1[0]
P1[2]
P1[4]
P1[6]
P2[4]
P2[2]
P2[0]
P3[2]
P0[5]
Pin Information
Table 1-3. 32-Pin QFN Part Pinout
Pin
No.
Digital
1IOHIP0[1]
2IOIP2[5]XTAL Out
3IOIP2[3]XTAL In
4IOIP2[1]
5IOHRIP1[7]I2C SCL, SPI SS
6IOHRIP1[5]I2C SDA, SPI MISO
7IOHRIP1[3]SPI CLK
8IOHRIP1[1]
9PowerVssGround pin
10IOD+USB PHY
11IOD-USB PHY
12PowerVddPower pin
13 IOHRIP1[0]
14 IOHRIP1[2]
15 IOHRIP1[4]EXTCLK
16 IOHRIP1[6]
17InputXRES Active high external reset with internal
18IOIP3[0]
19IOIP3[2]
20IOIP2[0]
21IOIP2[2]
22IOIP2[4]
23IOIP2[6]
24IOHIP0[0]
25IOHIP0[2]
26IOHIP0[4]
27IOHIP0[6]
28PowerVddPower pin
29IOHIP0[7]
30IOHIP0[5]
31IOHIP0[3]
32PowerVssGround pin
LEGEND A = Analog, I = Input, O = Output, NC = No Connection, H = 5 mA High Output Drive, R = Regulated Output Option.
1
2
NameDescription
Analog
TC CLK
TC DATA
pull down
These are the ISSP pins, which are not High Z at POR (Power On Reset).
The center pad on the QFN package must be connected to ground (Vss) for best mechanical, thermal, and electrical performance. If not connected to ground, it must be electrically floated and not connected to any other signal.
2
1
, I2C SCL, SPI MOSI
1
, I2C SDA, SPI CLK
CY7C64345, CY7C64343 enCoRe V Devices
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H17
26InputXRESActive high external reset with internal pull down
27IOIP3[0]
28IOIP3[2]
29IOIP3[4]
30IOIP3[6]
32IOIP4[2]
33IOIP2[0]41PowerVddPower pin
34IOIP2[2]42NCNo connection
35IOIP2[4]43NCNo connection
36IOIP2[6]44IOHIP0[7]
37IOHIP0[0]45IOHIP0[5]
38IOHIP0[2]46IOHIP0[3]
39IOHIP0[4]47PowerVssGround pin
40IOHIP0[6]48IOHIP0[1]
Legend A = Analog, I = Input, O = Output, NC = No Connection, H = 5 mA High Output Drive, R = Regulated Output Option.
1
2
NameDescription
Analog
These are the ISSP pins, which are not High-Z at POR.
The center pad on the QFN package must be connected to ground (Vss) for best mechanical, thermal, and electrical performance. If not connected
to ground, it must be electrically floated and not connected to any other signal.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H18
1.1.5CY7C60455, CY7C60456 enCoRe V LV 48-Pin Part Pinout
QFN
(Top View)
P0[1]
Vss
P0[3]
P0[5]
P0[7]NCNC
Vdd
P0[6]
P0[4]
P0[2]
P0[0]
10
11
12
P2[7]
NC
P2[5]
P2[3]
P2[1]
P4[3]
P4[1]
P3[7]
P3[5]
P3[3]
P3[1]
P1[7]
35
34
33
32
31
30
29
28
27
26
25
36
4847464544
43424140393837
P2[4]
P2[2]
P2[0]
P4[2]
P4[0]
P3[6]
P3[4]
P3[2]
P3[0]
XRES
P1[6]
P2[6]
1
2
3
4
5
6
7
8
9
131415161718192021
22
23
24
P1[5]
NC
NC
P1[3]
P1[1]
Vss
NC
NC
Vdd
P1[0]
P1[2]
P1[4]
Pin Information
Table 1-5. 48-Pin Part Pinout
Pin
No.
Digital
1NCNo connection
2IOIP2[7]
3IOIP2[5]XTAL Out
4IOIP2[3]XTAL In
5IOIP2[1]
6IOIP4[3]
7IOIP4[1]
8IOIP3[7]
9IOIP3[5]
10IOIP3[3]
11IOIP3[1]
12 IOHRIP1[7]I2C SCL, SPI SS
13 IOHRIP1[5]I2C SDA, SPI MISO
14NCNo connection
15NCNo connection
16 IOHRIP1[3]SPI CLK
17 IOHRIP1[1]
18PowerVssGround pin
19NCNo connection
20NCNo connection
21PowerVddPower pin
22 IOHRIP1[0]
23 IOHRIP1[2]
24 IOHRIP1[4]EXTCLK
25 IOHRIP1[6]
26InputXRESActive high external reset with
27IOIP3[0]
28IOIP3[2]
29IOIP3[4]
30IOIP3[6]
31IOIP4[0]
32IOIP4[2]
33IOIP2[0]41PowerVddPower pin
34IOIP2[2]42NCNo connection
35IOIP2[4]43NCNo connection
36IOIP2[6]44IOHIP0[7]
37IOHIP0[0]45IOHIP0[5]
38IOHIP0[2]46IOHIP0[3]
39IOHIP0[4]47PowerVssGround pin
40IOHIP0[6]48IOHIP0[1]
LEGEND
A = Analog, I = Input, O = Output, NC = No Connection, H = 5 mA High Output Drive, R = Regulated Output Option.
1
2
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H19
2
CY7C60455, CY7C60456 enCoRe V LV Devices
NameDescription
Analog
1
TC CLK
, I2C SCL, SPI MOSI
1
TC DATA
internal pull down
These are the ISSP pins, which are not High Z at POR (Power On Reset).
The center pad on the QFN package must be connected to ground (Vss) for best mechanical, thermal, and electrical performance. If not connected to ground, it must be electrically floated and not connected to any other signal.
, I2C SDA, SPI CLK
Pin
No.
Digital
NameDescription
Analog
Pin Information
QFN
(Top View)
P0[1]
Vss
P0[3]
P0[5]
P0[7]
OCDE
OCDO
Vdd
P0[6]
P0[4]
P0[2]
P0[0]
10
11
12
P2[7]
OCDOE
P2[5]
P2[3]
P2[1]
P4[3]
P4[1]
P3[7]
P3[5]
P3[3]
P3[1]
P1[7]
35
34
33
32
31
30
29
28
27
26
25
36
4847464544
43424140393837
P2[4]
P2[2]
P2[0]
P4[2]
P4[0]
P3[6]
P3[4]
P3[2]
P3[0]
XRES
P1[6]
P2[6]
1
2
3
4
5
6
7
8
9
131415161718192021
22
23
24
P1[5]
CCLK
HCLK
P1[3]
P1[1]
Vss
D +
D -
Vdd
P1[0]
P1[2]
P1[4]
1.1.6CY8C20066A, CY8CTMG200-00LTXI, CY8CTMG200A-00LTXI PSoC, CY7C64300
enCoRe V and CY7C60400 enCoRe V LV OCD 48-Pin Part Pinout
The 48-pin QFN part is for on-chip debugging (OCD). Note that this part is only used for in-circuit debugging. It is NOT avail-able for production.
Table 1-6. 48-Pin OCD Part Pinout
Pin
No.
Digital
1OCDOE OCD directional pin
2IOIP2[7]
3IOIP2[5]XTAL Out
4IOIP2[3]XTAL In
5IOIP2[1]
6IOIP4[3]
7IOIP4[1]
8IOIP3[7]
9IOIP3[5]
10IOIP3[3]
11IOIP3[1]
12 IOHRIP1[7]I2C SCL, SPI SS
13 IOHRIP1[5]I2C SDA, SPI MISO
14CCLKOCD CPU CLK OUTPUT
15HCLKOCD HIGH SPEED CLK
16 IOHRIP1[3]SPI CLK
17 IOHRIP1[1]
18PowerVssGround pin
19IOD+USB PHY
20IOD–USB PHY
21PowerVddPower pin
22 IOHRIP1[0]
23 IOHRIP1[2]
24 IOHRIP1[4]EXTCLK
25 IOHRIP1[6]
26InputXRESActive high external reset with
27IOIP3[0]
28IOIP3[2]
29IOIP3[4]
30IOIP3[6]
31IOIP4[0]
32IOIP4[2]
33IOIP2[0]41PowerVddPower pin
34IOIP2[2]42OCDOOCD even data I/O
35IOIP2[4]43OCDEOCD odd data output
36IOIP2[6]44IOHIP0[7]
37IOHIP0[0]45IOHIP0[5]
38IOHIP0[2]46IOHIP0[3]
39IOHIP0[4]47PowerVssGround pin
40IOHIP0[6]48IOHIP0[1]
Legend
A = Analog, I = Input, O = Output, NC = No Connection, H = 5-mA High Output Drive, R = Regulated Output Option.
1
2
NameDescription
Analog
TC CLK
TC DATA
internal pull down
ISSP pin which is not High-Z at POR.
The center pad (CP) on the QFN package must be connected to ground (VSS) for best mechanical, thermal, and electrical performance. If not connected to ground, it must be electrically floated and not connected to any other signal.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H20
17InputXRESActive high external reset with internal pull-down
18I/OIP3[0]
19I/OIP3[2]
20I/OIP2[0]
21I/OIP2[2]
22I/OIP2[4]
23I/OIP2[6]
24IOHIP0[0]
25IOHIP0[2]
26IOHIP0[4]
27IOHIP0[6]
28PowerV
DD
Power Pin
29IOHIP0[7]
30IOHIP0[5]
31IOHIP0[3]Integrating Input
32PowerV
A = Analog, I = Input, O = Output, OH = 5 mA High Output Drive, R = Regulated Output.
Legend
1
On power-up, the SDA(P1[0]) drives a strong high for 256 sleep clock cycles and drives resistive low for the next 256 sleep clock cycles. The
SCL(P1[1])line drives resistive low for 512 sleep clock cycles and both the pins transition to high-impedance state. On reset, after XRES deasserts, the SDA and the SCL lines drive resistive low for 8 sleep clock cycles and transition to high-impedance state. Hence, during power-up or
reset event, P1[1] and P1[0] may disturb the I2C bus. Use alternate pins if you encounter issues.
2
The center pad on the QFN package must be connected to ground (Vss) for best mechanical, thermal, and electrical performance. If not con-
nected to ground, it must be electrically floated and not connected to any other signal.
3
Alternate SPI clock.
Ground Pin
SS
CY8C20496A/L PSoC Device
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H21
Legend A = Analog, I = Input, O = Output, NC = No Connection, H = 5 mA High Output Drive, R = Regulated Output Option.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H22
1
2
Analog
DD
Name
Description
Power Pin
Digital
Pin No.
pull-down
On power-up, the SDA(P1[0]) drives a strong high for 256 sleep clock cycles and drives resistive low for the next 256 sleep clock cycles. The
SCL(P1[1])line drives resistive low for 512 sleep clock cycles and both the pins transition to high-impedance state. On reset, after XRES deasserts, the SDA and the SCL lines drive resistive low for 8 sleep clock cycles and transition to high-impedance state. Hence, during power-up or
reset event, P1[1] and P1[0] may disturb the I2C bus. Use alternate pins if you encounter issues.
Alternate SPI clock.
43I/OIP2[6]
Section B: enCoRe V Core
1K, 2K
SRAM
Interrupt
Controller
Sleep and
Watchdog
Multiple Clock Sources
Internal Low Speed Oscillator (ILO)
6/12/24 MHz Internal Main Oscillator (IMO)
CORE
CPU Core (M8C)
Supervisory ROM (SROM)
8K, 16K, 32K Flash
Nonvolatile Memory
SYSTEM BUS
Port 3Port 2Port 1Port 0
1.8/2.5/3V
LDO
PWRSYS
(Regulator)
Port 4
The enCoRe V Core section discusses the core components of an enCoRe V device with a base part number of CY7C643xx
and CY7C604xx and the registers associated with those components. The core section covers the heart of the enCoRe V
device, which includes the M8C microcontroller; SROM, interrupt controller, GPIO, and SRAM paging; multiple clock
sources such as IMO and ILO; and sleep and watchdog functionality. This section includes these chapters:
■ CPU Core (M8C) on page 26.
■ Supervisory ROM (SROM) on page 32.
■ RAM Paging on page 38.
■ Interrupt Controller on page 44.
■ General-Purpose I/O (GPIO) on page 52.
Top-Level Core Architecture
This figure displays the top-level architecture of the enCoRe V core. Each component of the figure is discussed at length in
this section.
enCoRe V Core Block Diagram
■ Internal Main Oscillator (IMO) on page 67.
■ Internal Low-speed Oscillator (ILO) on page 72.
■ External Crystal Oscillator (ECO), on page 74
■ Sleep and Watchdog on page 78.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H23
Core Register Summary
This table lists all the enCoRe V registers for the CPU core in address order within their system resource configuration. The
grayed out bits are reserved bits. If you write these bits, always write them with a value of ‘0’. For the core registers, the first
‘x’ in some register addresses represents either bank 0 or bank 1. These registers are listed throughout this manual in bank
L The and f, expr; or f, expr; and xor f, expr instructions can be used to modify this register.
x An “x” before the comma in the address field indicates that this register can be accessed or written to no matter what bank is used.
C Clearable register or bit(s).
R Read register or bit(s).
W Write register or bit(s).
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H25
2. CPU Core (M8C)
This chapter explains the CPU Core, called the M8C, and its associated register. It covers the internal M8C registers, address
spaces, instruction set and formats. For additional information concerning the M8C instruction set, refer to the PSoCDesigner Assembly Language User Guide available at http://www.cypress.com. For a quick reference of all enCoRe V regis-
ters in address order, refer to the Register Reference chapter on page 163.
2.1Overview
The M8C is a four MIPS 8-bit Harvard architecture micropro-
cessor. Selectable processor clock speeds up to 24 MHz
enable you to tune the M8C to a particular application’s performance and power requirements. The M8C supports a rich
instruction set that allows for efficient low-level language
support.
2.2Internal Registers
The M8C has five internal registers that are used in program
execution. Here is a list of these registers.
■ Accumulator (A)
■ Index (X)
■ Program Counter (PC)
■ Stack Pointer (SP)
■ Flags (F)
All the internal M8C registers are 8 bits in width, except for
the PC, which is 16 bits wide. Upon reset, A, X, PC, and SP
are reset to 00h. The Flag register (F) is reset to 02h, indi-
cating that the Z flag is set.
With each stack operation, the SP is automatically incre-
mented or decremented so that it always points to the next
stack byte in RAM. If the last byte in the stack is at address
, the stack pointer wraps to RAM address 00h. It is the
FFh
firmware developer’s responsibility to ensure that the stack
does not overlap with user-defined variables in RAM.
The F register is read by using address F7h in either register
bank.
2.3Address Spaces
The M8C has three address spaces: ROM, RAM, and regis-
ters. The ROM address space includes the Supervisory
ROM (SROM) and the flash. The ROM address space is
accessed through its own address and data bus.
The ROM address space is composed of the SROM and the
on-chip flash program store. Flash is organized into 128byte blocks. Program store page boundaries are not an
issue because the M8C automatically increments the 16-bit
PC on every instruction. This makes the block boundaries
invisible to user code. Instructions occurring on a 128-byte
flash page boundary (with the exception of JMP instructions)
incur an extra M8C clock cycle, because the upper byte of
the PC is incremented.
The register address space is used to configure the enCoRe
Vmicrocontroller’s programmable blocks. It consists of two
banks of 256 bytes each. To switch between banks, the XIO
bit in the Flag register is set or cleared (set for Bank1,
cleared for Bank0). The common convention is to leave the
bank set to Bank0 (XIO cleared), switch to Bank1 as needed
(set XIO), then switch back to Bank0.
With the exception of the F register, the M8C internal registers are not accessible via an explicit register address. The
internal M8C registers are accessed using these instructions:
■ MOV A, expr
■ MOV X, expr
■ SWAP A, SP
■ OR F, expr
■ JMP LABEL
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H26
CPU Core (M8C)
2.4Instruction Set Summary
The instruction set is summarized in both Ta bl e 2-1 and Table 2-2 (in numeric and mnemonic order, respectively), and serves
as a quick reference. If more information is needed, the Instruction Set Summary tables are described in detail in the PSoCDesigner Assembly Language User Guide (visit http://www.cypress.com).
Table 2-1. Instruction Set Summary Sorted Numerically by Opcode
Instruction FormatFlags
Bytes
Cycles
Opcode Hex
00 151 SSC2D 82 OR [X+expr], AZ5A52 MOV [expr], X
01 42 ADD A, exprC, Z2E93 OR [expr], exprZ5B 41 MOV A, XZ
02 62 ADD A, [expr]C, Z2F 103 OR [X+expr], exprZ5C 41 MOV X, A
03 72 ADD A, [X+expr]C, Z30 91 HALT5D 62 MOV A, reg[expr]Z
04 72 ADD [expr], AC, Z31 42 XOR A, exprZ5E 72 MOV A, reg[X+expr]Z
Note 2 The number of cycles required by an instruction is increased by one for instructions that span
128 byte page boundaries in the flash memory space.
if (A=B) Z=1
if (A<B) C=1
Opcode Hex
3E 10 2 MVI A, [ [expr]++ ]Z47 8 3 TST [expr], exprZ
Instruction FormatFlags
Bytes
Cycles
Cycles
Opcode Hex
Instruction FormatFlags
Bytes
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H28
CPU Core (M8C)
2.5Instruction Formats
The M8C has a total of seven instruction formats that use
instruction lengths of one, two, and three bytes. All instruction bytes are taken from the program memory (flash), using
an address and data bus that are independent from the
address and data buses used for register and RAM access.
While examples of instructions are given in this section,
refer to the PSoC Designer Assembly Language User Guide
for detailed information on individual instructions.
2.5.1One-Byte Instructions
Many instructions, such as some of the MOV instructions,
have single-byte forms because they do not use an address
or data as an operand. As shown in Table 2-3, one-byte
instructions use an 8-bit opcode. The set of one-byte
instructions are divided into four categories, according to
where their results are stored.
Table 2-3. One-Byte Instruction Format
Byte 0
8-Bit Opcode
The first category of one-byte instructions are those that do
not update any register or RAM. Only the one-byte NOP and
SSC instructions fit this category. While the program coun-
ter is incremented as these instructions execute, they do not
cause any other internal M8C registers to update, nor do
these instructions directly affect the register space or the
RAM address space. The SSC instruction causes SROM
code to run, which modifies RAM and the M8C internal registers.
The second category contains the two PUSH instructions.
The PUSH instructions are unique because they are the only
one-byte instructions that modify a RAM address. These
instructions automatically increment the SP.
The third category contains the HALT instruction. The
instruction is unique because it is the only one-byte instruction that modifies a user register. The HALT instruction modifies user register space address FFh (CPU_SCR0 register).
The final category for one-byte instructions are those that
update the internal M8C registers. This category holds the
largest number of instructions:
ASL, ASR, CPL, DEC, INC,
MOV, POP, RET, RETI , RLC, ROMX, RRC, SWAP. These
instructions cause the A, X, and SP registers or SRAM to
update.
HALT
2.5.2Two-Byte Instructions
The majority of M8C instructions are two bytes in length.
While these instructions are divided into categories identical
to the one-byte instructions, this does not provide a useful
distinction between the three two-byte instruction formats
that the M8C uses.
Table 2-4. Two-Byte Instruction Formats
Byte 0Byte 1
4-Bit Opcode 12-Bit Relative Address
8-Bit Opcode8-Bit Data
8-Bit Opcode8-Bit Address
The first two-byte instruction format, shown in the first row of
Table 2-4, is used by short jumps and calls:
JACC, INDEX, JC, JNC, JNZ, JZ. This instruction format
uses only four bits for the instruction opcode, leaving 12 bits
to store the relative destination address in a two’s-complement form. These instructions can change program execution to an address relative to the current address by –2048
or +2047.
The second two-byte instruction format, shown in the second row of Table 2-4, is used by instructions that employ the
Source Immediate addressing mode (see the PSoCDesigner Assembly Language User Guide). The destination
for these instructions is an internal M8C register, while the
source is a constant value. An example of this type of
instruction is
The third two-byte instruction format, shown in the third row
of Ta b le 2 -4, is used by a wide range of instructions and
addressing modes. The following is a list of the addressing
modes that use this third two-byte instruction format:
■ Source Direct (ADD A, [7])
■ Source Indexed (ADD A, [X+7])
■ Destination Direct (ADD [7], A)
■ Destination Indexed (ADD [X+7], A)
■ Source Indirect Post Increment (MVI A, [7])
■ Destination Indirect Post Increment (MVI [7], A)
For more information on addressing modes see the PSoC
Designer Assembly Language User Guide.
ADD A, 7.
CALL, JMP,
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H29
CPU Core (M8C)
2.5.3Three-Byte Instructions
The three-byte instruction formats are the second most
prevalent instruction formats. These instructions need three
bytes because they either move data between two
addresses in the user accessible address space (registers
and RAM) or they hold 16-bit absolute addresses as the
destination of a long jump or long call.
Table 2-5. Three-Byte Instruction Formats
Byte 0Byte 1Byte 2
8-Bit Opcode16-Bit Address (MSB, LSB)
8-Bit Opcode8-Bit Address8-Bit Data
8-Bit Opcode8-Bit Address8-Bit Address
The first instruction format, shown in the first row of
Table 2-5, is used by the LJMP and LCALL instructions.
These instructions change program execution unconditionally to an absolute address. The instructions use an 8-bit
opcode, leaving room for a 16-bit destination address.
The second three-byte instruction format, shown in the second row of Tab l e 2- 5, is used by the following two addressing modes:
■ Destination Direct Source Immediate (ADD [7], 5)
■ Destination Indexed Source Immediate
(ADD [X+7], 5)
The third three-byte instruction format, shown in the third
row of Ta bl e 2-5, is for the Destination Direct Source Direct
addressing mode, which is used by only one instruction.
This instruction format uses an 8-bit opcode followed by two
8-bit addresses. The first address is the destination address
in RAM, while the second address is the source address in
RAM. The following is an example of this instruction:
MOV [7], [5]
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H30
CPU Core (M8C)
2.6Register Definitions
The following register is associated with the CPU Core (M8C). The register description has an associated register table showing the bit structure. The bits that are grayed out in the table are reserved bits and are not detailed in the register description
that follows. Always write reserved bits with a value of ‘0’.
L The AND F, expr; OR F, expr; and XOR F, expr flag instructions can be used to modify this register.
x An “x” before the comma in the address field indicates that this register can be read or written to no matter what bank is used.
The M8C Flag Register (CPU_F) provides read access to
the M8C flags.
Bits 7 and 6: PgMode[1:0]. PgMode determines how the
CUR_PP, STK_PP, and IDX_PP registers are used in forming effective RAM addresses for Direct Address mode and
Indexed Address mode operands. PgMode also determines
whether the stack page is determined by the STK_PP or
IDX_PP register. (See the Register Definitions on page 41 in
the RAM Paging chapter.)
Bit 4: XIO. The I/O bank select bit, also known as the register bank select bit, is used to select the register bank that is
active for a register read or write. This bit allows the enCoRe
V device to have 512 8-bit registers and is thought of as the
ninth address bit for registers. The address space accessed
when the XIO bit is set to ‘0’ is called user space, while
address space accessed when the XIO bit is set to ‘1’ is
called configuration space.
Bit 2: Carry. The Carry flag bit is set or cleared in response
to the result of several instructions. It is also manipulated by
the flag logic opcodes (for example, OR F, 4). See the PSoCDesigner Assembly Language User Guide for more details.
Bit 1: Zero. The Zero flag bit is set or cleared in response
to the result of several instructions. It is also manipulated by
the flag logic opcodes (for example, OR F, 2). See the PSoCDesigner Assembly Language User Guide for more details.
Bit 0: GIE. The state of the Global Interrupt Enable bit
determines whether interrupts (by way of the interrupt
request (IRQ)) are recognized by the M8C. This bit is set or
cleared using the flag logic instructions (for example, OR F,
1). GIE is also automatically cleared when an interrupt is
processed, after the flag byte is stored on the stack, pre-
venting nested interrupts. If wanted, set the bit in an inter-rupt service routine (ISR). For GIE=1, the M8C samples
the IRQ input for each instruction. For GIE=0, the M8C
ignores the IRQ.
For additional information, refer to the CPU_F register on
page 208.
2.6.2Related Registers
The following registers are related to the M8C block:
■ CPU_SCR1 register on page 210.
■ CPU_SCR0 register on page 211.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H31
3. Supervisory ROM (SROM)
This chapter discusses the Supervisory ROM (SROM) functions. For a quick reference of all enCoRe V registers in address
order, refer to the Register Reference chapter on page 163.
3.1Architectural Description
The SROM holds code that boots a enCoRe V device, calibrates circuitry, and performs flash operations. The functions provided by the SROM are called from code stored in
the flash or by device programmers.
The SROM is used to boot the part and provide interface
functions to the flash blocks. Table 3-1 lists the SROM func-
tions. The SROM functions are accessed by executing the
Supervisory System Call instruction (SSC), which has an
opcode of 00h. Before executing the SSC, the M8C's accumulator needs to load with the wanted SROM function code
from Ta bl e 3-1.
Attempting to access undefined functions (Reserved functions) causes a HALT. The SROM functions execute code
with calls; therefore, the functions require stack space. With
the exception of Reset, all of the SROM functions have a
parameter block in SRAM that you must configure before
executing the SSC.
Table 3-2 lists all possible parameter block variables. The
meaning of each parameter, with regards to a specific
SROM function, is described later in this chapter. Because
the SSC instruction clears the CPU_F PgMode bits, all
parameter block variable addresses are in SRAM Page 0.
The CPU_F value is automatically restored at the end of the
SROM function.
The MVR_PP and MVW_PP pointers are not disabled by
clearing the CPU_F PgMode bits. Therefore, the POINTER
parameter is interpreted as an address in the page indicated
by the MVI page pointers, when the supervisory operation is
called. This allows the data buffer used in the supervisory
operation to be located in any SRAM page. (See the RAM
Paging chapter on page 38 for more details regarding the
MVR_PP and MVW_PP pointers.)
Table 3-1. List of SROM Functions
Function CodeFunction Name
00hSWBootReset033
01hReadBlock734
02hWriteBlock734
03hEraseBlock535
06hTableRead335
07hCheckSum436
08hCalibrate0436
09hCalibrate1336
0AhWriteAndVerify736
0FhHWBootReset337
Note ProtectBlock and EraseAll (described on page 35) SROM functions are
not listed in this table because they are dependent on external programming.
Required
Stack Space
Page
Table 3-2. SROM Function Variables
Vari able NameSRAM Address
KEY1/RETURN CODE0,F8h
KEY20,F9h
BLOCKID0,FAh
POINTER0,FBh
CLOCK0,FCh
Reserved0,FDh
DELAY0,FEh
Reserved0,FFh
Note CLOCK and DELAY are ignored and are reserved for future use.
Two important variables that are used for all functions are
KEY1 and KEY2. These variables are used to help discriminate between valid SSCs and inadvertent SSCs. KEY1 must
always have a value of 3Ah, while KEY2 must have the
same value as the stack pointer when the SROM function
begins execution. This is the SP (Stack Pointer) value when
the SSC opcode is executed, plus three. For all SROM functions except SWBootReset, if either of the keys do not
match the expected values, the M8C halts. The SWBootReset function does not check the key values. It only checks to
see if the accumulator's value is 00h.
The following code example puts the correct value in KEY1
and KEY2. The code is preceded by a HALT, to force the
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H32
Supervisory ROM (SROM)
program to jump directly into the setup code and not accidentally run into it.
1.halt
2. SSCOP: mov [KEY1], 3ah
3.mov X, SP
4.mov A, X
5.add A, 3
6.mov [KEY2], A
3.1.1Additional SROM Feature
Return Codes: These aid in the determination of success
or failure of a particular function. The return code is stored in
KEY1’s position in the parameter block. The Checksum and
TableRead functions do not have return codes because
KEY1’s position in the parameter block is used to return
other data.
Table 3-3. SROM Return Code Meanings
Return Code
Value
00hSuccess.
01hFunction not allowed because of block level protection.
02hSoftware reset without hardware reset.
03hFatal error, SROM halted.
04hWrite and Verify error.
06hFailure of Smartwrite parameters CheckSum
Description
starts over. If this condition occurs, the internal reset status
bit (IRESS) is set in the CPU_SCR1 register.
In devices with more than 256 bytes of SRAM, no SRAM is
modified by the SWBootReset function in SRAM pages
numbered higher than '0'.
Table 3-5 documents the value of all the SRAM addresses in
Page 0 after a successful SWBootReset. A value of “xx”
indicates that the SRAM address is not modified by the
SWBootReset function. A hex value indicates that the
address always has the indicated value after a successful
SWBootReset. A “??” indicates that the value, after a
SWBootReset, is determined by the value of the IRAMDIS
bit in the CPU_SCR1 register. If IRAMDIS is not set, these
addresses are initialized to 00h. If IRAMDIS is set, these
addresses are not modified by a SWBootReset after a
watchdog reset.
The IRAMDIS bit allows the preservation of variables even if
a watchdog reset (WDR) occurs. The IRAMDIS bit is reset
by all system resets except watchdog reset. Therefore, this
bit is only useful for watchdog resets and not general resets.
Note Read, write, and erase operations may fail if the target
block is read or write protected. Block protection levels are
set during device programming and cannot be modified from
code in the enCoRe V device.
3.1.2SROM Function Descriptions
3.1.2.1SWBootReset Function
The SROM function SWBootReset is responsible for transitioning the device from a reset state to running user code.
See Chapter “System Resets” on page 114 for more infor-
mation on what events causes the SWBootReset function to
execute.
The SWBootReset function executes whenever the SROM
is entered with an M8C accumulator value of 00h; the SRAM
parameter block is not used as an input to the function. This
happens, by design, after a hardware reset because the
M8C's accumulator is reset to 00h or when user code executes the SSC instruction with an accumulator value of 00h.
If the checksum of the calibration data is valid, the
SWBootReset function ends by setting the internal M8C registers (CPU_SP, CPU_PC, CPU_X, CPU_F, CPU_A) to 00h,
writing 00h to most SRAM addresses in SRAM Page 0, and
then begins to execute user code at address 0000h. See
Table 3-5 and the following paragraphs for more information
on which SRAM addresses are modified. If the checksum is
not valid, an internal reset is executed and the boot process
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H33
Table 3-5. SRAM Map Post SWBootReset (00h)
01234567
Address
0x0_
0x1_
0x2_
0x3_
0x4_
0x5_
0x6_
0x7_
0x8_
0x9_
0xA_
0xB_
0xC_
0xD_
0xE_
0xF_
89ABCDEF
0x00 0x000x00??????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
????????????????
0x00 0x000x000x000x00 0x000x000x00
0x00 0x000x000x000x00 0x000x000x00
0x00 0x000x000x000x00 0x000x000x00
0x00 0x000x000x000x00 0x000x000x00
0x00 0x000x000x000x00 0x00????
0x00
0x02
Xx0x000x000xnxx0x000x00
0x06
Address F8h is the return code byte for all SROM functions
(except Checksum and TableRead); for this function, the
only acceptable values are 00h, 02h, and 06h. Address FCh
is the fail count variable. After POR, WDR, or XRES, the
variable is initialized to 00h by the SROM. Each time the
Checksum fails, the fail count is incremented. Therefore, if it
takes two passes through SWBootReset to get a good
Checksum, the fail count is 01h.
3.1.2.2ReadBlock Function
The ReadBlock function is used to read 128 contiguous
bytes from flash: a block. The enCoRe V device has 32 KB
Supervisory ROM (SROM)
of flash and has two hundred fifty-six 128-byte blocks. Valid
block IDs are 00h to FFh.
Table 3-6. Flash Memory Organization
enCoRe V
Device
CY7C6xxxx, 32 KB2K Bytes2561
Amount of
Flash
Amount of
SRAM
Number of
Blocks
per Bank
Number of
Banks
The first thing the ReadBlock function does is check the protection bits to determine if the wanted BLOCKID is readable.
If read protection is turned on, the ReadBlock function exits
setting the accumulator and KEY2 back to 00h. KEY1 has a
value of 01h indicating a read failure.
If read protection is not enabled, the function reads 128
bytes from the flash using a ROMX instruction and stores the
results in SRAM using an MVI instruction. The 128 bytes are
stored in SRAM, beginning at the address indicated by the
value of the POINTER parameter. When the ReadBlock
completes successfully, the accumulator, KEY1, and KEY2
has a value of 00h.
Note An MVI [expr], A stores the flash block contents in
SRAM meaning that you can use the MVW_PP register to
indicate which SRAM pages receive the data.
The WriteBlock function stores data in the flash. No verification of the data is performed, but execution time is about
1 ms less than the WriteAndVerify function. The WriteAndVerify function is the recommended method for altering the
data in one flash block (see “WriteAndVerify Function” on
page 36). Data moves 128 bytes at a time from SRAM to
flash. This is a two-step process, the first step is to load the
page latch with 128 bytes of data and it is followed by the
programming of the corresponding block of flash. No erase
is needed before WriteBlock.
If write protection is turned on, then the WriteBlock function
exits, setting the accumulator and KEY2 back to 00h. KEY1
has a value of 01h, indicating a write failure. Write protection
is set when the enCoRe V device is programmed externally
and cannot be changed through the SSC function.
The BLOCKID of the flash block, where the data is stored,
must be determined and stored at SRAM address FAh. Valid
block IDs are 00h to FFh.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H34
Supervisory ROM (SROM)
An MVI A, [expr] instruction is used to move data from
SRAM into flash. Therefore, use the MVI read pointer
(MVR_PP register) to specify which SRAM page from which
data is pulled. Using the MVI read pointer and the parameter
blocks POINTER value allows the SROM WriteBlock function to move data from any SRAM page into any flash block.
The SRAM address, the first of the 128 bytes to store in
flash, is indicated using the POINTER variable in the parameter block (SRAM address FBh).
First of 128 addresses in SRAM, where
the data to be stored in flash, is located
before calling WriteBlock.
SSC is
3.1.2.4EraseBlock Function
The EraseBlock function is not recommended for use. The
functionality is redundant with the WriteBlock and WriteAndVerify functions. The only practical use is for clearing all data
in a 128 byte block of contiguous bytes in flash to 00h. If
used, it should not be called repeatedly on the same block.
It may be used between WriteAndVerify or WriteBlock operations.
If write protection is turned on, then the EraseBlock function
exits, setting the accumulator and KEY2 back to 00h. KEY1
has a value of 01h, indicating a write failure.
To set up the parameter block for the EraseBlock function,
store the correct key values in KEY1 and KEY2. The block
number to erase must be stored in the BLOCKID variable.
Table 3-9. EraseBlock Parameters (03h)
NameAddressTy peDescription
KEY10,F8hRAM3Ah.
KEY20,F9hRAM
BLOCKID 0,FAhRAMFlash block number.
Stack Pointer value+3, when SSC is
executed.
3.1.2.5ProtectBlock Function
The enCoRe V devices offer flash protection on a block-byblock basis. Table 3- 1 0 lists the protection modes available.
In the table, ER and EW indicate the ability to perform external reads and writes (that is, by an external programmer).
For internal writes, IW is used. Internal reading is always
permitted by way of the ROMX instruction. An SR indicates
the ability to read by way of the SROM ReadBlock function.
In this table, note that all protection is removed by EraseAll.
Table 3-10. Protect Block Modes
ModeSettingsDescriptionIn PSoC Designer
00bSR ER EW IWUnprotectedU = Unprotected
01bSR
10bSR
11bS R
ER EW IWRead protectF = Factory upgrade
ER EW IWDisable external writeR = Field upgrade
ER EW IWDisable internal writeW = Full protection
Table 3-11. Protection Level Bit Packing
76543210
Block n+3Block n+2Block n+1Block n
3.1.2.6TableRead Function
The TableRead function gives the user access to part-specific data stored in the flash during manufacturing. The flash
for these tables is separate from the program flash and is
not directly accessible. It also returns a revision ID for the
die (do not confuse this with the silicon ID stored in the Table
0 row in Ta bl e 3-14 ).
A summary of the information stored in the tables for the
flash is contained in Table 3-14.CY8C20X66A/AS/
LCY8C20X46A/46AS/96A/46L/96L
Table 3-12. TableRead Parameters (06h)
NameAddressTypeDescription
KEY10,F8hRAM3Ah.
KEY20,F9hRAM
BLOCKID 0,FAhRAMTable number to read.
Stack Pointer value+3, when
executed.
SSC is
3.1.2.7EraseAll Function
The EraseAll function performs a series of steps that
destroys the user data in the flash banks and resets the protection block in each flash bank to all zeros (the unprotected
state). This function is only executed by an external programmer. If EraseAll is executed from code, the M8C HALTs
without touching the flash or protections. See Table 3-13.
The three other hidden blocks above the protection block, in
each flash bank, are not affected by the EraseAll.
Table 3-13. EraseAll Parameters (05h)
NameAddressTy peDescription
KEY10,F8hRAM3Ah.
KEY20,F9hRAM
Stack Pointer value+3, when
executed.
SSC is
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H35
The Checksum function calculates a 16-bit checksum over a
user specifiable number of blocks, within a single flash bank
starting at block zero. The BLOCKID parameter is used to
pass in the number of blocks to checksum. A BLOCKID
value of '1' calculates the checksum of only block 0, while a
BLOCKID value of '0' calculates the checksum of the entire
flash bank.
The 16-bit checksum is returned in KEY1 and KEY2. The
parameter KEY1 holds the lower 8 bits of the checksum and
the parameter KEY2 holds the upper 8 bits of the checksum.
Table 3-15. Checksum Parameters (07h)
NameAddressTypeDescription
KEY10,F8hRAM3Ah.
KEY20,F9hRAM
BLOCKID 0,FAhRAM
Stack Pointer value+3, when
executed.
Number of flash blocks from which to
calculate the checksum.
SSC is
3.1.2.9Calibrate0 Function
This function may be executed at any time to set all calibration values. However, it is unnecessary to call this function; it
is simply documented for completeness. The calibration values are accessed using the TableRead function, which is
described in the section TableRead Function, on page 35.
Table 3-16. Calibrate0 Parameters (08h)
NameAddressTyp eDescription
KEY10,F8hRAM3Ah.
KEY20,F9hRAM
Stack Pointer value+3, when
executed.
SSC is
3.1.2.10Calibrate1 Function
While the Calibrate1 function is a completely separate function from Calibrate0, they perform the same task, which is to
transfer the calibration values stored in a special area of
flash to their appropriate registers. What is unique about
Calibrate1 is that it calculates a checksum of the calibration
data and, if that checksum is determined as invalid,
Calibrate1 causes a hardware reset by generating an inter-
nal reset. If this occurs, it is indicated by setting the Internal
Reset Status bit (IRESS) in the CPU_SCR1 register.
The Calibrate1 function uses SRAM to calculate a checksum of the calibration data. The POINTER value is used to
indicate the address of a 38-byte buffer used by this function. When the function completes, the 38 bytes are set to
00h.
An MVI A, [expr] and an MVI [expr], A instruction
are used to move data between SRAM and flash. Therefore,
the MVI write pointer (MVW_PP) and the MVI read pointer
(MVR_PP) must be specified to the same SRAM page to
control the page of RAM used for the operations.
Calibrate1 was created as a sub-function of SWBootReset
and the Calibrate1 function code was added to provide
direct access. For more information on how Calibrate1
works, see SWBootReset Function on page 33.
This function may be executed at any time to reset all calibration values. However, it is unnecessary to call this function; it is simply documented for completeness. The
calibration values are accessed using the TableRead function, which is described in the section TableRead Function
on page 35.
Table 3-17. Calibrate1 Parameters (09h)
NameAddressTyp eDescription
KEY10,F8hRAM3Ah.
KEY20,F9hRAM
POINTER 0,FBhRAM
MVR_PP0,D4hRegister
MVW_PP 0,D5hRegister
Stack Pointer value+3, when
executed.
First of 30 SRAM addresses used by
this function.
MVI write page pointer.
MVI read page pointer.
SSC is
3.1.2.11WriteAndVerify Function
WriteAndVerify is the recommend function for modifying one
block of data in flash. The WriteAndVerify function works
exactly the same as the WriteBlock function except that the
flash data is verified after the Write. The execution time is
about 1 ms longer than WriteBlock (but still within the Twrite
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H36
spec). The function performs a three-step process. In the
first step, 128 bytes of data are moved from SRAM to the
flash. In the second step, flash is programmed with the data.
In the final step, the flash data is compared against the input
data values, thus verifying that the write was successful.
The write and verify is one SROM operation; therefore, the
SROM is not exited until the verify is completed.
The parameters for this block are identical to the WriteBlock
(see WriteBlock Function on page 34). If the verify operation
fails, the 04h error code is returned at SRAM address F8h
Table 3-18. WriteAndVerify Parameters (0Ah)
NameAddressTypeDescription
KEY10,F8hRAM3Ah.
KEY20,F9hRAM
BLOCKID 0,FAhRAMFlash block number.
POINTER 0,FBhRAM
Stack Pointer value+3, when
executed.
First of 128 addresses in SRAM, where
the data to be stored in flash, is located
before calling WriteBlock.
SSC is
3.1.2.12HWBootReset Function
Supervisory ROM (SROM)
The HWBootReset function is used to force a hardware
reset. A hardware reset causes all registers to go back to
their POR state. Then, the SROM SWBootReset function
executes, followed by flash code execution beginning at
address 0x0000.
The HWBootReset function only requires that the CPU_A,
KEY1, and KEY2 be set up correctly. As with all other
SROM functions, if the setup is incorrect, the SROM executes a HALT. Then, either a POR, XRES, or WDR is
needed to clear the HALT. See Chapter “System Resets” on
page 114 for more information.
Table 3-19. HWBootReset Parameters (0Fh)
Name Address Ty peDescription
KEY10,F8hRAM 3Ah.
KEY20,F9hRAM Stack Pointer value+3, when
SSC is executed.
3.2Register Definitions
This chapter has no register detail information because
there are no registers directly assigned to the Supervisory
ROM.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H37
4. RAM Paging
Page 0
SRAM
256 Bytes
ISR
Page 6
SRAM
256 Bytes
Page 5
SRAM
256 Bytes
Page 3
SRAM
256 Bytes
Page 2
SRAM
256 Bytes
Page 1
SRAM
256 Bytes
Page 7
SRAM
256 Bytes
Page 4
SRAM
256 Bytes
00h
FFh
This chapter explains the enCoRe V device’s use of RAM Paging and its associated registers. For a complete table of the
RAM paging registers, refer to the Summary Table of the Core Registers on page 24. For a quick reference of all enCoRe V
registers in address order, refer to the Register Reference chapter on page 163.
4.1Architectural Description
The M8C is an 8-bit CPU with an 8-bit memory address bus.
The memory address bus allows the M8C to access up to
256 bytes of SRAM, to increase the amount of available
SRAM and preserve the M8C assembly language. The
enCoRe V device has 1K and 2K bytes of SRAM with eight
pages of memory architecture.
To take full advantage of the paged memory architecture of
the enCoRe V device, you use several registers and manage two CPU_F register bits. However, the power-on-reset
(POR) value for all of the paging registers and CPU_F bits is
zero. This places the enCoRe V device in a mode identical
to devices with only 256 bytes of SRAM. There is no need to
understand all of the paging registers to take advantage of
the additional SRAM available in some devices. To use the
additional SRAM pages, modify the memory paging logic
reset state.
The memory paging architecture consists of five areas:
■ Stack Operations
■ Interrupts
■ MVI Instructions
■ Current Page Pointer
■ Indexed Memory Page Pointer
Figure 4-1. Data Memory Organization
The first three of these areas do not depend upon the
CPU_F register's PgMode bits and are covered in the subsections after Basic Paging. The function of the last two
depend upon the CPU_F PgMode bits and are covered last.
4.1.1Basic Paging
To increase the amount of SRAM, the M8C accesses memory page bits. The memory page bits are located in the
CUR_PP register and allow selection of one of eight SRAM
pages. In addition to setting the page bits, Page mode is
enabled by setting the CPU_F[7] bit. If Page mode is not
enabled, the page bits are ignored and all non-stack memory access is directed to Page 0.
After Page mode is enabled and the page bits are set, all
instructions that operate on memory access the SRAM page
indicated by the page bits. The exceptions to this are the
instructions that operate on the stack and the MVI instructions: PUSH, POP, LCALL, RETI, RET, CALL, and MVI. See
the description of Stack Operations and MVI Instructions for
a more detailed discussion.
4.1.2Stack Operations
As mentioned previously, the paging architecture's reset
state puts the enCoRe Vin a mode identical to that of a 256byte device. Therefore, upon reset, all memory accesses
are to Page 0. The SRAM page that stack operations use is
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H38
determined by the value of the three least significant bits
(LSb) of the Stack Page Pointer register (STK_PP). Stack
operations have no dependency on the PgMode bits in the
CPU_F register. Stack operations are those that use the
Stack Pointer (SP) to calculate their affected address. Refer
RAM Paging
to the PSoC Designer Assembly Language User Guide for
more information on all M8C instructions.
Stack memory accesses are a special case. If they were not,
the stack could fragment across several pages. To prevent
the stack from fragmenting, all instructions that operate on
the stack automatically use the page indicated by the
STK_PP register. Therefore, if the program encounters a
CALL, the enCoRe V device automatically pushes the program counter onto the stack page indicated by STK_PP.
After the program counter is pushed, the SRAM paging
mode automatically switches back to the precall mode. All
other stack operations, such as RET and POP, follow the
same rule as CALL. The stack is confined to a single SRAM
page and the Stack Pointer wraps from 00h to FFh and FFh
to 00h. The user code must ensure that the stack is not
damaged because of stack wrapping.
Because the value of the STK_PP register can change at
any time, it is theoretically possible to manage the stack in
such a way as to allow it to grow beyond one SRAM page or
manage multiple stacks. However, the only supported use of
the STK_PP register is when its value is set before the first
stack operation and not changed again.
4.1.3Interrupts
Interrupts, in a multipage SRAM enCoRe V device, operate
the same as interrupts in a 256-byte device. However,
because the CPU_F register is automatically set to 00h on
an interrupt and because of the nonlinear nature of interrupts in a system, other parts of the memory paging architecture can be affected.
Interrupts are an abrupt change in program flow. If no special action is taken on interrupts by the enCoRe V device,
the interrupt service routine (ISR) could be thrown into
any SRAM page. To prevent this problem, the special
addressing modes for all memory accesses, except for
stack and MVI, are disabled when an ISR is entered. The
special addressing modes are disabled when the CUP_F
register is cleared. At the end of the ISR, the previous
SRAM addressing mode is restored when the CPU_F register value is restored by the RETI instruction.
All interrupt service routine code starts execution in SRAM
Page 0. If the ISR must change to another SRAM page, do
this by changing the values of the CPU_F[7:6] bits to enable
the special SRAM addressing modes. However, any change
made to the CUR_PP, IDX_PP, or STK_PP registers persists after the ISR returns. Therefore, have the ISR save the
current value of any paging register it modifies and restore
its value before the ISR returns.
4.1.4MVI Instructions
MVI instructions use data page pointers of their own
(MVR_PP and MVW_PP). This allows a data buffer to be
located away from other program variables, but accessible
without changing the Current Page Pointer (CUR_PP).
An MVI instruction performs three memory operations. Both
forms of the MVI instruction access an address in SRAM
that holds the data pointer (a memory read 1st access),
incrementing that value and then storing it back in SRAM (a
memory write 2nd access). This pointer value must reside in
the current page, just as all other nonstack and nonindexed
operations on memory. However, the third memory operation uses the MVx_PP register. This third memory access is
either a read or a write, depending upon which MVI instruction is used. The MVR_PP pointer is used for the MVI
instruction that moves data into the accumulator. The
MVW_PP pointer is used for the MVI instruction that moves
data from the accumulator into SRAM. The MVI pointers are
always enabled, regardless of the state of the Flag register
page bits (CPU_F register).
4.1.5Current Page Pointer
The Current Page Pointer determines which SRAM page is
used for all memory accesses. Normal memory accesses
are those not covered by other pointers including all nonstack, non-MVI, and nonindexed memory access instructions. The normal memory access instructions have the
SRAM page they operate on determined by the value of the
CUR_PP register. By default, the CUR_PP register has no
affect on the SRAM page that is used for normal memory
access, because all normal memory access is forced to
SRAM Page 0.
The upper bit of the PgMode bits in the CPU_F register
determine if the CUR_PP register affects normal memory
access. When the upper bit of the PgMode bits is set to ‘0’,
all normal memory access is forced to SRAM Page 0. This
mode is automatically enabled when an Interrupt Service
Routine (ISR) is entered. This is because, before the ISR is
entered, the M8C pushes the current value of the CPU_F
register onto the stack and then clears the CPU_F register.
Therefore, by default, any normal memory access in an ISR
is guaranteed to occur in SRAM Page 0.
When the RETI instruction is executed to end the ISR, the
previous value of the CPU_F register is restored, returning
to the previous page mode. This is the default ISR behavior
and it is possible to change the PgMode bits in the CPU_F
register while in an ISR. If the PgMode bits are changed
while in an ISR, the pre-ISR value is still restored by the
RETI; but if the CUR_PP register is changed in the ISR, the
ISR is also required to restore the value before executing
the RETI instruction.
When the upper bit of the PgMode bits is set to ‘1‘, all normal memory access is forced to the SRAM page indicated
by the CUR_PP register value. Ta bl e 4- 1 summarizes the
PgMode bit values and the corresponding Memory Paging
mode.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H39
RAM Paging
4.1.6Index Memory Page Pointer
The Source Indexed and Destination Indexed addressing
modes to SRAM are treated as a unique addressing mode
in a enCoRe V device with more than one page of SRAM.
An example of an indexed addressing mode is the MOV A,[X+expr] instruction. Register access has indexed
addressing as well; however, those instructions are not
affected by the SRAM paging architecture.
Important Note If you are not using assembly to program a
enCoRe V device, be aware that the compiler writer may
restrict the use of some memory paging modes. Review the
conventions in your compiler’s user guide for more information on restrictions or conventions associated with memory
paging modes.
Indexed SRAM accesses operate in one of three modes:
■ Index memory access modes are forced to SRAM
Page 0.
■ Index memory access modes are directed to the SRAM
page indicated by the value in the STK_PP register.
■ Index memory access is forced to the SRAM page indi-
cated by the value in the IDX_PP register.
The mode is determined by the value of the PgMode bits in
the CPU_F register. However, the final SRAM page that is
used also requires setting either the Stack Page Pointer
(STK_PP) register or the Index Page Pointer (IDX_PP) register. Table 4-1 shows the three indexed memory access
modes. The third column of the table is provided for reference only.
Table 4-1. CPU_F PgMode Bit Modes
CPU_F
PgMode BIts
00b00ISR*
01b0STK_PPISR with variables on stack
10bCUR_PPIDX_PP
11bCUR_PPSTK_PP
*
Mode used by SROM functions initiated by the SSC instruction.
Current
SRAM Page
Indexed
SRAM Page
Typical Use
After reset, the PgMode bits are set to 00b. In this mode,
index memory accesses are forced to SRAM Page 0, just as
they are in a enCoRe V device with only 256 bytes of
SRAM. This mode is also automatically enabled when an
interrupt occurs in a enCoRe V device and is considered the
default ISR mode. This is because before the ISR is
entered, the M8C pushes the current value of the CPU_F
register onto the stack and then clears the CPU_F register.
Thus, by default, any indexed memory access in an ISR is
guaranteed to occur in SRAM Page 0. When the RETI
instruction executes to end the ISR, the previous value of
the CPU_F register is restored as is the previous page
mode. Note that this ISR behavior is the default and that the
PgMode bits in the CPU_F register may be changed while in
an ISR. If the PgMode bits are changed while in an ISR, the
pre-ISR value is still restored by the RETI; but if the
STK_PP or IDX_PP registers are changed in the ISR, the
ISR is also required to restore the values before executing
the RETI instruction.
The most likely PgMode bit change, while in an ISR, is from
the default value of 00b to 01b. In the 01b mode, indexed
memory access is directed to the SRAM page indicated by
the value of the STK_PP register. By using the PgMode,
modification of the STK_PP register value is unnecessary.
The STK_PP register determines on which SRAM page the
stack is located. The 01b paging mode is intended to provide easy access to the stack, while in an ISR, by setting the
CPU_X register (just X in instruction format) equal to value
of SP using MOV X, SP instruction.
The two previous paragraphs covered two of the three
indexed memory access modes: STK_PP and forced to
SRAM Page 0. Note, as shown in Ta bl e 4-1, that the
STK_PP mode for indexed memory access is available
under two PgMode settings. The 01b mode is intended for
ISR use and the 11b mode is intended for non-ISR use. The
third indexed memory access mode requires the PgMode
bits to be set to 10b. In this mode, indexed memory access
is forced to the SRAM page indicated by the value of the
IDX_PP register.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H40
RAM Paging
4.2Register Definitions
The following registers are associated with RAM Paging and are listed in address order. The register descriptions have an
associated register table showing the bit structure for that register. The bits in the tables that are grayed out are reserved bits
and are not detailed in the register descriptions that follow. Always write reserved bits with a value of ‘0‘. For a complete table
of RAM Paging registers, refer to the Summary Table of the Core Registers on page 24.
x An ‘x’ before the comma in the address field indicates that this register can be read or written to no matter what bank is used. An “x” after the comma in the
address field indicates that there are multiple instances of the register.
The Temporary Data Registers (TMP_DR0, TMP_DR1,
TMP_DR2, and TMP_DR3) enhance the performance in
multiple SRAM page enCoRe V devices.
These registers have no predefined function (for example,
the compiler and hardware do not use these registers) and
exist for the user to define.
first changing the current page. The TMP_DRx registers are
readable and writable registers that are provided to improve
the performance of multiple SRAM page enCoRe V devices,
by supplying some register space for data that is always
accessible.
For an expanded listing of the TMP_DRx registers, refer to
the Summary Table of the Core Registers on page 24. ForBits 7 to 0: Data[7:0]. Due to the paged SRAM architecture of enCoRe V devices with more than 256 bytes of
additional information, refer to the TMP_DRx register on
page 219.
SRAM, a value in SRAM is not always accessible without
The Current Page Pointer Register (CUR_PP) sets the
effective SRAM page for normal memory accesses in a
multi-SRAM page enCoRe V device.
Bits 2 to 0: Page Bits[2:0]. These bits affect the SRAM
page that is accessed by an instruction when the
CPU_F[7:6] bits have a value of either 10b or 11b. Source
Indexed, Destination Indexed addressing modes, and stack
instructions, are never affected by the value of the CUR_PP
register. See the STK_PP and IDX_PP registers for more
information.
The Source Indirect Post Increment and Destination Indirect
Post Increment addressing modes, better know as MVI, are
only partially affected by the value of the CUR_PP register.
For MVI instructions, the pointer address is in the SRAM
page indicated by CUR_PP, but the address pointed to may
be in another SRAM page.
See the MVR_PP and MVW_PP register descriptions for
more information.
For additional information, refer to the CUR_PP register on
page 188.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H41
The Stack Page Pointer Register (STK_PP) is used to set
the effective SRAM page for stack memory accesses in a
multi-SRAM page enCoRe V device.
Bits 2 to 0: Page Bits[2:0]. These bits have the potential
to affect two types of memory access.
The purpose of this register is to determine on which SRAM
page to store the stack. In the reset state, this register's
value is 00h and the stack is in SRAM Page 0. However, if
the STK_PP register value is changed, the next stack operation occurs on the SRAM page indicated by the new
STK_PP value. Therefore, set the value of this register early
in the program and never change it. If the program changes
the STK_PP value after the stack grows, the program must
ensure that the STK_PP value is restored when needed.
Note The impact of the STK_PP register on the stack is
independent of the SRAM Paging bits in the CPU_F register.
The second type of memory accesses that the STK_PP reg-
ister affects are indexed memory accesses when the
CPU_F[7:6] bits are set to 11b. In this mode, Source
Indexed and Destination Indexed memory accesses are
directed to the stack SRAM page, rather than the SRAM
page indicated by the IDX_PP register or SRAM Page 0.
For additional information, refer to the STK_PP register on
The Index Page Pointer Register (IDX_PP) sets the effective
SRAM page for indexed memory accesses in a multi-SRAM
page enCoRe V device.
Bits 2 to 0: Page Bits[2:0]. These bits allow instructions,
which use the Source Indexed and Destination Indexed
address modes, to operate on an SRAM page that is not
equal to the current SRAM page. However, the effect this
register has on indexed addressing modes is only enabled
when the CPU_F[7:6] is set to 10b.
When CPU_F[7:6] is set to 10b and an indexed memory
access is made, the access is directed to the SRAM page
indicated by the value of the IDX_PP register.
See the STK_PP register description for more information
on other indexed memory access modes. For additional
The MVI Read Page Pointer Register (MVR_PP) sets the
effective SRAM page for MVI read memory accesses in a
multi-SRAM page enCoRe V device.
Bits 2 to 0: Page Bits[2:0]. These bits are only used by
the MVI A, [expr] instruction, not to be confused with the
MVI [expr], A instruction covered by the MVW_PP register. This instruction is considered a read because data is
transferred from SRAM to the microprocessor's A register
(CPU_A).
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H42
When an MVI A, [expr] instruction is executed in a
device with more than one page of SRAM, the SRAM
address that is read by the instruction is determined by the
value of the least significant bits in this register. However,
the pointer for the MVI A, [expr] instruction is always
located in the current SRAM page. See the PSoC Desig ner
Assembly Language User Guide for more information on the
MVI A, [expr] instruction.
The function of this register and the MVI instructions are
independent of the SRAM Paging bits in the CPU_F register.
For additional information, refer to the MVR_PP register on
The MVI Write Page Pointer Register (MVW_PP) sets the
effective SRAM page for MVI write memory accesses in a
multi-SRAM page enCoRe V device.
Bits 2 to 0: Page Bits[2:0]. These bits are only used by
the MVI [expr], A instruction, not to be confused with the
MVI A, [expr] instruction covered by the MVR_PP register. This instruction is considered a write because data is
transferred from the microprocessor's A register (CPU_A) to
SRAM.
When an MVI [expr], A instruction is executed in a
device with more than one page of SRAM, the SRAM
4.2.7Related Registers
■ CPU_F Register on page 31.
address that is written by the instruction is determined by
the value of the least significant bits in this register. How-
ever, the pointer for the MVI [expr], A instruction is
always located in the current SRAM page. See the PSoC
Designer Assembly Language User Guide for more informa-
tion on the MVI [expr], A instruction.
The function of this register and the MVI instructions are
independent of the SRAM Paging bits in the CPU_F register.
For additional information, refer to the MVW_PP register on
page 192.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H43
5. Interrupt Controller
M8C Core
Interrupt
Source
(Timer,
GPIO, etc.)
Interrupt Taken
or
Posted
Interrupt
Pending
Interrupt
GIE
Interrupt Vector
Mask Bit Setting
DRQ1
Priority
Encoder
Interrupt
Request
...
INT_MSKx
INT_CLRx:n Write
CPU_F[0]
...
This chapter presents the Interrupt Controller and its associated registers. The interrupt controller provides a mechanism for a
hardware resource in enCoRe V devices to change program execution to a new address without regard to the current task
being performed by the code being executed. For a quick reference of all enCoRe V registers in address order, refer to the
Register Reference chapter on page 163.
5.1Architectural Description
Figure 5-1 shows a block diagram of the Interrupt Controller, illustrating the concepts of posted interrupts and pending
interrupts.
Figure 5-1. Interrupt Controller Block Diagram
This is the sequence of events that occur during interrupt
processing.
1. An interrupt becomes active, either because (a) the
interrupt condition occurs (for example, a timer expires),
(b) a previously posted interrupt is enabled through an
update of an interrupt mask register, or (c) an interrupt is
pending and GIE is set from ‘0’ to ‘1’ in the CPU Flag
register.
2. The current executing instruction finishes.
3. The internal interrupt service routine (ISR) executes, tak-
ing 13 cycles. During this time, the following actions
occur:
❐ The PCH, PCL, and Flag register (CPU_F) are
pushed onto the stack (in that order).
❐ The CPU_F register clears. Because this clears the
GIE bit to ‘0’, additional interrupts are temporarily disabled.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H44
❐ The PCH (PC[15:8]) is cleared to zero.
❐ The interrupt vector is read from the interrupt control-
ler and its value is placed into PCL (PC[7:0]). This
sets the program counter to point to the appropriate
address in the interrupt table (for example, 0014h for
the GPIO interrupt).
4. Program execution vectors to the interrupt table. Typi-
cally an LJMP instruction in the interrupt table sends execution to the user's interrupt service routine for this
interrupt. (See Instruction Set Summary on page 27.)
5. The ISR executes. Interrupts are disabled because GIE
= 0. In the ISR, interrupts can be re-enabled if necessary
by setting GIE = 1 (take care to avoid stack overflow in
this case).
6. The ISR ends with an RETI instruction. This pops the
Flag register, PCL, and PCH from the stack, restoring
those registers. The restored Flag register re-enables
interrupts because GIE = 1 again.
Interrupt Controller
Latency =
Time for current ins truction to finish +
Time for M8C to change program counter to interrupt address +
Time for LJMP instruction in interrupt table to execute.
(1 to 5 cycles for JMP to finish) +
(13 cycles for interrupt routine) +
(7 cycles for LJMP) = 21 to 25 cycles.
7. Execution resumes at the next instruction, after the
instruction that occurred before the interrupt. However, if
there are more pending interrupts, the subsequent interrupts are processed before the next normal program
instruction.
Interrupt Latency. The time between the assertion of an
enabled interrupt and the start of its ISR is calculated using
this equation:
Equation 1
For example, if the 5-cycle JMP instruction is executing
when an interrupt becomes active, the total number of CPU
clock cycles before the ISR begins is:
Equation 2
For example, if a block has a posted interrupt when it is
enabled and then disabled, the posted interrupt remains.
Therefore, it is good practice to use the INT_CLR register to
clear posted interrupts before enabling or re-enabling a
block.
5.2Application Overview
The interrupt controller and its associated registers allow the
user’s code to respond to an interrupt from almost every
functional block in enCoRe V devices. Interrupts for all the
digital blocks and each of the analog columns are available,
as well as interrupts for supply voltage, sleep, variable
clocks, and a general GPIO (pin) interrupt.
The registers associated with the interrupt controller allow
the disabling of interrupts either globally or individually. The
registers also provide a mechanism by which a user can
clear all pending and posted interrupts or clear individual
posted or pending interrupts. A software mechanism is pro-
vided to set individual interrupts. Setting an interrupt by way
of software is very useful during code development, when
one may not have the complete hardware system necessary
to generate a real interrupt.
The following table lists the interrupts and priorities that are
available in the enCoRe V devices.
In this example, at 24 MHz, 25 clock cycles take 1.042 s.
Interrupt Priority. Interrupt priorities come into consideration when more than one interrupt is pending during the
same instruction cycle. In this case, the Priority Encoder
(see Figure 5-1) generates an interrupt vector for the high-
est priority pending interrupt.
5.1.1Posted versus Pending Interrupts
An interrupt is posted when its interrupt conditions occur.
This results in the flip-flop in Figure 5-1 clocking in a 1. The
interrupt remains posted until the interrupt is taken or until it
is cleared by writing to the appropriate INT_CLRx register.
A posted interrupt is not pending unless it is enabled by setting its interrupt mask bit (in the appropriate INT_MSKx register). All pending interrupts are processed by the Priority
Encoder to determine the highest priority interrupt taken by
the M8C if the Global Interrupt Enable bit is set in the
CPU_F register.
Disabling an interrupt by clearing its interrupt mask bit (in
the INT_MSKx register) does not clear a posted interrupt,
nor does it prevent an interrupt from posting. It simply prevents a posted interrupt from becoming pending.
It is especially important to understand the functionality of
clearing posted interrupts, if the configuration of the enCoRe
V device is changed by the application.
Table 5-1. Device Interrupts
Interrupt Priority
0 (Highest)0000hReset
10004hSupply voltage monitor
20008hReserved
3000ChReserved
40010hTimer0
50014hGPIO
60018hSPI
7001ChI2C
80020hSleep Timer
90024hTimer1
100028hTimer2
Interrupt
Address
Interrupt Name
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H45
Interrupt Controller
5.3Register Definitions
The following registers are associated with the Interrupt Controller and are listed in address order. The register descriptions
have an associated register table showing the bit structure for that register. The bits in the tables that are grayed out are
reserved bits and are not detailed in the register descriptions that follow. Always write reserved bits with a value of ‘0’. For a
complete table of Interrupt Controller registers, refer to the Summary Table of the Core Registers on page 24.
The Interrupt Clear Register 0 (INT_CLR0) enables the individual interrupt sources’ ability to clear posted interrupts.
The INT_CLR0 register is similar to the INT_MSK0 register
in that it holds a bit for each interrupt source. Functionally
the INT_CLR0 register is similar to the INT_VC register,
although its operation is completely independent. When the
INT_CLR0 register is read, any bits that are set indicate an
interrupt was posted for that hardware resource. Reading
this register gives the user the ability to determine all posted
interrupts.
The Enable Software Interrupt (ENSWINT) bit in the
INT_SW_EN register determines how an individual bit
value, written to an INT_CLR0 register, is interpreted. When
ENSWINT is cleared (the default state), writing 1's to the
INT_CLR0 register has no effect. However, writing 0's to the
INT_CLR0 register, when ENSWINT is cleared, causes the
corresponding interrupt to clear. If the ENSWINT bit is set,
any 0's written to the INT_CLR0 register are ignored. However, 1's written to the INT_CLR0 register, while ENSWINT
is set, cause an interrupt to post for the corresponding interrupt.
Software interrupts aid in debugging interrupt service routines by eliminating the need to create system level interactions that are sometimes necessary to create a hardwareonly interrupt.
Bit 7: I2C. This bit allows posted I2C interrupts to be read,
cleared, or set.
Bit 6: Sleep. This bit allows posted sleep interrupts to be
read, cleared, or set.
Bit 5: SPI. This bit allows posted SPI interrupts to be read,
cleared, or set.
Bit 4: GPIO. This bit allows posted GPIO interrupts to be
read, cleared, or set.
Bit 3: Timer0. This bit allows posted timer interrupts to be
read, cleared, or set.
Bit 0: V Monitor. This bit allows posted voltage monitor
interrupts to be read, cleared, or set.
For additional information, refer to the INT_CLR0 register on
page 196.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H46
0,DBhINT_CLR1Endpoint3Endpoint2Endpoint1Endpoint0USB SOFUSB Bus Rst Timer2Timer1RW : 00
This register enables the individual interrupt sources' ability
to clear posted interrupts.
When bits in this register are read, a '1' is returned for every
bit position that has a corresponding posted interrupt. When
bits in this register are written with a '0' and ENSWINT is not
set, posted interrupts are cleared at the corresponding bit
positions. If there is no posted interrupt, there is no effect.
When bits in this register are written with a '1' and ENSWINT
is set, an interrupt is posted in the interrupt controller.
Bit 7: Endpoint3. Read '0', no posted interrupt for USB
Endpoint3. Read '1', posted interrupt present for USB
Endpoint3.
Write 0 AND ENSWINT = 0. Clear posted interrupt if it
exists.
Write 1 AND ENSWINT = 0. No effect.
Write 0 AND ENSWINT = 1. No effect.
Write 1 AND ENSWINT = 1. Post an interrupt for USB
Endpoint3.
Bit 6: Endpoint2. Read '0', no posted interrupt for USB
Endpoint2. Read '1', posted interrupt present for USB
Endpoint2.
Write 0 AND ENSWINT = 0. Clear posted interrupt if it
exists.
Write 1 AND ENSWINT = 0. No effect.
Write 0 AND ENSWINT = 1. No effect.
Write 1 AND ENSWINT = 1. Post an interrupt for USB
Endpoint2.
Bit 5: Endpoint1. Read '0', no posted interrupt for USB
Endpoint1. Read '1', posted interrupt present for USB
Endpoint1.
Write 0 AND ENSWINT = 0. Clear posted interrupt if it
exists.
Write 1 AND ENSWINT = 0. No effect.
Write 0 AND ENSWINT = 1. No effect.
Write 1 AND ENSWINT = 1. Post an interrupt for USB
Endpoint1.
Bit 4: Endpoint0. Read '0', no posted interrupt for USB
Endpoint0. Read '1', posted interrupt present for USB
Endpoint0.
Write 0 AND ENSWINT = 0. Clear posted interrupt if it
exists.
Write 1 AND ENSWINT = 0. No effect.
Write 0 AND ENSWINT = 1. No effect.
Write 1 AND ENSWINT = 1. Post an interrupt for USB
Endpoint0.
Bit 3: USB SOF. Read '0', no posted interrupt for USB Start
of Frame (SOF). Read '1', posted interrupt present for USB
Start of Frame (SOF).
Write 0 AND ENSWINT = 0. Clear posted interrupt if it
exists.
Write 1 AND ENSWINT = 0. No effect.
Write 0 AND ENSWINT = 1. No effect.
Write 1 AND ENSWINT = 1. Post an interrupt for USB Start
of Frame (SOF).
Bit 2: USB Bus Rst. Read '0', no posted interrupt for USB
Bus Reset. Read '1', posted interrupt present for USB Bus
Reset.
Write 0 AND ENSWINT = 0. Clear posted interrupt if it
exists.
Write 1 AND ENSWINT = 0. No effect.
Write 0 AND ENSWINT = 1. No effect.
Write 1 AND ENSWINT = 1. Post an interrupt for USB Bus
Reset.
Bit 1: Timer2. Read '0', no posted interrupt for Timer2.
Read '1', posted interrupt present for Timer2.
Write 0 AND ENSWINT = 0. Clear posted interrupt if it
exists.
Write 1 AND ENSWINT = 0. No effect.
Write 0 AND ENSWINT = 1. No effect.
Write 1 AND ENSWINT = 1. Post an interrupt for Timer2.
Bit 0: Timer1. Read '0', no posted interrupt for Timer1.
Read '1', posted interrupt present for Timer1.
Write 0 AND ENSWINT = 0. Clear posted interrupt if it
exists.
Write 1 AND ENSWINT = 0. No effect.
Write 0 AND ENSWINT = 1. No effect.
Write 1 AND ENSWINT = 1. Post an interrupt for Timer1.
For additional information, refer to the INT_CLR1 register on
page 198.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H47
This register enables the individual interrupt sources' ability
to clear posted interrupts.
When bits in this register are read, a '1' is returned for every
bit position that has a corresponding posted interrupt. When
bits in this register are written with a '0' and ENSWINT is not
set, posted interrupts are cleared at the corresponding bit
positions. If there was not a posted interrupt, there is no
effect. When bits in this register are written with a '1' and
ENSWINT is set, an interrupt is posted in the interrupt controller.
Bit 5: USB_WAKE. Read ‘0’, no posted interrupt for USB
wakeup. Read ‘1’, posted interrupt present for USB wakeup.
Write 0 AND ENSWINT = 0. Clear posted interrupt if it
exists.
Write 1 AND ENSWINT = 0. No effect.
Write 0 AND ENSWINT = 1. No effect.
Write 1 AND ENSWINT = 1. Post an interrupt for USB
wakeup.
Bit 4: Endpoint8. Read ‘0’, no posted interrupt for USB
Endpoint8. Read ‘1’, posted interrupt present for USB
Endpoint8.
Write 0 AND ENSWINT = 0. Clear posted interrupt if it
exists.
Write 1 AND ENSWINT = 0. No effect.
Write 0 AND ENSWINT = 1. No effect.
Write 1 AND ENSWINT = 1. Post an interrupt for USB
Endpoint8.
Bit 3: Endpoint7. Read ‘0’, no posted interrupt for USB
Endpoint7. Read ‘1’, posted interrupt present for USB
Endpoint7.
Write 0 AND ENSWINT = 0. Clear posted interrupt if it
exists.
Write 1 AND ENSWINT = 0. No effect.
Write 0 AND ENSWINT = 1. No effect.
Write 1 AND ENSWINT = 1. Post an interrupt for USB
Endpoint7.
Bit 2: Endpoint6. Read ‘0’, no posted interrupt for USB
Endpoint6. Read ‘1’, posted interrupt present for USB
Endpoint6.
Write 0 AND ENSWINT = 0. Clear posted interrupt if it
exists.
Write 1 AND ENSWINT = 0. No effect.
Write 0 AND ENSWINT = 1. No effect.
Write 1 AND ENSWINT = 1. Post an interrupt for USB
Endpoint6.
Bit 1: Endpoint5. Read ‘0’, no posted interrupt for USB
Endpoint5. Read ‘1’, posted interrupt present for USB
Endpoint5.
Write 0 AND ENSWINT = 0. Clear posted interrupt if it
exists.
Write 1 AND ENSWINT = 0. No effect.
Write 0 AND ENSWINT = 1. No effect.
Write 1 AND ENSWINT = 1. Post an interrupt for USB
Endpoint5.
Bit 0: Endpoint4. Read ‘0’, no posted interrupt for USB
Endpoint4. Read ‘1’, posted interrupt present for USB
Endpoint4.
Write 0 AND ENSWINT = 0. Clear posted interrupt if it
exists.
Write 1 AND ENSWINT = 0. No effect.
Write 0 AND ENSWINT = 1. No effect.
Write 1 AND ENSWINT = 1. Post an interrupt for USB
Endpoint4.
For additional information, refer to the INT_CLR2 register on
page 200.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H48
The Interrupt Mask Register (INT_MSK0) enables the individual interrupt sources’ ability to create pending interrupts.
If cleared, each bit in an INT_MSK0 register prevents a
posted interrupt from becoming a pending interrupt (input to
the Priority Encoder). However, an interrupt can still post
even if its mask bit is zero. All INT_MSK0 bits are independent of all other INT_MSK0 bits.
Bit 7: I2C. This bit allows I2C interrupts to be enabled or
masked.
Bit 6: Sleep. This bit allows sleep interrupts to be enabled
or masked.
Bit 5: SPI. This bit allows SPI interrupts to be enabled or
masked.
If an INT_MSK0 bit is set, the interrupt source associated
with that mask bit may generate an interrupt that becomes a
pending interrupt. For example, if INT_MSK0[4] is set and at
Bit 4: GPIO. This bit allows GPIO interrupts to be enabled
or masked.
least one GPIO pin is configured to generate an interrupt,
the interrupt controller allows a GPIO interrupt request to
post and become a pending interrupt to which the M8C
Bit 3: Timer0. This bit allows Timer0 interrupts to be
enabled or masked.
responds. If a higher priority interrupt is generated before
the M8C responds to the GPIO interrupt, the higher priority
interrupt is responded to before the GPIO interrupt.
Each interrupt source may require configuration at a block
level. Refer to the corresponding chapter for each interrupt
Bit 0: V Monitor. This bit allows voltage monitor interrupts
to be enabled or masked.
For additional information, refer to the INT_MSK0 register
0,DFhINT_MSK1Endpoint3Endpoint2Endpoint1Endpoint0USB SOFUSB Bus Reset Timer2Timer1RW : 00
This register enables the individual sources' ability to create
pending interrupts.
When an interrupt is masked off, the mask bit is '0'. The
interrupt continues to post in the interrupt controller. Clearing the mask bit only prevents a posted interrupt from
becoming a pending interrupt.
Bit 7: Endpoint3. ’0’ is mask USB Endpoint3 interrupt. ‘1’
is unmask USB Endpoint3 interrupt.
Bit 6: Endpoint2. ’0’ is mask USB Endpoint2 interrupt. ‘1’
is unmask USB Endpoint2 interrupt.
Bit 5: Endpoint1. ’0’ is mask USB Endpoint1 interrupt. ‘1’
is unmask USB Endpoint1 interrupt.
Bit 4: Endpoint0. ’0’ is mask USB Endpoint0 interrupt. ‘1’
is unmask USB Endpoint0 interrupt.
Bit 3: USB SOF. ’0’ is mask USB SOF interrupt. ‘1’ is
unmask USB SOF interrupt.
Bit 2: USB Bus Reset (K). ’0’ is mask USB Bus Reset
interrupt. ‘1’ is unmask USB Bus Reset interrupt.
Bit 1: Timer2. ’0’ is mask Timer2 interrupt. ‘1’ is unmask
Timer2 interrupt.
Bit 0: Timer1. ’0’ is mask Timer1 interrupt. ‘1’ is unmask
Timer1 interrupt.
For additional information, refer to the INT_MSK1 register
on page 203.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H49
This register is used to enable the individual sources' ability
to create pending interrupts.
When an interrupt is masked off, the mask bit is '0'. The
interrupt still posts in the interrupt controller. Therefore,
clearing the mask bit only prevents a posted interrupt from
becoming a pending interrupt.
Bit 5: USB Wakeup. ’0’ is mask USB Wakeup interrupt. ‘1’
is unmask USB Wakeup interrupt.
Bit 2: Endpoint6. ’0’ is mask USB Endpoint6 interrupt. ‘1’
is unmask USB Endpoint6 interrupt.
Bit 1: Endpoint5. ’0’ is mask USB Endpoint5 interrupt. ‘1’
is unmask USB Endpoint5 interrupt.
Bit 0: Endpoint4. ’0’ is mask USB Endpoint4 interrupt. ‘1’
is unmask USB Endpoint4 interrupt.
For additional information, refer to the INT_MSK2 register
on page 202.
Bit 4: Endpoint8. ’0’ is mask USB Endpoint8 interrupt. ‘1’
is unmask USB Endpoint8 interrupt.
Bit 3: Endpoint7. ’0’ is mask USB Endpoint7 interrupt. ‘1’
is unmask USB Endpoint7 interrupt.
The Interrupt Software Enable Register (INT_SW_EN) is
used to enable software interrupts.
Bit 0: ENSWINT. This bit is a special non-mask bit that
controls the behavior of the INT_CLR0 register. See the
INT_CLR0 register in this section for more information.
For more details, see INT_SW_EN register on page 205.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H50
The Interrupt Vector Clear Register (INT_VC) returns the
next pending interrupt and clears all pending interrupts
when written.
Bits 7 to 0: Pending Interrupt[7:0]. When the register is
read, the least significant byte (LSB) of the highest priority
pending interrupt is returned. For example, if the GPIO and
I2C interrupts were pending and the INT_VC register was
read, the value 14h is read. However, if no interrupts were
pending, the value 00h is returned. This is the reset vector in
the interrupt table; however, reading 00h from the INT_VC
register is not considered an indication that a system reset is
pending. Rather, reading 00h from the INT_VC register simply indicates that there are no pending interrupts. The highest priority interrupt, indicated by the value returned by a
read of the INT_VC register, is removed from the list of
pending interrupts when the M8C services an interrupt.
5.3.9Related Registers
■ CPU_F on page 208.
Reading the INT_VC register has limited usefulness. If inter-
rupts are enabled, a read to the INT_VC register is not able
to determine that an interrupt was pending before the inter-
rupt was actually taken. However, while in an interrupt ser-
vice routine, a user may wish to read the INT_VC register to
see the next interrupt. When the INT_VC register is written
with any value, all pending and posted interrupts are cleared
by asserting the clear line for each interrupt.
For additional information, refer to the INT_VC register on
page 206.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H51
6. General-Purpose I/O (GPIO)
Drive
Logic
DM1
DM0
Alt. Select
Write PRTxDR
Alt. Data
2:1
Vdd
Note Alt. Select/
Data is not available
on all pins.
Vdd
5.6k
LDO
REG_EN
Port 1
Only
Vdd
Pin
Drive Modes
DM1
Drive Mode
DM0
Diagram
Number
Data = 0Data = 1
Alt. Input
(e.g., I2C)
Data
Bus
Read PRTxDR
DM(1:0) = 10b
INBUF
(to GPIO
interrupt logic)
Note No diode to
Vdd for Port 1
0
0
1
1
0
1
0
1
Resistive Pull Up
Strong Drive
High Impedance
Open Drain
0
1
2
3
Strong
Strong
An. High Z
Strong
Resistive
Strong
An. High Z
High Z
0.1.2.3.
This chapter discusses the general-purpose I/O (GPIO) and its associated registers, which is the circuit responsible for interfacing to the I/O pins of a enCoRe V device. The GPIO blocks provide the interface between the M8C core and the outside
world. They offer a large number of configurations to support several types of input/output (IO) operations for both digital and
analog systems. For a complete table of the GPIO registers, refer to enCoRe V Core on page 23. For a quick reference of all
enCoRe Vregisters in address order, refer to the Register Reference chapter on page 163.
6.1Architectural Description
The GPIO in the CY7C643xx and CY7C604xx devices are all uniform, except that Port 0 and Port 1 GPIO have stronger high
drive. In addition to higher drive strength, Port 1 GPIO have an option for regulated output level. These distinctions are discussed in more detail in Port 1 Distinctions on page 53 and Port 0 Distinctions on page 53.
Figure 6-1. GPIO Block Diagram
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H52
General-Purpose I/O (GPIO)
6.1.1General Description
The GPIO contains input buffers, output drivers, and configuration logic for connecting the enCoRe V device to the outside world.
I/O ports are arranged with (up to) 8 bits per port. Each full
port contains eight identical GPIO blocks. Each GPIO block
is used for the following types of I/O:
■ Digital I/O (digital input and output controlled by soft-
ware)
■ Analog I/O
Each I/O pin also has several drive modes, and interrupt
capabilities. All GPIO pins provide both digital I/O and analog input capability.
Certain pins contain an option to bypass the normal data
path and output from an internal source. An example is I2C
outputs. These are described in Data Bypass on page 55.
6.1.2Digital I/O
One of the basic operations of the GPIO ports is to allow the
M8C to send information out of the enCoRe V device and
get information into the M8C from outside the device. This is
accomplished using the port data register (PRTxDR). Writes
from the M8C to the PRTxDR register store the data state,
one bit per GPIO. In the standard non-bypass mode, the pin
drivers drive the pin in response to this data bit, with a drive
strength determined by the Drive mode setting (see
Figure 6-1). The actual voltage on the pin depends upon the
Drive mode and the external load.
The M8C reads the value of a port by reading the PRTxDR
register address. When the M8C reads the PRTxDR register
address, the current value of the pin voltage is translated
into a logic value and returned to the M8C. Note that the pin
voltage can represent a different logic value than the last
value written to the PRTxDR register. This is an important
distinction to remember in situations such as the use of a
read modify write to a PRTxDR register. Examples of read
modify write instructions include AND, OR, and XOR.
The following is an example of how a read modify write, to a
PRTxDR register, can have an unexpected and even indeterminate result in certain systems. Consider a scenario
where all bits of Port 1 on the enCoRe V device are in the
strong 0 resistive 1 Drive mode; so that in some cases, the
system the enCoRe V is in may pull down one of the bits by
an external driver.
movreg[PRT1DR], 0xFF
andreg[PRT1DR], 0x7F
In the first line of this code, writing a FFh to the port causes
the enCoRe V to drive all pins high through a resistor. This
does not affect any bits that are strongly driven low by the
system the enCoRe V is in. However, in the second line of
code, it cannot guarantee that only bit 7 is the one set to a
strong 0 (zero). Because the AND instruction first reads the
port, any bits that are currently driven low externally are
read as a 0. These zeros are then written back to the port.
When this happens, the pin goes into a strong 0 state; there-
fore, if the external low drive condition ends in the system,
the enCoRe Vkeeps the pin value at a logic 0.
6.1.3Analog and Digital Inputs
The High Impedance Analog mode turns off the Schmitt trig-
ger on the input path, which may reduce power consumption
and decrease internal switching noise when using a particu-
lar I/O as an analog input.
All modes, except High-impedance Analog, allow digital
inputs. The most useful digital input modes are Resistive
Pull Up (DM1, DM0 = 00b with Data = 1) or a fully high-
impedance input using open drain (DM1, DM0 = 11b with
Data = 1).
6.1.4Port 1 Distinctions
Port 1 has two differences from the other GPIO ports. It has
stronger high drive (as does Port 0) and it has an option for
regulating all outputs to a 3 V/2.5 V/1.8 V level when in
strong drive mode. Refer to the device datasheet for the dif-
ferent current sourcing specifications of Port 1.
By setting the REG_EN bit in the IO_CFG1 register, Port 1
can be configured to drive strong high to a regulated 3 V/
2.5 V/1.8 V level. If REG_EN is set low, Port 1 pins drive to
Vdd in strong drive mode.
In Resistive High Drive mode ([DM1, DM0] = 00), the pins
pull up to the chip Vdd level regardless of the regulator set-
ting for this port. Only Strong Drive mode allows for the out-
puts to be driven to the regulated level. When the REG_EN
bit is set high, pins configured for strong drive to regulated
level, while those in resistive pull-up mode drive to Vdd.
In their default state, all Port 1 I/O prevent DC current from
flowing into the pin when the pin voltage is above the chip
Vdd. This feature resolves the problem where the enCoRe
Vholds down the system I2C bus or provides a current leak-
age path from a powered peripheral during enCoRe V power
down or reset.
The open drain driver is capable of sinking 24 mA current
(required for sinking LEDs used for backlighting) and main-
taining a logic low state.
Regulated output level can be selected by bits 4 and 5 in the
IO_CFG1 register. For 3-V output level, the chip Vdd should
be greater than 3.1 V. For 2.5-V output, the chip Vdd should
be greater than 2.7 V, and for 1.8-V output level, chip Vdd
should be greater than 2.5 V.
6.1.5Port 0 Distinctions
Port 0 has a stronger high drive. However, unlike Port 1, it
does not have an option to regulate the outputs when in
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H53
General-Purpose I/O (GPIO)
IE (PRTxIE.n)
IOINT
Port
Read
DQ
INTO
INBUF (from GPIO Block Diagram)
Interrupt Mode
IOINTIEInterrupt
00D isabled
01D isabled
10Low
11C hange from last read
strong drive mode. Refer to the device datasheet for the different current sourcing specifications of Port 0.
6.1.6GPIO Block Interrupts
You can individually configure each GPIO pin for interrupt
capability. Pins are configured by pin interrupt enables and
also by a chip wide selection for interrupt state with this
global selection. Pins can be set to interrupt when the pin is
low or when it changes from the last time it was read. The
block provides an open drain interrupt output (INTO) that is
connected to other GPIO blocks in a wire-OR fashion.
All pin interrupts that are wire-ORed together are tied to the
same system GPIO interrupt. Therefore, if interrupts are
enabled on multiple pins, the user’s interrupt service routine
must provide a mechanism to determine which pin was the
source of the interrupt.
Using a GPIO interrupt requires these steps:
1. Set the Interrupt mode (IOINT bit in the IO_CFG1 regis-
ter).
2. Enable the bit interrupt in the GPIO block.
3. Set the mask bit for the (global) GPIO interrupt.
4. Assert the overall Global Interrupt Enable.
The first step sets a common interrupt mode for all pins.
The second step is set at the GPIO pin level (that is, at each
port pin), by way of the PRTxIE registers.
The last two steps are common to all interrupts and
described in the Interrupt Controller chapter on page 44.
At the GPIO block level, asserting the INTO line depends
only on the bit interrupt enable and the state of the pin relative to the chosen Interrupt mode. At the enCoRe V device
level, due to their wire-OR nature, the GPIO interrupts are
neither true edge sensitive interrupts nor true level sensitive
interrupts. They are considered edge-sensitive for asserting,
but level sensitive for release of the wire-OR interrupt line.
If no GPIO interrupts are asserting, a GPIO interrupt occurs
whenever a GPIO pin interrupt enable is set and the GPIO
pin transitions (if not already transitioned) appropriately high
or low to match the interrupt mode configuration. After this
happens, the INTO line pulls low to assert the GPIO interrupt. This assumes the other system level enables are on,
such as setting the global GPIO interrupt enable and the
Global Interrupt Enable. Setting the pin interrupt enable may
immediately assert INTO, if the Interrupt mode conditions
are already being met at the pin.
After INTO pulls low, it continues to hold INTO low until one
of these conditions change:
■ The pin interrupt enable is cleared.
■ The voltage at pin transitions to the opposite state.
■ In interrupt-on-change mode, the GPIO data register is
read thus setting the local interrupt level to the opposite
state.
■ The Interrupt mode is changed so that the current pin
state does not create an interrupt.
After one of these conditions is met, the INTO releases. At
this point, another GPIO pin (or this pin again) can assert its
INTO pin, pulling the common line low to assert a new inter-
rupt.
Note the following behavior from this level release feature. If
one pin is asserting INTO and then a second pin asserts its
INTO, when the first pin releases its INTO, the second pin is
already driving INTO and thus no change is seen (that is, no
new interrupt is asserted on the GPIO interrupt). Take care,
using polling or the states of the GPIO pin and Global Inter-
rupt Enables, to catch all interrupts among a set of wire-OR
GPIO blocks.
Figure 6-2. GPIO Interrupt Logic Diagram
6.1.6.1Interrupt Modes
GPIO interrupts use the IOINT bit from the IO_CFG1 regis-
ter. The setting of IOINT determines the interrupt mode for
all GPIO.
Interrupt mode IOINT=0 means that the block asserts the
GPIO interrupt line (INTO) when the pin voltage is low, if the
block’s bit interrupt enable line is set (high).
Interrupt mode IOINT=1 means that the block asserts the
interrupt line (INTO) when the pin voltage is the opposite of
the last state read from the pin, if the block’s bit interrupt
enable line is set high. This mode switches between low
mode and high mode, depending upon the last value read
from the port during reads of the data register (PRTxDR). If
the last value read from the GPIO was 0, the GPIO pin is in
Interrupt High mode. If the last value read from the GPIO
was ‘1’, the GPIO is in Interrupt Low mode.
Table 6-1. GPIO Interrupt Modes
IEIOINTDescription
00Bit interrupt disabled, INTO deasserted
01Bit interrupt disabled, INTO d-asserted
10Assert INTO when PIN = low
11Assert INTO when PIN = change from last read
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H54
General-Purpose I/O (GPIO)
Last Value Read From Pin was ‘0’
Pin State
Waveform
Interrupt
Occurs
(a)
Pin State Waveform
GPIO Pin
Interrupt Enable
Set
Interrupt
Occurs
(b)
GPIO Pin
Interrupt Enable
Set
Last Value Read From Pin was ‘1’
Pin State
Waveform
GPIO Pin
Interrupt Enable
Set
Interrupt
Occurs
(c)
Pin State
Waveform
GPIO Pin
Interrupt
Enable Set
Interrupt
Occurs
(d)
Figure 6-3 assumes that the GIE is set, GPIO interrupt mask
is set, and that the IOINT bit was set to high. The Change
Interrupt mode relies on the value of an internal read register to determine if the pin state changed. Therefore, the port
that contains the GPIO in question must be read during
every interrupt service routine. If the port is not read, the
Interrupt mode acts as if it is in high mode when the latch
value is ‘0’ and low mode when the latch value is ‘1’.
Figure 6-3. GPIO Interrupt Mode IOINT = 1
6.1.7Data Bypass
GPIO pins are configured to either output data through CPU
writes to the PRTxDR registers or to bypass the port's data
register and output data from internal functions instead. The
bypass path is shown in Figure 6-1 by the Alt Data input,
which is selected by the Alt Select input. These data bypass
options are selected in one of two ways.
■ For internal functions such as I2C and SPI, the hardwire
automatically selects the bypass mode for the required
pins when the function is enabled.
■ For all bypass modes, the wanted drive mode of the pin
must be configured separately for each pin, with the
PRTxDM1 and PRTxDM0 registers.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H55
General-Purpose I/O (GPIO)
6.2Register Definitions
The following registers are associated with the general-purpose I/O (GPIO) and are listed in address order. The register
descriptions have an associated register table showing the bit structure for that register. The bits in the tables that are grayed
out are reserved bits and are not detailed in the register descriptions that follow. Always write reserved bits with a value of 0.
For a complete table of general-purpose I/O registers, refer to the Core Register Summary on page 24.
For a selected GPIO block, the individual registers are addressed in the Core Register Summary on page 24. In the register
names, the ‘x’ is the port number, configured at the enCoRe V device level (x = 0 to 4 typically). All register values are readable, except for the PRTxDR register; reads of this register return the pin state instead of the register bit state.
xx An “x” after the comma in the address field indicates that there are multiple instances of the register. For an expanded address listing of these registers,
refer to the Core Register Summary on page 24.
The Port Data Register (PRTxDR) allows for write or read
access of the current logical equivalent of the voltage on the
pin.
Reading the PRTxDR register returns the actual pin state,
as seen by the input buffer. This may not be the same as the
expected output state, if the load pulls the pin more strongly
than the pin’s configured output drive. See Digital I/O onBits 7 to 0: Data[7:0]. Writing the PRTxDR register bits set
the output drive state for the pin to high (for Data = 1) or low
(Data = 0), unless a bypass mode is selected (see Data
Bypass on page 55).
page 53 for a detailed discussion of digital I/O.
For additional information, refer to the PRTxDR register on
xx An “x” after the comma in the address field indicates that there are multiple instances of the register. For an expanded address listing of these registers,
refer to the Core Register Summary on page 24.
The Port Interrupt Enables (PRTxIE) registers enable or disable interrupts from individual GIPIO pins.
Bits 7 to 0: InterruptEnables[7:0]. These bits enable the
corresponding port pin interrupt. Only four LSB pins are
used because this port has four pins.
‘0’ is port pin interrupt disabled for the corresponding pin.
‘1’ is port pin interrupt enabled for the corresponding pin.
Interrupt mode is determined by the IOINT bit in the
IO_CFG1 register.
For additional information, refer to the PRTxDR register on
page 164.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H56
xx An “x” after the comma in the address field indicates that there are multiple instances of the register. For an expanded address listing of these registers,
refer to the Core Register Summary on page 24.
The Port Drive Mode Bit Registers (PRTxDM0 and
PRTxDM1) specify the Drive mode for GPIO pins.
Bits 7 to 0: Drive Mode x[7:0]. In the PRTxDMx registers
there are four possible drive modes for each port pin. Two
mode bits are required to select one of these modes, and
these two bits are spread into two different registers
(PRTxDM0 and PRTxDM1). The bit position of the affected
port pin (for example, Pin[2] in Port 0) is the same as the bit
position of each of the two drive mode register bits that control the Drive mode for that pin (for example, bit[2] in
PRT0DM0 and bit[2] in PRT0DM1). The two bits from the
two registers are treated as a group. These are referred to
as DM1 and DM0, or together as DM[1:0]. Drive modes are
shown in Ta b le 6 - 3.
For analog I/O, set the drive mode to the High-Z analog
mode, 10b. The 10b mode disables the block’s digital input
buffer so no crowbar current flows, even when the analog
input is not close to either power rail. If the 10b drive mode
is used, the pin is always read as a zero by the CPU and the
pin cannot generate a useful interrupt. (It is not strictly
required that you select High-Z mode for analog operation.)
When digital inputs are needed on the same pin as analog
inputs, use the 11b Drive mode with the corresponding data
bit (in the PRTxDR register) set high.
Drive
Modes
DM1 DM0
00Resistive pull-upResistive high, strong low
01Strong driveStrong high, strong low
10
11Open drain low
Pin StateDescription
High-impedance,
reset state)
analog (
High-Z high and low, digital input disabled (for zero power) (reset state)
High-Z high (digital input enabled),
strong low.
The GPIO provides a default drive mode of high-impedance,
analog (High-Z). This is achieved by forcing the reset state
of all PRTxDM1 registers to FFh.
For additional information, refer to PRTxDM0 register on
page 212 and PRTxDM1 register on page 213.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H57
The Input/Output Configuration Register 2 (IO_CFG2)
selects output regulated supply and clock rates.
Bits 1 to 0: REG_CLOCK[1:0]. The Regulated I/O charge
pump can operate with a maximum clock speed of 12 MHZ.
The REG_CLOCK[1:0] bits select clocking options for the
Bits 5 to 3: REG_LEVEL[2:0]. These bits select output
regulated supply.
regulator. Setting REG_CLOCK[1:0] to ‘10’ should be used
with 24-MHz SYSCLK and ‘01’ should be used with 6-/12-
MHz SYSCLK.
REG_LEVEL[2:0]Approx. Regulated Supply (V)
00032.51.8
0013.12.61.9
0103.22.72.0
0113.32.82.1
1003.42.92.2
1013.53.02.3
1103. 63 .12. 4
1113.73.22.5
REG_CLOCK[1:0]SYSCLK Clock Rate
1024 MHz
016/12 MHz
For additional information, refer to the IO_CFG2 register on
page 227.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H58
7. Analog-to-Digital Converter
INTERFACE BLOCK
COMMAND/STATUS
ADC
TEMP
DIODES
V
IN
SYSTEM BUS
TEMP SENSOR/ADC
Interface to the M8C
(
r
)
(ADC)
This chapter discusses the Analog-to-Digital Converter (ADC) and its associated registers. For a complete table of the ADC
registers, refer to the Core Register Summary on page 24. For a quick reference of all enCoRe V registers in address order,
refer to the Register Reference chapter on page 163.
7.1Architectural Description
The ADC on enCoRe V devices is an independent block with a state machine interface to control accesses to the block. The
ADC is housed together with the temperature sensor core. Figure 7-1.
Figure 7-1. enCoRe V Temperature Sensor and ADC Block Diagram
Processo
Core
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H59
Analog-to-Digital Converter (ADC)
Vbe
Vbe
Analog
Analog
ADC
MUX_SEL
TEMP
SENSOR
CORE
Vin
ADC
7.2Brief Overview of ADC Components and Registers
This section provides an overview of the functions of the
ADC block and the application interface.
7.2.1Interface Command/Status Block
The Interface command and status block provides the application interface logic. This block has a state machine that is
used to generate the status and other relevant signals for all
instructions.
Figure 7-2. Temperature Sensor/Analog Bus Connection to ADC
7.2.2ADC
The ADC is a part of the temperature control block.
The ADC in enCoRe V can be connected to the Tempera-
ture Sensor Core or the Analog Mux Bus as shown in
Figure 7-2. As a default operation, the ADC is connected to
the temperature sensor to give digital values of the tempera-
ture.
The ADC User Module contains an integrator block and one
comparator with positive and negative input set by the
MUXes. The input to the integrator stage comes from the
Analog Global Input Mux or the temperature sensor with full
scale input being 0V to 1.3V.
In the ADC only configuration (the ADC MUX selects the
Analog Mux Bus, not the default temperature sensor connection), an external voltage can be connected to the input
of the modulator for voltage conversion. The ADC is run for
a number of cycles set by the timer, depending upon the
resolution of the ADC desired by the user. A counter counts
the number of trips by the comparator, which is proportional
to the input voltage. The Temp Sensor block clock speed is
36 MHz and is divided down to 1 to 12 MHz for ADC operation.
7.2.2.1 ADC Register Definitions on page 60 shows the reg-
isters that need to be configured for this conversion. A minimum of 2 s wait time is required for the modulator to be
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H60
enabled after the other registers are configured. Therefore,
writes to the Modulator Control Registers (MOD_CR0 and
MOD_CR1) should be held for at least 2 s after all the
other registers are configured.
The registers specified below are controlled by the writing to
the interface commmand/status block.
7.2.2.1ADC Register Definitions
The following registers (listed in table) are associated with
the ADC block in the temperature sensor core of enCoRe V
devices and are listed in address order. The register
descriptions have an associated register table showing the
bit structure for that register. The bits in the tables that are
grayed out are reserved bits and are not detailed in the reg-
ister descriptions that follow. Always write reserved bits with
The following two registers are associated with the Analog to Digital Converter (ADC) interface and are listed in address
order. The register descriptions have an associated register table showing the bit structure for that register. The bits in the
tables that are grayed out are reserved bits and are not detailed in the register descriptions that follow. Always write reserved
bits with a value of ‘0’. For a complete table of registers, refer to the Core Register Summary on page 24.
The two registers, ADC Data Register and the ADC Status Register, are the main interface between the application processor
M8C and the Temperature Sensor/ADC. Control to the ADC registers has to happen through the following two registers. For
example, if a value has to be written to the ADC register TS_CR0, the ADC_DATA register is to be written with command
byte, the register address, and the data. Section 7.4 of this chapter provides detailed information on the interface between the
ADC and the application processor and how control and data transfer to and from the ADC is affected.
Bits 7 to 2 Status Code[5:0]. These bits are ‘0’ by default.
The status of the ADC operation is updated in these 6 bits. If
there is any error, the error status is updated.
Bit: 1 Data Ready. ‘0’ is Temperature Senosr/ADC pro-
cessing the data. ‘1’ is Temperature Senosr/ADC ready to
accept the next data byte.
Bit 0: Instruction Busy. ‘0’ is ADC waiting for the next
instruction.‘1’ is ADC processing the current instruction.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H64
Analog-to-Digital Converter (ADC)
Data
Port
APPLICATION
PROCESSOR
Command
Stream /Return
Data
Status
Port
Temperature
Sensor/ADC
Return
Status
7.4Application Overview
As shown in Figure 7-3, the Temperature Sensor/ADC contains one read/write data port and one read only status port. Reads
from the status port return terminal conditions. The application processor/controller presents the data port with a stream of
bytes formatted to implement the desired commands.
Figure 7-3. ADC Application Interface
7.4.1Use of Application Interface
In a typical programming operation, a command byte is written. After the first byte of information is driven to the ADC
(which is the instruction opcode), the ADC drives the 0th bit
of the ADC_STATUS register as '1' indicating that ADC is
busy in processing the instruction. The next byte of information should be given to the ADC only if the 1st bit of status is
set to '1'. This bit is also set when the read data is ready on
the rd_data port of the ADC. This bit is monitored by the
host processor/controller to give the next byte of data.
7.4.3ADC Usage Guidelines
The temperature sensor block needs to be powered up by
enabling the TS_EN before enabling the modulator. This is
required as this bit sets the analog ground reference for the
ADC. A minimum of 15 s of start-up time is required for the
sensor core to settle to its stable voltage level.
ADC is required to be reset before every conversion to dis-
charge the accumulator capacitor. This is done by disabling
the modulator and holding it in this state for a minimum of 5
s. Programming flexibility for resolution, MUX inputs to the
modulator and comparator are provided.
7.4.2Status Codes
The ADC returns a 6-bit status code (bits 7:2 in the Status
register ADC_STATUS) after an instruction is executed. The
status code when not 0 indicates an error condition.
Table 7-1shows the three error codes that are associated
with the ADC operation.
The errored status code is only cleared after the next command instruction is written into the ADC.
Table 7-1. Status Code for ADC
Status Codes bits [7:2]Meaning
0x0Operation Successful
0x3Invalid Instruction Code
0xCError Status Flag
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H65
The Table 7-2 shows the configuration required for a 10-bit
conversion at 12 MHz sampling frequency.
Table 7-2. Configuration Values - 12 MHz, 10-Bit
Conversion
Register AddressRegister NameConfiguration Value
0x3CMOD_CR10Ch
0x3DACLK02h
0x3ETS_CR001h
0x41Timer Period LFFh
0x42Timer Period H03h
0x55CMP_CR000h
0x3BMOD_CR081h
Enabling the modulator and timer starts the clocks to the
ADC block and thereby the conversion. It is recommended
that the modulator and the timer/counter be enabled at the
same time to start the ADC conversion. A minimum of 2 s
wait time is required for the modulator to be enabled after
the other registers are configured. It is desired that for reli-
able operation, register MOD_CR0 (3Bh) be written to last
after all the others.
7.4.4Typical ADC Operation Procedure
The ADC registers in the temperature sensor block are to be
controlled using the command interface as per details provided in Section 7.4. The following steps with the register
values as shown in Tab le 7- 2 configure the ADC for 12 MHz,
10-bit conversion.
■ Configure the GPIO for an external input or route an
internal voltage through the analog global.
■ Configure registers as mentioned in Table 7-2. Select
analog input source from MOD_CR1 register.
■ Select required clock speed with ACLK register.
■ TS_EN also controls the analog ground reference gener-
ation. This bit is also required to be set for ADC only
operation.
■ Select comparator inputs. The default setting of 00h is
the required setting for this operation.
■ Configure the timer period register based on the resolu-
tion required. Each conversion is required to run 2n
cycles (where n is the resolution).
■ Hold the settings for 15 s to allow the temperature sen-
sor core output to settle before enabling the timer/counter and the modulator through MOD_CR0 register
■ If the ADC interrupt is enabled, an interrupt occurs at the
end of conversion and the counter register holds the
equivalet digital reading.
■ For a new conversion, disable the modulator and timer/
counter and wait for 5s before re-enabling them.
Analog-to-Digital Converter (ADC)
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H66
8. Internal Main Oscillator (IMO)
This chapter presents the Internal Main Oscillator (IMO) and its associated registers. The IMO produces clock signals of 6,
12, and 24 MHz. For a complete table of the IMO registers, refer to the Summary Table of the Core Registers on page 24. For
a quick reference of all enCoRe V registers in address order, refer to the Register Reference chapter on page 163.
8.1Architectural Description
The Internal Main Oscillator (IMO) outputs a clock that is
normally driven to the main system clock, SYSCLK. The
IMO clock frequency can be configured as 6, 12, or 24 MHz.
The accuracy of the internal IMO clock is approximately
±5% over temperature and voltage variation. No external
components are required to achieve this level of accuracy.
The IMO provides higher accuracies when enabled for locking to USB traffic during USB operation. See Full-Speed
USB chapter on page 141 for more information. The fre-
quency doubler circuit, which produces SYSCLKX2, can be
disabled to save power.
Registers for controlling these operations are found in the
Digital Clocks chapter on page 96.
Table 8-1. IMO Frequencies
SLIMO CY7C6xxxx
0012
016
1024
11R eser ved
8.2Application Overview
Device power may be optimized by selecting among the 24,
12, or 6 MHz settings using the SLIMO bits in the
CPU_SCR1 register in conjunction with associated trim val-
ues in the IMO_TR register. Both methods are described
later in this document.
8.2.1Trimming the IMO
An 8-bit register (IMO_TR) is used to trim the IMO. Bit 0 is
the LSB and bit 7 is the MSB. The trim step size is approxi-
mately 60 kHz at the 24-MHz clock setting. A factory trim
setting is loaded into the IMO_TR register at boot time.
8.2.2Engaging Slow IMO
Writing to the SLIMO bits of the CPU_SCR1 register
enables the Slow IMO feature. SLIMO settings for 6 and
12 MHz are listed in Ta b l e 8 - 1 . When changing frequency
ranges, the associated factory trim value must be loaded
into the IMO_TR register. The IMO immediately changes to
the new frequency. Factory trim settings are stored in flash
for the frequencies listed in Table 8-1.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H67
Internal Main Oscillator (IMO)
8.3Register Definitions
The following registers are associated with the Internal Main Oscillator (IMO). The register descriptions have associated register tables showing the bit structure for that register. The bits in the tables that are grayed out are reserved bits and are not
detailed in the register descriptions that follow. Always write reserved bits with a value of ‘0’. For a complete table showing all
oscillator registers, refer to the Summary Table of the Core Registers on page 24.
The Internal Main Oscillator Trim Register (IMO_TR) manually centers the oscillator's output to a target frequency.
This register is loaded with a factory trim value at boot.
When changing frequency ranges, the matching frequency
trim value must be loaded into this register.
A TableRead command to the Supervisory ROM returns the
trim values to the SRAM. EraseAll Parameters (05h), on
page 35 has information on the location of various trim set-
tings stored in flash tables. Firmware needs to read the right
trim value for desired frequency and update the IMO_TR
register. The IMO_TR register must be changed at the lower
frequency range setting.
For additional information, refer to the IMO_TR register on
The Internal Main Oscillator Trim Register 1 (Encore V
IMO_TR1) adjusts the IMO frequency.
Bits 2 to 0: Fine Trim[2:0]. These bits provide a fine tuning capability to the IMO trim. These three bits are the 3 LSB
of the IMO trim with the IMO_TR register supplying the 8
MSB. A larger value in this register will increase the speed
of the oscillator. The value in these bits varies the IMO fre-
quency: approximately 7.5 kHz/step. When the EnableLock
bit is set in the USB_CR1 register, firmware writes to this
register are disabled.
For additional information, refer to the IMO_TR1 register on
page 238.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H68
x An “x” before the comma in the address field indicates that this register can be read or written to no matter what bank is used.
# Access is bit specific. Refer to the Register Reference chapter on page 163 for additional information.
The System Status and Control Register 1 (CPU_SCR1)
conveys the status and control of events related to internal
resets and watchdog reset.
Bit 7: IRESS. The Internal Reset Status bit is a read-only
bit that determines if the booting process occurred more
than once.
When this bit is set, it indicates that the SROM SWBootReset code ran more than once. If this bit is not set, the
SWBootReset ran only once. In either case, the SWBootReset code does not allow execution from code stored in flash
until the M8C core is in a safe operating mode with respect
to supply voltage and flash operation. There is no need for
concern when this bit is set. It is provided for systems that
may be sensitive to boot time, so that they can determine if
the normal one pass boot time was exceeded. For more
information on the SWBootReest code, see the Supervisory
ROM (SROM) chapter on page 32.
Bit 4 to 3: SLIMO[1:0]. These bits set the IMO frequency
range. See the following table for more information.
These changes allow optimization of speed and power. The
IMO trim value must also be changed when SLIMO is
changed (see Engaging Slow IMO on page 67). When not in
external clocking mode, the IMO is the source for SYSCLK;
therefore, when the speed of the IMO changes so does
SYSCLK.
SLIMO CY7C6xxxx
0012
016
1024
11R ese rve d
Bit 0: IRAMDIS. Initialize RAM Disable. This bit is a control
bit that is readable and writeable. The default value for this
bit is ‘0’, which indicates that the maximum amount of SRAM
must be initialized upon watchdog reset to a value of 00h.
When the bit is ‘1’, the minimum amount of SRAM is initial-
ized after a watchdog reset.
For additional information, refer to the CPU_SCR1 register
The Oscillator Control Register 2 (OSC_CR2) configures
various features of internal clock sources and clock nets.
Bit 4: CLK48MEN. This is the 48-MHz clock enable bit. ‘0’
disables the bit and ‘1’ enables the bit. This register setting
applies only when the device is not in OCD mode. When in
OCD mode, the 48-MHz clock is always active.
Bit 2: EXTCLKEN. When the EXTCLKEN bit is set, the
external clock becomes the source for the internal clock
tree, SYSCLK, which drives most device clocking functions.
All external and internal signals, including the low-speed
oscillator, are synchronized to this clock source. The external clock input is located on P1[4]. When using this input,
the pin drive mode must be set to High-Z (not High-Z analog), such as drive mode 11b with PRT1DR bit 4 set high.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H69
Bit 1: RSVD. This is a reserved bit. It should always be 0..
For additional information, refer to the OSC_CR2 register on
page 230.
8.3.5Related Registers
■ OSC_CR2 Register on page 102.
■ CPU_SCR1 Register on page 116.
8.4Timing Diagrams
The IMO startup time is 1.5 s. The worst case skew
between SYSCLK and SYSCLKX2 in Krypton is 470 ps.
BROS 001-13648 has more information.
Internal Main Oscillator (IMO)
8.5Clocking Strategy
No clocks are needed for this block integration in the chip.
8.6Usage Guidelines
Oscillator clock frequency is adjusted to it operating frequency at a given process corner using the trim bits of the
DAC.
8.6.1Power Down Guidelines
The 36 MHz oscillators for SPC control shares resources
with main oscillator, therefore, 36 MHz clock has to be powered down prior to main oscillator is powered down. The PD
applied to the main oscillator will power down the 36MHz
output but the state of the SPC clock may not be known as it
powers down the entire circuit when SYSCLK clock goes
low irrespective of the state of the SPC clock. This ensures
circuit powers down when state of the clock is low.
Current/Voltage Reference guidelines.
Output clock frequency is very sensitive to band gap reference current source. A trimmed (over process corner) and
stable (across V-T) current reference/voltage reference
should be used for stable output frequency.
A high accuracy current reference of 10 µA is required. The
accuracy of oscillator largely depends on the accuracy of
the current reference input.Prerequisite IP
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H71
9. Internal Low-speed Oscillator
(ILO)
This chapter briefly explains the Internal Low-speed Oscillator (ILO) and its associated register. The Internal Low-speed
Oscillator produces a 32-kHz or 1-kHz clock. For a quick reference of all enCoRe V registers in address order, refer to the
Register Reference chapter on page 163.
9.1Architectural Description
The Internal Low-speed Oscillator (ILO) is an oscillator with a nominal frequency of 32 kHz or 1 kHz. It is used to generate
sleep wakeup interrupts and watchdog resets. This oscillator is also used as a clocking source for the digital blocks. This
block operates with a small internal bias current and produces an output clock of either 1 kHz or 32 kHz, configurable by the
user. The ILO is trimmed for 32 kHz in production devices. There is no trim for 1 kHz, hence, high variation is expected from
nominal value.
The block operates by charging a capacitor with a current, to a reference level. When reached, the capacitor is discharged to
ground. This process repeats to provide the oscillator (half) period.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H72
Internal Low-speed Oscillator (ILO)
9.2Register Definitions
The following register is associated with the Internal Low-speed Oscillator (ILO). The register description has an associated
register table showing the bit structure. The bits in the table that are grayed out are reserved bits and are not detailed in the
register description that follows. Always write reserved bits with a value of ‘0’.
The Internal Low-speed Oscillator Trim Register (ILO_TR)
sets the adjustment for the internal low-speed oscillator.
Bit 6: PD_MODE. This bit selects power down mode. Setting this bit high disables the oscillator and current bias
when the ILO is powered down, which results in slower
startup time. Setting this bit low keeps the small current bias
running when the ILO is powered down, which results in
faster startup time.
Bit 5: ILOFREQ. When this bit is set, the oscillator operates
at a nominal frequency of 1 kHz, otherwise, it runs at the
default 32 kHz.
Bits 3 to 0: FREQ_TRIM[3:0]. These bits trim the oscillator
frequency. The device-specific value, placed in the trim bits
of this register at boot time, is based on factory testing. Donot alter the values in the register.
For additional information, refer to the ILO_TR register on
page 234.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H73
10. External Crystal Oscillator
P2[5]
P2[3]
VssVss
Vss
X1
C1
C2
(ECO)
This chapter briefly explains the External Crystal Oscillator (ECO) and its associated registers. The 32.768-kHz external crystal oscillator circuit allows the user to replace the internal low-speed oscillator with a more precise time source. For a quick
reference of all enCoRe V registers in address order, refer to the Register Reference chapter on page 163.
10.1Architectural Description
The External Crystal Oscillator (ECO) circuit requires only
the following external components: an inexpensive watch
crystal and two small value capacitors. The XTALIn (P2[3])
and XTALOut (P2[5]) pins connect to a 32.768-kHz watch
crystal and the two external capacitors bypass these pins to
ground. Figure 10-1 shows the external connections needed
to implement the ECO. See the Application Overview on
page 75 for information on enabling the ECO. Transitions
between the internal and external oscillator domains may
produce glitches on the clock bus.
During the process of activating the ECO, there must be a
hold-off period before using it as the 32.768-kHz source.
This hold-off period is partially implemented in hardware
using the sleep timer. Firmware must set up a sleep period
of one second (maximum ECO settling time), and then
enable the ECO in the OSC_CR0 register. At the one second timeout (the sleep interrupt), the switch is made by
hardware to the ECO. If the ECO is subsequently deactivated, the ILO will again be activated and the switch is made
back to the ILO immediately.
The ECO Exists bit (ECO EX, bit 0 of ECO_CONFIG) is
used to control whether the switch-over is allowed or locked.
This is a write-once bit. It is written early in code execution
after a power-on-reset (POR) or external reset (XRES)
event. A '1' in this bit indicates to the hardware that a crystal
exists in the system, and firmware is allowed to switch back
and forth between ECO and ILO operation. If the bit is '0',
switch-over to the ECO is locked out.
Figure 10-1. External Components for the ECO
The ECO Exists Written bit (ECO EXW, bit 1 of
ECO_CONFIG) is read only and is set on the first write to
this register. When this bit is '1', it indicates that the state of
ECO EX is locked. This is illustrated in Figure 10-2.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H74
Figure 10-2. State Transition Between ECO and ILO
ILO Inactive
ECO Active
ILO Active
ECO Inactive
This transition is allowed only if the
write once "ECO Exists" register bit
is set.
Default POR State
Set OSC_CR0[7] to activate
the ECO, then on the next
sleep interrupt, ECO becomes
the 32.768 kHz source.
Clear OSC_CR0[7] to
immediately revert back
to ILO as 32 kHz source.
External Crystal Oscillator (ECO)
10.2Application Overview
To use a 32.768-kHz external crystal, the GPIO pins that
connect to the crystal must be set to the High-impedance
drive mode. See the General-Purpose I/O (GPIO) chapter
on page 52 for information on GPIOs and their drive modes.
The firmware steps involved in switching between the ILO to
the 32.768-kHz ECO are as follows.
At reset, the device begins operation using the ILO.
1. Set the ECO EX bit to allow crystal operation.
2. Modify bits [2:0] in the External Crystal Oscillator
ENBUS Register to be 011b.
3. Select a sleep interval of one second, using bits[4:3] in
the Oscillator Control Register 0 (OSC_CR0), as the
oscillator stabilization interval.
4. Set bit [7] in the Oscillator Control Register 0
(OSC_CR0) to '1' to enable the external crystal oscillator.
5. The ECO becomes the selected source at the end of the
one-second interval on the edge created by the sleep
interrupt logic. The one-second interval gives the oscillator time to stabilize before it becomes the active source.
The sleep interrupt need not be enabled for the switchover to occur. Reset the sleep timer (if this does not
interfere with any ongoing realtime clock operation), to
guarantee the interval length. Note that the ILO continues to run until the oscillator is automatically switched
over by the sleep timer interrupt.
Note The ILO switches back instantaneously by writing the
32-kHz Select Control bit to '0'.
Note Transitions between oscillator domains may produce
glitches on the 32-kHz clock bus. Functions that require
accuracy on the 32-kHz clock should be enabled after the
transition in oscillator domains.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H75
External Crystal Oscillator (ECO)
10.3Register Definitions
These registers are associated with the external crystal oscillator.
The ECO TRIM Register (ECO_TRIM) controls gain and
power settings for the 32-kHz crystal oscillator.
These settings should not be changed from their default
state. The default value is 14h.
Bits 4 to 2: ECO_XGM[2:0]. These bits set the amplifier
gain. In high-power mode (ECO_LPM=0), the step size of
the current source is approximately 400 nA, and the highest
source current is with the '000' setting. In low-power mode
(ECO_LPM=1), the overall power is approximately 5% lower
with the '000' setting than with the '111' setting.
’000’ is the highest gain setting, and has the lowest power in
low-power mode (5% power reduction).
’111’ is the lowest gain setting.
This value is factory trimmed; the typical value is '101'.
Bits 1 to 0: ECO_LP[1:0]. These bits set the gain mode.
’00’ is the highest power setting.
’11’ is the lowest power setting. (30% power reduction).
The default value is '00'.
For additional information, refer to the ECO_TRIM register
The ECO Configuration Register provides status and control
for the ECO.
Bit 2 ECO_LPM. This bit enables the ECO low-power
mode when high. This is recommended for use only during
sleep mode.
Bit 1 ECO_EXW. The ECO Exists Written bit is used as a
status bit to indicate that the ECO EX bit was previously writ-
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H76
ten to. It is read only. When this bit is a '1' indicates that the
ECO_CFG register was written to and is now locked.
Bit 0 ECO_EX. The ECO Exists bit serves as a flag to the
hardware, to indicate that an external crystal oscillator exists
in the system. Just after boot, it may be written only once to
a value of '1' (crystal exists) or '0' (crystal does not exist).
If the bit is '0', a switch-over to the ECO is locked out by
hardware. If the bit is '1', hardware allows the firmware to
External Crystal Oscillator (ECO)
freely switch between the ECO and ILO. It should be written
as early as possible after a POR or XRES event.
10.3.4Related Registers
■ OSC_CR0 Register, on page 101.
■ PRTxDR Registers register on page 56.
■ PRTxIE Registers register on page 56.
10.4Usage Modes and
Guidelines
This block operates at extremely low current levels, making
it vulnerable to coupled noise. Take care to avoid coupling
noise from neighboring signal pins. The block is designed to
Figure 10-3. Power Mode State Machine
For additional information, refer to the ECO_CFG register
on page 229
accept a wide variety of 6- or 12-pF crystals. There are four
distinct operating power modes:
■ Power-down (PDM)
■ Startup mode (SPM)
■ High-power mode (HPM)
■ Low-power mode (LPM)
There are specific sequences that are used to switch
between each mode; typically a small delay is required after
each instruction.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H77
11. Sleep and Watchdog
Outputs
32 kHz CLK
Control Inputs
OSC_SCR0
CPU_SCR0
Wakeup Timer
Sleep Control Logic
Register Decode Logic
(SLP_CFG, SLP_CFG2,
SLP_CFG3, Internal
Configuration Registers)
Sleep Timer
CPU Hold
Off
IMO
CLK
This chapter discusses the Sleep and Watchdog operations and their associated registers. For a complete table of the Sleep
and Watchdog registers, refer to the Summary Table of the Core Registers on page 24. For a quick reference of all enCoRe V
registers in address order, refer to the Register Reference chapter on page 163.
11.1Architectural Description
Device components that are involved in Sleep and Watchdog operation are the selected 32-kHz clock, the wakeup timer, the
Sleep bit in the CPU_SCR0 register, the sleep circuit (to sequence going into and coming out of sleep), the bandgap refresh
circuit (to periodically refresh the reference voltage during sleep), and the watchdog timer.
Figure 11-1. Sleep Controller Architecture
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H78
Sleep and Watchdog
11.1.1Sleep Control Implementation Logic
This section details the sleep mode logic implementation.
Conditions for entering the sleep modes:
■ Standby Mode: Set the SLEEP bit in the CPU_SCR0 register. This asserts the “sleep” signal for the sleep controller.
■ I2C_USB Mode: Set the I2C_ON bit in the SLP_CFG2 register and then set the SLEEP bit in the CPU_SCR0 register.
Another way to enter I2C_USB sleep mode is to set the USB Enable bit in the USB_CR0 register and then set the SLEEP
bit in the CPU_SCR0 register. This asserts the sleep signal for the sleep controller and also the I2CEnable signal to the
power system.
The I2C block works in I2C_USB sleep mode only to wake up the system. That is, when the device is in sleep, I2C can
detect a start condition and receive an address. If the address matches, I2C generates an interrupt and wakes the system
(refer to Power Modes on page 120). If you put the device to sleep again while these transactions are occurring (i.e., when
you are in the middle of I2C transactions), I2C does not work and will send NAKs. I2C can only detect a start condition
and collect an 8-bit address then wake the system through an interrupt during I2C sleep mode. Therefore, it is recommended to check the bus status in the I2C_XSTAT register before putting the device to sleep if there is any I2C data transfer. To ensure data retention in the 32-byte I2C buffer during sleep, the I2C_ON bit in SLP_CFG2 register should be set
before entering sleep state.
■ Deep Sleep Mode: Configure the I2C_ON bit in the SLP_CFG2 register to 0, then USB Enable bit in the USB_CR0 regis-
ter to '0' and the X32ON bit in OSC_CR0 to '0'. Set the LSO_OFF bit in the SLP_CFG2 register and then set the “SLEEP”
bit in the CPU_SCR0 register. This enables the LSO_OFF signal to power down the LSO. The system enters into deep
sleep mode. One point to note here is to not set the X32ON bit to '1' without setting the ECO_EX (ECO exists) bit in the
ECO_CFG (1,E1h) register to a '1'. If you do so, the deep sleep mode is not entered, but clk32K is also not running. This
implies that the sleep timer interrupt or the programmable timer interrupt cannot occur.
11.1.1.1Wakeup Logic
■ Waking up from standby mode is by an interrupt, which can be a sleep timer interrupt, a GPIO interrupt, a 16-bit program-
mable timer 0 interrupt, or a USB interrupt.
■ For the device, the wakeup from I2C_USB sleep mode can be by an I2C interrupt in addition to a sleep timer interrupt, a
programmable timer 0 interrupt, a GPIO interrupt, or a USB interrupt.
■ For the device, the wakeup from deep sleep mode can be by either a GPIO interrupt or a USB interrupt.
■ In standby mode during buzz, if the external supply falls below the LVD limit, an LVD interrupt occurs and initiates the
wakeup sequence.
■ In standby mode, if watchdog reset occurs, it first initiates the wakeup sequence. After the wakeup is done, it resets the
system.
As shown in Figure 11-2, when the SLEEP bit is deasserted,
the wakeup is initiated. The sequence is shown in the following timing diagram. The taps used in this wakeup sequence
are generated based upon user configuration settings in the
SLP_CFG3 register.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H79
Sleep and Watchdog
Power good
INT
Regulator Enable
Power switches
Enable
Bandgap Enable
POR Enable
IMO Enable
T0T1T2T3
Interrupt
Sample Bandgap
Switch reference
from standby to
BG
Sample POR
T4
BRQ
SLEEP
Enable Flash
Idle_Flash
½ CPU
clock
cycle
PD
10 – 60 µs3 – 20 µs1 – 20 µs
Figure 11-2. Wakeup Sequence for the Device
1, 2, 3
1. The duration of Power Good is 3 ILO Cycles.
2. The timing of T0 – T4 is based on the IMO frequency and the settings in the SLP_CFG3 register. For additional information, refer to the SLP_CFG3 Register
on page 83.
3. The maximum worst-case duration of the wakeup sequence is 263 µs, based on the minimum specified ILO frequency of 19 kHz, the minimum specified IMO
frequency, and the default settings of the SLP_CFG3 register.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H80
Sleep and Watchdog
Note The T0, T1, and T2 mentioned in the SLP_CFG3 reg-
ister with respect to Figure 11-2 on page 80 are defined as
follows:
■ T0: Time duration between T0 and T1 in the timing dia-
gram.
■ T1: Time duration between T1 and T2 in the timing dia-
gram.
■ T2: Time duration between T3 and T4 in the timing dia-
gram.
11.1.2Sleep Timer
The Sleep Timer is a 15-bit up counter clocked by the 32kHz clock source. This timer is always enabled except in
deep sleep mode. The exception to this is within an
circuit emulator
) in debugger mode and when the Stop bit
ICE (in-
in the CPU_SCR0 is set; the sleep timer is disabled, so that
the user does not get continual watchdog resets when a
breakpoint is hit in the debugger environment.
If the associated sleep timer interrupt is enabled, a periodic
interrupt to the CPU is generated based upon the sleep
interval selected from the OSC_CR0 register. The sleep
timer functionality does not need to directly associate with
the sleep state. It can be used as a general-purpose timer
interrupt regardless of sleep state.
The reset state of the sleep timer is a count value of all
zeros. There are two ways to reset the sleep timer. Any
hardware reset, (that is, POR, XRES, or Watchdog Reset
(WDR)) resets the sleep timer. There is also a method that
allows the user to reset the sleep timer in firmware. A write
of 38h to the RES_WDT register clears the sleep timer.
Note Any write to the RES_WDT register also clears the
watchdog timer.
Clearing the sleep timer is done at anytime to synchronize
the sleep timer operation to CPU processing. A good example of this is after POR. The CPU hold off, due to voltage
ramp and others, may be significant. In addition, a significant amount of program initialization may be required. However, the sleep timer starts counting immediately after POR
and is at an arbitrary count when user code begins execution. In this case, it is desirable to clear the sleep timer
before enabling the sleep interrupt initially to ensure that the
first sleep period is a full interval.
11.2Application Overview
The following are notes regarding sleep related to firmware
and application issues.
Note 1 If an interrupt is pending, enabled, and scheduled to
be taken at the instruction boundary after the write to the
SLEEP bit, the system does not go to sleep. The instruction
still executes, but it cannot set the SLEEP bit in the
CPU_SCR0 register. Instead, the interrupt is taken and the
effect of the sleep instruction ignored.
Note 2 There is no need to enable the Global Interrupt
Enable (CPU_F register) to wake the system out of sleep
state. Individual interrupt enables, as set in the interrupt
mask registers, are sufficient. If the Global Interrupt Enable
is not set, the CPU does not service the ISR associated with
that interrupt. However, the system wakes up and continues
executing instructions from the point at which it went to
sleep. In this case, the user must manually clear the pending interrupt or subsequently enable the Global Interrupt
Enable bit and let the CPU take the ISR. If a pending interrupt is not cleared, it is continuously asserted. Although the
SLEEP bit may be written and the sleep sequence executed
as soon as the device enters sleep mode, the SLEEP bit is
cleared by the pending interrupt and sleep mode is exited
immediately.
Note 3 Upon wakeup, the instruction immediately after the
sleep instruction is executed before the interrupt service
routine (if enabled). The instruction after the sleep instruction is prefetched before the system actually goes to sleep.
Thus, when an interrupt occurs to wake the system up, the
prefetched instruction executes and the interrupt service
routine is executed. (If the Global Interrupt Enable is not set,
instruction execution continues where it left off before
sleep.)
Note 4 If the Global Interrupt Enable bit is disabled, it is
safely enabled just before the instruction that writes the
SLEEP bit. It is usually undesirable to get an interrupt on the
instruction boundary just before writing the SLEEP bit. This
means that upon return from the interrupt, the sleep command is executed, possibly bypassing any firmware preparations that are necessary to go to sleep. To prevent this,
disable interrupts before making preparations. After sleep
preparations, enable global interrupts and write the SLEEP
bit with the two consecutive instructions as follows.
and f,~01h // disable global interrupts
// (prepare for sleep, could
// be many instructions)
or f,01h // enable global interrupts
mov reg[ffh],08h // Set the sleep bit
Because of the timing of the Global Interrupt Enable instruction, it is not possible for an interrupt to occur immediately
after that instruction. The earliest for the interrupt to occur is
after the next instruction (write to the SLEEP bit) is executed. If an interrupt is pending, the sleep instruction is executed; but as described in Note 1, the sleep instruction is
ignored. The first instruction executed after the ISR is the
instruction after sleep.
Note 5 When an interrupt occurs after the sleep bit is written
and before “PD” (power down signal) is asserted, the interrupt is ignored. The time from the SLEEP bit being written to
PD being asserted is 2.5 CPU cycles. Thus, if the interrupt
occurs within this period, it is ignored. Refer to Figure 11-3
on page 84 for sleep. The interrupts that occur after this
period, that is, when the device is in sleep, are considered
and the device wakes up.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H81
Sleep and Watchdog
11.3Register Definitions
The following registers are associated with Sleep and Watchdog operations and are listed in address order. Each register
description has an associated register table showing the bit structure for that register. The bits that are grayed out in the the
following tables are reserved bits and are not detailed in the register descriptions. Always write reserved bits with a value of
‘0’. For a complete table of the Sleep and Watchdog registers, refer to the Summary Table of the Core Registers on page 24.
The Reset Watchdog Timer Register (RES_WDT) clears the
watchdog timer (a write of any value) and clears both the
watchdog timer and the sleep timer (a write of 38h).
Bits 7 to 0: WDSL_Clear[7:0]. The Watchdog Timer
(WDT) write-only register is designed to timeout at three
sleep timer rollover events. If only the WDT is cleared, the
next Watchdog Reset (WDR) occurs anywhere from two to
three times the current sleep interval setting. If the sleep
timer is near the beginning of its count, the watchdog timeout is closer to three times.
However, if the sleep timer is very close to its
count, the watchdog timeout is closer to two times. To
ensure a full three times timeout, clear both the WDT and
the sleep timer. In applications that need a realtime clock
and cannot reset the sleep timer when clearing the WDT, the
duty cycle at which the WDT must be cleared is no greater
than two times the sleep interval.
For additional information, refer to the RES_WDT register
The Sleep Configuration Register (SLP_CFG2) holds the
configuration for I2C sleep, deep sleep, and buzz.
To ensure data retention in the 32-byte I2C buffer during
sleep, the I2C_ON bit should be set before entering sleep
state.
Bits 3 and 2: ALT_Buzz[1:0]. These bits control additional
selections for POR/LVD buzz rates. These are lower rates
than the compatibility mode to provide for lower average
power.
‘00’ - Compatibility mode, buzz rate determined by PSSDC
bits.
‘01’ - Duty cycle is 1/32768.
‘10’ - Duty cycle is 1/8192.
‘11’ - Reserved.
Bit 0: LSO_OFF: This bit disables the LSO oscillator when
in sleep state. By default, the LSO oscillator runs in sleep.
When this bit is ‘0’, the standby regulator is active at a power
level to supply the LSO and Sleep timer circuitry and the
LSO is enabled. When this bit is ‘1’, the LSO is disabled in
sleep, which in turn, disables the Sleep Timer, Watchdog
Timer, and POR/LVD buzzing activity in sleep. If I2C_ON is
not enabled and this bit is set, the device is in the lowest
power deep sleep mode. Only a GPIO interrupt awakens the
Bit 1: I2C_ON. This bit enables the standby regulator in
sleep at a level sufficient to supply the I2C circuitry. It is
independent of the LSO_OFF bit.
device from deep sleep mode.
For additional information, refer to the SLP_CFG2 register
The Sleep Configuration Register (SLP_CFG3) holds the
configuration of the wakeup sequence taps.
It is strongly recommended to not alter this register setting.
Bit 6: DBL_TAPS. When this bit is set, all the tap values
(T0, T1, and T2) are doubled for the wakeup sequence.
Bits 5 and 4: T2TAP[1:0]. These bits control the duration
of the T2-T4 sequence (see Figure 11-2 on page 80) by
selecting a tap from the Wakeup Timer. Note The T2 delay is
only valid for the wakeup sequence. It is not used for the
buzz sequence.
‘00’ - 1 µs
‘01’ - 2 µs
‘10’ - 5 µs
‘11’ - 10 µs
Bits 1 and 0: T0TAP[1:0]. These bits control the duration
of the T0-T1 sequence (see Figure 11-2 on page 80) by
selecting a tap from the Wakeup Timer.
‘00’ - 10 µs
‘01’ - 14 µs
‘10’ - 20 µs
‘11’ - 30 µs
For additional information, refer to the SLP_CFG3 register
on page 237.
11.3.5Related Registers
■ INT_MSK0 Register on page 49.
■ OSC_CR0 Register on page 101.
■ ILO_TR Register on page 73.
■ CPU_SCR0 Register on page 117.
■ CPU_SCR1 Register on page 116.
Bits 3 and 2: T1TAP[1:0]. These bits control the duration
of the T1-T2 sequence (see Figure 11-2 on page 80) by
selecting a tap from the Wakeup Timer.
‘00’ - 3 µs
01’ - 4 µs
‘10’ - 5 µs
‘11’ - 10 µs
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H83
11.4Timing Diagrams
IOW
SLEEP
BRQ
BRA
PD
On the falling edge of
CPUCLK, PD is asserted.
The system clock is halted;
the Flash and bandgap are
powered down.
CPUCLK
Firmware write to
the SLEEP bit
causes an
immediate BRQ.
CPU captures
BRQ on next
CPUCLK edge.
CPU responds
with a BRA.
11.4.1Sleep Sequence
Sleep and Watchdog
The SLEEP bit in the CPU_SCR0 register, is an input into
the sleep logic circuit. This circuit is designed to sequence
the device into and out of the hardware sleep state.
Figure 11-3 shows the hardware sequence to put the device
to sleep, defined as follows.
1. Firmware sets the SLEEP bit in the CPU_SCR0 register.
The Bus Request (BRQ) signal to the CPU is immediately asserted: This is a request by the system to halt
CPU operation at an instruction boundary.
2. The CPU issues a Bus Request Acknowledge (BRA) on
the following
3. The sleep logic waits for the following
the CPU clock and then asserts a system wide Power
Down (PD) signal. In Figure 11-3, the CPU is halted and
the system wide PD signal is asserted.
The system-wide PD signal controls three major circuit
blocks: the flash memory module, the Internal Main Oscillator (6-/12-MHz oscillator), and the bandgap voltage reference. These circuits transition into a zero power state.
The only operational circuits on the enCoRe V device in
standby sleep mode are the ILO, the bandgap refresh circuit, and the supply voltage monitor circuit. In standby sleep
mode, the supply voltage monitor circuit is active only during
the buzz interval. To properly detect and recover from a
positive edge of the CPU clock.
negative edge of
VDD brown out condition, the configurable buzz rate must
be frequent enough to capture the falling edge of VDD. If the
falling edge of VDD is too sharp to be captured by the buzz
rate, any of the following actions must be taken to ensure
that the device properly responds to a brown out condition.
■ Bring the device out of sleep before powering down. This
can be accomplished in firmware, or by asserting XRES
before powering down.
■ Assure that VDD falls below 100 mV before powering
back up.
■ Set the No Buzz bit in the OSC_CR0 register to keep the
voltage monitoring circuit powered during sleep.
■ Increase the buzz rate to assure that the falling edge of
VDD will be captured. The rate is configured through the
PSSDC bits in the SLP_CFG register.
In deep sleep mode, the ILO, bandgap refresh circuit, and
supply voltage monitor circuit are all powered down. However, additional low-power voltage monitoring circuitry gets
enabled when entering deep sleep. This additional lowpower voltage monitoring circuitry allows VDD brown out
conditions to be detected for edge rates slower than 1V/ms.
Figure 11-3. Sleep Sequence
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H84
Sleep and Watchdog
Power good
BUZZ
Regulator Enable
Bandgap Enable
POR Enable
IM O E na ble
T0T1T2T3
BUZZ
Sample Bandgap
Switch reference
om standby to BG
Sample POR
T4
2 IMO
cycles
10-30 us3-10 us
1-10 us
11.4.2Wakeup Sequence
When asleep, the only event that wakes the system is an
interrupt. The Global Interrupt Enable of the CPU Flag register does not need to be set. Any unmasked interrupt wakes
the system up. It is optional for the CPU to actually take the
interrupt after the wakeup sequence.
The wakeup sequence is synchronized to the taps from the
wakeup timer (running on IMO clock). This allows the flash
memory module enough time to power up before the CPU
asserts the first read access. Another reason for the delay is
to allow the IMO, bandgap, and LVD/POR circuits time to
settle before actually being used in the system. As shown in
Figure 11-2, the wakeup sequence is as follows.
1. The wakeup interrupt occurs and the sequence is initiated at INT (shown in Figure 11-2 on page 80). The
interrupt asynchronously enables the regulator, the
bandgap circuit, LSO, POR, and the IMO. As the core
power ramps, the IMO starts to oscillate and the remainder of the sequence is timed with configurable durations
from the wakeup timer.
2. At T1, the bandgap is sampled and the flash is enabled.
3. At T2, the flash is put in power saving mode (idle).
4. At T3, the POR/LVD comparators are sampled and the
CPU restarts.
There is no difference in wakeup from deep sleep or buzzed
sleep because in all cases, to achieve the power specification, the regulator, references, and core blocks must be
shut.
11.4.3Bandgap Refresh
During normal operation the bandgap circuit provides a voltage reference (VRef) to the system for use in the analog
blocks, flash, and
mally, the bandgap output is connected directly to the VRef
signal. However, during sleep, the
erator block and LVD circuits are completely powered down.
The bandgap and LVD blocks are periodically re-enabled
during sleep to monitor for low-voltage conditions. This is
accomplished by periodically turning on the bandgap.
The rate at which the refresh occurs is related to the 32-kHz
clock and controlled by the Power System Sleep Duty
Cycle. Table 11-1 lists the available selections.
Table 11-1. Power System Sleep Duty Cycle Selections
PSSDCSleep Timer CountsPeriod (Nominal)
00b (default)2568 ms
01b102431.2 ms
10b642 ms
11b16500 µs
Note Valid when ALT_Buzz[1:0] of the SLP_CFG2 register is 00b.
low-voltage detect (LVD) circuitry. Nor-
bandgap reference gen-
Figure 11-4. Buzz Sequence Timing
The buzz sequence after the Buzz signal comes. This is shown in Figure 11-4, “Buzz Sequence Timing,” on page 85.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H85
Sleep and Watchdog
SLEEP INT
WD RESET
(WDR)
CLK32K
2WD COUNT30
11.4.4Watchdog Timer
On device boot up, the Watchdog Timer (WDT) is initially
disabled. The PORS bit in the System Control register controls the enabling of the WDT. Upon boot, the PORS bit is
initially set to '1', indicating that either a POR or XRES event
occurred. The WDT is enabled by clearing the PORS bit.
After this bit is cleared and the WDT enabled, it cannot be
disabled. (The PORS bit cannot be set to '1' in firmware;
only cleared.)
The only way to disable the watchdog function after it is
enabled is through a subsequent POR or XRES. Even
though the WDT is disabled during the first time through initialization code after a POR or XRES, write all code as if it is
enabled (that is, periodically review the WDT). This is
because in the initialization code after a WDR event, the
watchdog timer is enabled so all code must be aware of this.
The watchdog timer is three counts of the sleep timer interrupt output. The watchdog interval is three times the
selected sleep timer interval. The available selections for the
watchdog interval are shown in Ta b le 11 -1 . When the sleep
timer interrupt is asserted, the watchdog timer increments.
When the counter reaches three, a terminal count is
asserted. This terminal count is registered by the 32-kHz
clock. Therefore, the WDR (Watchdog Reset) signal goes
high after the falling edge of the 32-kHz clock and held
asserted for one cycle (30
registers the WDT terminal count is not reset by the WDR
signal when it is asserted, but is reset by all other resets.
This timing is shown in Figure 11-5.
s nominal). The flip-flop that
Figure 11-5. Watchdog Reset
When enabled, periodically clear the WDT in firmware. Do
this with a write to the RES_WDT register. This write is data
independent, so any write clears the watchdog timer. (Note
that a write of 38h also clears the sleep timer.) If for any reason the firmware fails to clear the WDT within the selected
interval, the circuit asserts WDR to the device. WDR is
equivalent in effect to any other reset. All internal registers
are set to their reset state. (See the table titled Reset Func-
tionality on page 120.) An important aspect to remember
about WDT resets is that RAM initialization can be disabled
(IRAMDIS is in the CPU_SCR1 register). In this case, the
SRAM contents are unaffected; so that when a WDR
occurs, program variables are persistent through this reset.
In practical application, it is important to know that the
watchdog timer interval can be anywhere between two and
three times the sleep timer interval. The only way to guarantee that the WDT interval is a full three times that of the
sleep interval is to clear the sleep timer (write 38h) when
clearing the WDT register. However, this is not possible in
applications that use the sleep timer as a realtime clock. In
the case where firmware clears the WDT register without
clearing the sleep timer, this occurs at any point in a given
sleep timer interval. If it occurs just before the terminal count
of a sleep timer interval, the resulting WDT interval is just
over two times that of the sleep timer interval.
11.5
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H86
12. Regulated I/O
IO IO IO IO
Pass Transistors
Fb
Bg
Replica
Structure
Charge Pump
Bg
Discharge
Ibg
Comparator
This chapter presents the architecture of the Regulated I/O and its functionality, along with voltage regulator information.
There are no registers associated with the regulated I/O. For a quick reference of all enCoRe V registers in address order,
refer to the Register Reference chapter on page 163.
12.1Architectural Description
The Regulated I/O is an NMOS replica bias voltage regulator. This I/O regulator has two operating ranges. For a chip supply
between 3.1V and 5.5V it can be configured to regulate the I/O output voltage to 3.0V, 2.4V, or 1.8V. For a chip Vdd between
2.4V to 3.0V it can provide regulated output voltage of 1.8V.
Figure 12-1. Regulated I/O Block Diagram
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H87
12.1.1Bias Generator
The bias generator generates gate bias to all pass transistors. This block mainly contains a charge pump an opamp
along with a NMOS diode in a forward biased condition.
12.1.2Charge Pump
The Charge Pump gets clock information from the internal
main oscillator and pumps the charge to forward bias the
NMOS diode. The NMOS diode is always in a slightly forward biased condition. There are control bits that control the
current pumped into the charge pump for different frequencies of the charge pump clock input.
12.1.3Comparator
The comparator expects an input of 1.2V reference and is
used in negative feedback to generate a regulation voltage
at the output. he NMOS replica structure is an NMOS diode
configuration and is stacked over the output of the opamp.
Because of the charge pump forward bias in the NMOS
diode, the drain voltage is always the sum of the comparator
output voltage and the transistor threshold voltage. This
voltage is given as bias voltage to the gates of all pass transistors.
Regulated I/O
12.1.4Replica Structure
The Replica Structure has a NMOS in series with the resistive divider structure. The resistive divider network provides
feedback to the comparator in such a way that the source of
the replica NMOS is always set to 3V.
12.1.5Pass Transistors
The Pass Transistors are NMOS pass transistors that sit
with the I/O driver. These transistors ensure that the I/O output voltage does not exceed the regulated voltage and
support5 mA drive strength. In order to have acceptable
control of the I/O output voltage, the NMOS pass transistors
provide the same operating conditions as that of the replica
structure. This is archived by connecting a resistance of one
fourth of the replica resistor to the source of the NMOS pass
transistor. This is a common resistor for all four I/O.
12.2Application Overview
The I/O voltage regulator regulates the output of the I/O to
3.0, 2.5, 1.8 volts. The pass transistor of the regulator sits
with the driver of the I/O. Bias for the pass transistor is
routed along the supply ring.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H88
Regulated I/O
12.3Register Definitions
The following registers are associated with the Regulated I/O and are listed in address order. The register descriptions have
an associated register table showing the bit structure for that register. The bits in the tables that are grayed out are reserved
bits and are not detailed in the register descriptions that follow. Always write reserved bits with a value of ‘0’. For a complete
table of Regulated I/O registers, refer to the Core Register Summary on page 24.
The Input/Output Configuration Register 1 (IO_CFG1) configures the Port 1 output regulator and set the Interrupt
mode for all GPIO.
Bit 7: StrongP. Setting this bit increases the drive strength
and edge ratio for high outputs.
Bit 5 and 4: Range[1:0]. These bits select the regulator
output level for Port 1. Available levels are 3.0V, 1.8V, and
2.5V.
Bit 2: SPICLK_ON_P10. When this bit is set to ‘1’, the SPI
clock is mapped to Port 1 pin 0. Otherwise, it is mapped to
Port 1 pin 3.
Bit 1: REG_EN. The Register Enable bit (REG_EN) con-
trols the regulator on Port 1 outputs.
Bit 0: IO INT. This bit sets the GPIO Interrupt mode for all
pins in the CY7C643xx and CY7C604xx enCoRe V devices.
GPIO interrupts are controlled at each pin by the PRTxIE
registers, and also by the global GPIO bit in the INT_MSK0
Bit 3 P1_LOW_THRS. This bit reduces the threshold volt-
age of the P1 port input buffers so that there are no compatibility issues when Port 1 is communicating at regulated
voltage levels.
register.
For additional information, refer to the IO_CFG1 register on
page 224.
‘0’ is standard threshold of VIH, VIL. ‘1’ is reduce threshold
of VIH, VIL.
The Input/Output Configuration Register 2 (IO_CFG2)
selects output regulated supply and clock rates.
Bits 5 to 3: REG_LEVEL[2:0]. These bits select output
regulated supply.
REG_LEVEL[2:0]Approx. Regulated Supply (V)
00032.51.8
0013.12.61.9
0103.22.72.0
0113.32.82.1
1003.42.92.2
1013.53.02.3
1103.63.12.4
1113.73.22.5
REG_LEVEL[2:0]REG_CLOCK[1:0]RW : 00
Bits 1 to 0: REG_CLOCK[1:0]. The Regulated I/O charge
pump can operate with a maximum clock speed of 12 MHZ.
The REG_CLOCK[1:0] bits select clocking options for the
regulator. Setting REG_CLOCK[1:0] to ‘10’ should be used
with 24 MHz SYSCLK and ‘01’ should be used with 6/12
MHz SYSCLK.
REG_CLOCK[1:0]SYSCLK Clock Rate
1024 MHz
016/12 MHz
For additional information, refer to the IO_CFG2 register on
page 227.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H89
13. I/O Analog Multiplexer
Analog
Mux
IO Pin
Device
IO Pin
Analog Mux Bus
IO
Pin
IO Pin
GPIO
Pin
Switch Enable
(MUX_CRx.n)
Analog Mux Bus
Discharge
Clock
Break-
Before-Make
Circuitry
This chapter explains the device-wide I/O Analog Multiplexer for the CY7C643xx and CY7C604xx enCoRe V devices and
their associated registers. For a quick reference of all enCoRe V registers in address order, refer to the Register
Reference chapter on page 163.
13.1Architectural Description
The CY7C643xx and CY7C604xx enCoRe V devices contain an enhanced analog multiplexer (mux) capability. This
function allows many I/O pins to connect to a common internal analog global bus.
You can connect any number of pins simultaneously, and
dedicated support circuitry allows selected pins to be alternately charged high or connected to the bus. The analog
global bus can be connected as a comparator input.
Figure 13-1 shows a block diagram of the I/O analog mux
system.
Figure 13-1. I/O Analog Mux System
ber of pins can be enabled at the same time. At reset, all of
these mux connections are open (disconnected).
Figure 13-2. I/O Pin Configuration
For each pin, the mux capability exists in parallel with the
normal GPIO cell, shown in Figure 13-2. Normally, the associated GPIO pin is put into a high-impedance state for these
applications, although there are cases where the GPIO cell
is configured by the user to briefly drive pin initialization
states as described ahead.
Pins are individually connected to the internal bus by setting
the corresponding bits in the MUX_CRx registers. Any num-
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H90
I/O Analog Multiplexer
13.2Register Definitions
The following registers are only associated with the Analog Bus Mux in the CY7C643xx and CY7C604xx enCoRe V devices
and are listed in address order. Each register description has an associated register table showing the bit structure for that
register. Register bits that are grayed out throughout this document are reserved bits and are not detailed in the register
descriptions that follow. Always write reserved bits with a value of ‘0’.
The Analog Mux Port Bit Enable Registers (MUX_CR0,
MUX_CR1, MUX_CR2, MUX_CR3, and MUX_CR4) control
the connection between the analog mux bus and the corresponding pin.
Bits 7 to 0: ENABLE[7:0]. The bits in these registers
enable connection of individual pins to the analog mux bus.
Each I/O port has a corresponding MUX_CRx register.
Setting a bit high connects the corresponding pin to the
analog bus.
For additional information, refer to the MUX_CRx register on
page 223.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H91
Section C: System Resources
SYSTEM BUS
SYSTEM RESOURCES
I2C
Slave
SPI
Master/
Slave
POR
and
LVD
USB
System
Resets
Three 16-Bit
Programmable
Timers
Digital
Clocks
This section discusses the system resources that are available for the enCoRe V devices and the registers associated with
those resources. This section includes the following chapters:
■ Digital Clocks on page 96.
2
■ I
C Slave on page 103.
■ System Resets on page 114.
■ POR and LVD on page 121.
■ SPI on page 123.
■ Programmable Timer on page 137.
■ Full-Speed USB on page 141.
Top-Level System Resources Architecture
The following figure displays the top-level architecture of the enCoRe V system resources. Each component of the figure is
discussed at length in the chapters that follow.
enCoRe V System Resources
.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H92
System Resources Register Summary
The following table lists all the enCoRe V registers for the system resources, in address order, within their system resource
configuration. The bits that are grayed out are reserved bits. If you write these bits, always write them with a value of ‘0’.
# Access is bit specific. Refer to the Register Reference chapter on page 163 for additional information.
R Read register or bit(s).
W Write register or bit(s).
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H95
14. Digital Clocks
This chapter discusses the Digital Clocks and their associated registers. It serves as an overview of the clocking options
available in the enCoRe V devices. For detailed information on specific oscillators, see the individual oscillator chapters in the
section called enCoRe V Core on page 23. For a complete table of the digital clock registers, refer to the System Resources
Register Summary on page 93. For a quick reference of all enCoRe V registers in address order, refer to the Register
Reference chapter on page 163.
14.1Architectural Description
The enCoRe V M8C core has a large number of clock
sources that increase the flexibility of the enCoRe V device,
as listed in Table 14-1 and illustrated in Figure 14-1.
Table 14-1. System Clocking Signals and Definitions
SignalDefinition
SYSCLK
CPUCLK
CLK32K
CLKIM0
SLEEP
Either the direct output of the Internal Main Oscillator or the
direct input of the EXTCLK pin while in external clocking
mode.
SYSCLK is divided down to one of eight possible frequencies
to create CPUCLK, which determines the speed of the M8C.
See the OSC_CR0 Register on page 101.
The Internal Low-speed Oscillators output. See the
OSC_CR0 Register on page 101.
The internally generated clock from the IMO. By default, this
clock drives SYSCLK; however, an external clock may be
used by enabling EXTCLK mode. The IMO can be set to various frequencies; the default is 12 MHz.
One of four sleep intervals may be selected from 1.95 ms to 1
second. See the OSC_CR0 Register on page 101.
14.1.1Internal Main Oscillator
The Internal Main Oscillator (IMO) is the foundation upon
which almost all other clock sources in the enCoRe V device
are based. The default mode of the IMO creates a 12 MHz
reference clock that is used by many other circuits in the
device. The enCoRe V device has an option to replace the
IMO with an externally supplied clock that becomes the
base for all of the clocks the IMO normally serves. The internal base clock net is called SYSCLK and is driven by either
the IMO or an external clock (EXTCLK).
Whether the external clock or the internal main oscillator is
selected, all device functions are clocked from a derivative
of SYSCLK or are resynchronized to SYSCLK. All external
asynchronous signals and the internal low-speed oscillator
are resynchronized to SYSCLK for use in the digital blocks.
The IMO frequency can be adjusted to other frequencies
besides 12 MHz. See the Architectural Description on
page 67 for more information.
The IMO is discussed in detail in the Internal Main Oscillator
(IMO) chapter on page 67.
14.1.2Internal Low-speed Oscillator
The Internal Low-speed Oscillator (ILO) is available as a
general clock, but is also the clock source for the sleep and
watchdog timers. The ILO can be disabled in deep sleep
mode, or in other sleep modes when the ECO is enabled.
The ILO is discussed in detail in the Internal Low-speed
Oscillator (ILO) chapter on page 72.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H96
Digital Clocks
SYSCLK
CPUCLK
SLEEP
Internal
Main
Oscillator
(IMO)
IMO Trim Register
CLK32K
EXTCLK
P1[4]
(EXTCLK Input)
IMO_TR[7:0]
OSC_CR2[2]
Clock Divider
OSC_CR0[2:0]
Sleep Clock Divider
OSC_CR0[4:3]
2
6
2
9
2
12
2
15
Slow IMO Option
CPU_SCR1[4:3]
1
2
4
8
16
32
128
256
ILO Trim Register
Internal Low
Speed
Oscillator
(ILO)
ILO_TR[7:0]
Figure 14-1. Overview of enCoRe V Clock Sources
User should ensure that the external clock is glitch free. See
device datasheet for the clock specifications.
In applications where XRES is used when in external clock
mode, care must be taken to switch the clock source to IMO
before entering the low-power modes. The clock source can
be switched back to external clock upon completion of wake
up either in the interrupt routine or in the main code. Failure
to do this will cause the device to hang up.
An example implementation is shown here:
OSC_CR2 &= ~0x04; /* Disconnect External
Clock and connect IMO to SYSCLK*/
M8C_Sleep; /* Entering sleep */
asm("nop");
OSC_CR2 |= 0x04; /*Connect External Clock to
SYSCLK */
14.1.3.1Switch Operation
Switching between the IMO and the external clock is done in
firmware at any time and is transparent to the user.
Switch timing depends upon whether the CPU clock divider
is set for divide by 1, or divide by 2 or greater. If the CPU
clock divider is set for divide by 2 or greater, as shown in
Figure 14-2, the setting of the EXTCLKEN bit occurs shortly
after the rising edge of SYSCLK. The SYSCLK output is
then disabled after the next falling edge of SYSCLK, but
before the next rising edge. This ensures a glitch free transition and provides a full cycle of setup time from SYSCLK to
output disable. After the current clock selection is disabled,
the enable of the newly selected clock is double synchronized to that clock. After synchronization, on the subsequent
14.1.3External Clock
In addition to the IMO clock source, an externally supplied
clock may be selected as the device master clock (see
Figure 14-1).
Pin P1[4] is the input pin for the external clock. If P1[4] is
selected as the external clock source, the drive mode of the
pin must be set to High-Z (not High-Z Analog).
An external clock with a frequency between 1 MHz and
24 MHz can be supplied. The reset state of the EXTCLKEN
bit is ‘0’. With this setting, the device always boots up under
the control of the IMO. The system cannot be started from a
reset with the external clock.
When the EXTCLKEN bit is set, the external clock becomes
the source for the internal clock tree, SYSCLK, which drives
most enCoRe V device clocking functions. All external and
internal signals, including the ILO or ECO low frequency
clock, are synchronized to this clock source. Note that there
is no glitch protection in the device for an external clock.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H97
negative edge, SYSCLK is enabled to output the newly
selected clock.
In the 12 MHz case, as shown in Figure 14-3, the assertion
of IOW_ and thus the setting of the EXTCLKEN bit occurs
on the falling edge of SYSCLK. Because SYSCLK is already
low, the output is immediately disabled. Therefore, the setup
time from SYSCLK to disable is one-half SYSCLK.
Digital Clocks
CPUCLK
IMO
Extenal Clock
SYSCLK
IOW_
EXTCLK bit
IMO is
deselected.
External clock is
selected.
CPUCLK
IMO
External Clock
SYSCLK
IOW
EXTCLK
IMO is
deselected.
External clock is
selected.
Figure 14-2. Switch from IMO to the External Clock with a CPU Clock Divider of Two or Greater
Figure 14-3. Switch from IMO to External Clock with the CPU Running with a CPU Clock Divider of One
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H98
Digital Clocks
14.2Register Definitions
The following registers are associated with the Digital Clocks and are listed in address order. Each register description has an
associated register table showing the bit structure for that register. The bits in the tables that are grayed out throughout this
manual are reserved bits and are not detailed in the register descriptions that follow. Always write reserved bits with a value of
‘0’. For a complete table of digital clock registers, refer to the “System Resources Register Summary” on page 93.
The USB Miscellaneous Control Register controls the clocks
to the USB block, to make the IMO work with better accuracy for the USB part and to disable the single-ended input
of the USBIO in the case of a non-USB part.
Bit 2: USB_SE_EN. The single-ended outputs of USBIO is
enabled or disabled based upon this bit setting. Set this bit
to '1' when using this part as a USB part for USB transactions to occur. Set this bit to '0' to disable single-ended outputs of USBIO. The DPO and DMO are held at logic high
state and RSE0 is held at a low state.
Note Bit [1:0] of the USBIO_CR1 register is also affected
depending on this register setting. When this bit is '0'
(default), regardless of the DP and DM state, the DPO and
DMO bits of USBIO_CR1 are '11b'.
Bit 1: USB_ON. This bit is used by the IMO DAC block to
either work with better DNL consuming higher power, or with
sacrificed DNL consuming lower power. Set this bit to '1'
when the part is used as a USB part. A '0' runs the IMO with
sacrificed DNL by consuming less power. A '1' runs the IMO
with better DNL by consuming more power.
Bit 0: USB_CLK_ON. This bit either enables or disables
the clocks to the USB block. It is used to save power in
cases when the device need not respond to USB traffic. Set
this bit to '1' when the device is used as a USB part.
When this bit is a ‘0’, all clocks to the USB block are driven.
The device does not respond to USB traffic and none of the
USB registers, except IMO_TR, IMO_TR1 and
USBIO_CR1, listed in the Register Definitions on page 147
are writable.
When this bit is a ‘1’, clocks are not blocked to the USB
block. The device responds to USB traffic depending on the
other register settings mentioned under Register Definitions
in the Full-Speed USB chapter on page 141.
For additional information, refer to the USB_MISC_CR on
The Output Override to Port 1 Register (OUT_P1) enables
specific internal signals to output to Port 1 pins. If any other
function, such as I2C, is enabled for output on these pins,
that function has higher priority than the OUT_P1 signals.Reserved bits must always be written with a value of
‘0’.
Bit 7: P16D. Bit selects the data output to P1[6] when
P16EN is high.
0 - Select Timer output (TIMEROUT)
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H99
1 - Select CLK32
Bit 6: P16EN. This bit enables pin P1[6] for signal output
selected by the P16D bit.
0 - No internal signal output to P1[6]
1 - Output the signal selected by P16D to P1[6]
Bit 2: P12EN. This bit enables P1[2] to output the main
system clock (SYSCLK).
Digital Clocks
Bit 0: P10ENBit enables pin P1[0] to output the sleep inter-
rupt (SLPINT).
0 - No internal signal output to P1[0]
1 - Output SLPINT to P1[0]
For additional information, refer to the OUT_P1 on page
225.
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H100
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.