Cypress Semiconductor Corporation•3901 North First Street•San Jose, CA 95134•408-943-2600
Document 38-08035 Rev. *ERevised March 29, 2005
Page 2
CY7C63310
CY7C638xx
CY7C639xx
2.0 Introduction
Cypress has reinvented its leadership position in the lowspeed USB market with a new family of innovative microcontrollers. Introducin g enCoRe II USB — “enhanced Component
Reduction.” Cypress has leveraged its design expertise in
USB solutions to advance its family of low-speed USB microcontrollers, which ena ble peripheral de velopers to desi gn new
products with a minimum number of components. The
enCoRe II USB technology builds on to the enCoRe family.
The enCoRe family has an integrated oscilla tor that eliminates
the external crystal or resonator, reducing overall cost. Also
integrated into this chip are other external components
commonly found in low-speed USB applications such as pullup resistors, wake-up circuitry, and a 3.3V regulator.
All of this adds up to a lower system cost.
The enCoRe II is an 8-bit Flash -programmable microc ontroller
with integrated low-speed USB interface. The instruction set
has been optimiz ed spec ifically for USB and PS/2 operations,
although the microcontro llers can be used for a variety of other
embedded applications.
The enCoRe II features up to 36 general-purpose I/O (GPIO)
pins to support USB, PS/2 and other applicatio ns. The I/O pins
are grouped into five port s (Port 0 to 4). The pins on Port 0 and
Port 1 may each be configured individually while the pins on
Ports 2, 3, and 4 may only be configured as a group. Each
GPIO port support s hig h-im pe da nce inp ut s , c onfi gurable pullup, open drain output, CMOS/TTL inputs, and CMOS output
with up to five pins that support programmable drive strength
of up to 50-mA sink current. G PIO Port 1 features four pins t hat
interface at a voltage level of 3.3 volts. Additionally, each I/O
pin can be used to gener ate a GPIO interrup t to the microc ontroller. Each GPIO port has its own GPIO interrupt vector with
the exception of GPIO Port 0 . GPIO Port 0 has three dedicated
pins that have independent interrupt vectors (P0.2 - P0.4).
The enCoRe II features an internal oscillator. With the
presence of USB traffic, the internal oscillator can be set to
precisely tune to USB timing requirements (24 MHz ±1.5%).
Optionally , an external 12-MH z or 24-MHz cry stal can b e used
to provide a higher precisi on reference for USB operation. T he
clock generator provides the 12-MHz and 24-MHz clocks that
remain internal to the microcontroller.
The enCoRe II has up to eight Kbytes of Fla sh for user’s code
and up to 256 bytes of RAM for stack space and user
variables.
In addition, the enCoRe II includes a Watchdog timer, a
vectored interrupt co ntroller , a 16-bit Free-Running T imer , and
Capture T imers. The Power-o n reset circuit detects logic w hen
power is applied to the de vic e, generates resets the logi c to a
known state, and begins executing instructions at Flash
address 0x0000. When power falls below a programmable trip
voltage generates reset or may be configured to generate
interrupt. There is a Low-voltage detect circuit that detects
when V
configurable to generate an LVD interrupt to inform the
processor about the low-voltage event. POR and LVD share
drops below a program mable trip volt age. It may be
CC
the same interrupt. There is no separate interrupt for each. The
Watchdo g timer can be used t o ensure the firmware never gets
stalled in an infinite loop.
The microcontroller supports 23 maskable interrupts in the
vectored interrupt controller. Interrupt sources include a USB
bus reset, LVR/POR, a programmable interval timer, a
1.024-ms output from the Free Running Timer, three USB
endpoints, two capture timers, five GPIO Ports, three GPIO
pins, two SPI, a 16-bit free running timer wrap, an internal
wake-up timer, and a bus active interrupt. The wake-up timer
causes periodic interrupts when enabled. The USB endpoints
interrupt after a USB transaction complete is on the bus. The
capture timers interrupt whenever a new timer value is saved
due to a selected GPIO edge event. A total of eight GPIO
interrupts support both TTL or CMOS thresholds. For
additional flexibility, on the edge sensitive GPIO pins, the
interrupt polarity is programm able to b e either ri sing or f alling.
The free-running 16-bit timer provides two interrupt sources:
the programmable interval timer with 1-µs resolution and the
1.024-ms outputs. The timer can be used to measure the
duration of an event under firmware control by reading the
timer at the start and at the end of an event, then calculating
the difference between the two values. The two 8-bit capture
timers save a programmable 8-bit range of the free-running
timer when a GPIO edge occurs on the two captur e pins (P0.5,
P0.6). The two 8-bit captures can be ganged into a single
16-bit capture.
The enCoRe II includes an integrated USB serial interface
engine (SIE) that allows the chip to easily interface to a USB
host. The hardware supports one USB device address with
three endpoints.
The USB D+ and D– pins can optionally be used as PS/2
SCLK and SDA TA signals so that products can be designed to
respond to either USB or PS/2 modes of operation. PS/2
operation is supported with internal 5-KΩ pull-up resistors on
P1.0 (D+) and P1.1 (D–) and an interrupt to signal the start of
PS/2 activity. In USB mode, the integrated 1.5-KΩ pull-up
resistor on D– can be controlled under firmware. No external
components are necessary for dual USB and PS/2 systems,
and no GPIO pins need to be de dicated to switching between
modes. Slow edge ra tes operate in bot h modes to red uce EMI.
The enCoRe II supports in-system programming by using the
D+ and D– pins as the serial programming mode interface.
The programming protocol is not USB.
3.0 Conventions
In this document, bit positions in the registers are shaded to
indicate which me mbers of the enCoRe II family implement t he
bits.
Available in all enCoRe II family members
CY7C639xx and CY7C638xx only
CY7C639xx only
343018134P3.0GPIO Port 3 – configured as a group
35312019235P3.1
36321936P3.2
373337P3.3
38342438P3.4
39352539P3.5
40362640P3.6
41372741P3.7
151111111815P2.0GPIO Port 2 – configured as a group
141010101714P2.1
13913P2.2
12812P2.3
117511P2.4
106410P2.5
9539P2.6
8428P2.7
28
24
24
QSOP
SOIC24PDIP18SIOC18PDIP16SOIC16PDIP
Die
Pad
NameDescription
(nibble)
(byte)
(byte)
Document 38-08035 Rev. *EPage 5 of 68
Page 6
CY7C63310
CY7C638xx
CY7C639xx
Table 5-1. Pin Assignments (continued)
48
SSOP
40
PDIP
SSOP
252115141320101591325P1.0/D+GPIO Port 1 bit 0 / USB D+
2622161514211116101426P1.1/D–GPIO Port 1 bit 1 / USB D–
2824181716231318121628P1.2/VREGGPIO Port 1 bit 2—C onfigured individually .
29251918172414113129P1.3/SSELGPIO Port 1 bit 3—Configured individually .
3026202120315214230P1.4/SCLKGPIO Po rt 1 bit 4—Configured individually .
3127212221416315331P1.5/SMOSIGPIO P ort 1 bi t 5—Configured individually.
3228222322517416432P1.6/SMISOGPIO P ort 1 bi t 6—Configured individually.
3329232423618533P1.7GPIO Po rt 1 bit 7—Configured individually .
28
24
24
QSOP
SOIC24PDIP18SIOC18PDIP16SOIC16PDIP
Die
Pad
NameDescription
[1]
[1]
3.3V if regulator is enabled. (The 3.3V
regulator is not available in the
CY7C63310 and CY7C63801.)
Alternate function is SSEL signal of the
SPI bus TTL voltage thresholds
Alternate function is SCLK signal of the
SPI bus TTL voltage thresholds
Alternate function is SMOSI signal of the
SPI bus TTL voltage thresholds
Alternate function is SMISO signal of the
SPI bus TTL voltage thresholds
TTL voltage threshold.
231913991681371123P0.0/CLKINGPIO Por t 0 bit 0—Configured individually .
On CY7C639xx, optional Clock In when
external crystal oscillator is disabled or
crystal input when external crystal oscillator is enabled.
On CY7C638xx and CY7C63310, oscillator input when configured as Clock In
221812881571261022P0.1 /
CLKOUT
GPIO Port 0 bit 1—Configured individually
On CY7C639xx, optional clock out when
external crystal oscillator is disabled or
crystal output drive when externa l cryst al
oscillator is enabled .
On CY7C638xx and CY7C63310, oscillator output when confi gured as Clock out.
21171177146115921P0.2/INT0GPIO port 0 bit 2—Configured individually
Optional rising edge interrupt INT0
20161066135104820P0.3/INT1GPIO port 0 bit 3—Configured individually
Optional rising edge interrupt INT1
191595512493719P0.4/INT2GPIO port 0 bit 4—Configured individually
Optional rising edge interrupt INT2
18148441 1382618P0.5/TIO0GPIO port 0 bit 5—Configured individually
Alternate function T imer capture input s or
Timer output TIO 0
171373310271517P0.6/TIO1GPIO port 0 bit 6—Configured individually
Alternate function T imer capture input s or
Timer output TIO 1
161262291616P0.7GPIO port 0 bit 7—Configured individually
Not in 16 pin PDIP or SOIC package
1,2,3,
4
Note:
1. P1.0(D+) and P1.1(D-) pins should be in I/O mode when used as GPIO and in I
This family of m icrocontrollers i s based on a high performance,
8-bit, Harvard-architecture microprocessor. Five registers
control the primary operati on of the CPU core. These regi sters
are affected by var ious instructi ons, but are not direct ly accessible through the register space by the us er.
Table 6-1. CPU Registers and Register Names
RegisterRegister Name
FlagsCPU_F
Program Counter CPU_PC
AccumulatorCPU_A
Stack PointerCPU_SP
IndexCPU_X
The 16-bit Program Counter Register (CPU_PC) allows for
direct addressing of the full eight Kbytes of program memory
space.
The Accumulator Register (CPU_A) is the general-purpose
register that holds the results of instructions that specify any
of the source addressing modes.
The Index Register (C PU_X) holds an o ffset va lue that is us ed
in the indexed address ing modes. Typically, this is used to
address a block of data within the data memory space.
The St ack Pointer Regi ster (CPU_SP) holds th e address of the
current top-of-sta ck in the data memo ry space. It is af fected by
the PUSH, POP, LCALL, CALL, RETI, and RET instructions,
which manage the software stack. It can also be affected by
the SWAP and ADD instructions.
The Flag Register (CPU _F) has three st atus bit s: Zero Flag bit
[1]; Carry Flag bit [2]; Supervisory State bit [3]. The Global
Interrupt Enable bit [0] is used to globally enable or disable
interrupts. The user cannot manipulate the Supervisory State
status bit [3]. The flags are affected by arithmetic, logic, and
shift operations. The manner in which each flag is changed is
dependent upon the instruction being executed (i.e., AND,
OR, XOR). See Table 8-1.
Document 38-08035 Rev. *EPage 7 of 68
Page 8
CY7C63310
CY7C638xx
CY7C639xx
7.0 CPU Registers
7.1Flags Register
The Flags Register can only be set or reset with logical
instruction.
Table 7-1. CPU Flags Register (CPU_F) [R/W]
Bit #76543210
FieldReservedXIOSuperCarryZeroGlobal IE
Read/Write–––R/WRRWRWRW
Default00000010
Bit [7:5]: Reserved
Bit 4: XIO
Set by the user to select between the register banks
0 = Bank 0
1 = Bank 1
Bit 3: Super
Indicates whether the CPU is executing user code or Supervisor Code. (This code cannot be accessed directly by the user)
0 = User Code
1 = Supervisor Code
Bit 2: Carry
Set by CPU to indicate whether there has been a carry in the previous logical/arithmetic operation
0 = No Carry
1 = Carry
Bit 1: Zero
Set by CPU to indicate whether there has been a zero result in the previous logical/arithmetic operation
0 = Not Equal to Zero
1 = Equal to Zero
Bit 0: Global IE
Determines whether all interrupts are enabled or disabled
0 = Disabled
1 = Enabled
Note: CPU_F register is only readable with explicit register address 0xF7. The OR F, expr and AND F, expr instructions must
be used to set and clear the CPU_F bits
7.1.1Accumulator Register
Table 7-2. CPU Accumulator Register (CPU_A)
Bit #76543210
FieldCPU Accumulator [7:0]
Read/Write––––––––
Default00000000
Bit [7:0]: CPU Accumulator [7:0]
8-bit data value holds the result of any logical/arithmetic instruction that uses a source addressing mode
7.1.2Index Register
Table 7-3. CPU X Register (CPU_X)
Bit #76543210
FieldX [7:0]
Read/Write––––––––
Default00000000
Bit [7:0]: X [7:0]
8-bit data value holds an index for any instruction that uses an indexed addressing mode
Document 38-08035 Rev. *EPage 8 of 68
Page 9
CY7C63310
CY7C638xx
CY7C639xx
7.1.3Stack Pointer Register
Table 7-4. CPU Stack Pointer Register (CPU_SP)
Bit #76543210
FieldStack Pointer [7:0]
Read/Write––––––––
Default00000000
Bit [7:0]: Stack Pointer [7:0]
8-bit data value holds a pointer to the current top-of-stack
7.1.4CPU Program Counter High Regi ster
Table 7-5. CPU Program Counter High Register (CPU_PCH)
Bit #76543210
FieldProgram Counter [15:8]
Read/Write––––––––
Default00000000
Bit [7:0]: Program Counter [15:8]
8-bit data value holds the higher byte of the program counter
7.1.5CPU Program Counter Low Register
Table 7-6. CPU Program Counter Low Register (CPU_PCL)
Bit #76543210
FieldProgram Counter [7:0]
Read/Write––––––––
Default00000000
Bit [7:0]: Program Counter [7:0]
8-bit data value holds the lower byte of the program counter
7.2Addressing Modes
7.2.1Source Immediate
The result of an instruction using this addressing mode is
placed in the A register, the F register, the SP register, or the
X register , which is spec ified as p art of the instructi on opcode.
Operand 1 is an immediate value that serves as a source for
the instruction. Arithmetic instructions require two sources.
Instructions using this addressing mode are two bytes in
length.
Table 7-7. Source Immediate
OpcodeOperand 1
InstructionImmediate Value
Examples
ADDA,7;In this case, the immediate value
;of 7 is added with the Accumulator,
;and the result is placed in the
;Accumulator.
MOVX,8;In this case, the immediate value
;of 8 is moved to the X register.
ANDF,9;In this case, the immediate value
;of 9 is logically ANDed with the F
;register and the result is placed
;in the F register.
7.2.2Source Direct
The result of an instruction using this addressing mode is
placed in either the A register or the X register, which is
specified as part of the instruction opcode. Operand 1 is an
address that points to a location in either the RAM memory
space or the register space that is the source for the
instruction. Arithmetic instructions require two sources; the
second source is the A register or X register specified in the
opcode. Instructions using this addressing mode are two bytes
in length.
Document 38-08035 Rev. *EPage 9 of 68
Page 10
CY7C63310
CY7C638xx
CY7C639xx
Table 7-8. Source Direct
OpcodeOperand 1
Instructio nSource Address
Examples
ADDA,[7];In this case, the ;value in
;the RAM memory location at
;address 7 is added with the
;Accumulator, and the result
;is placed in the Accumulator.
MOVX,REG[8];In this case, the value in
;the register space at address
;8 is moved to the X register.
7.2.3Source Indexed
The result of an instruction using this addressing mode is
placed in either the A register or the X register, which is
specified as part of the instruction opc ode. Operand 1 is added
to the X register forming an addres s that point s to a loc ation in
either the RAM memory spac e or the re gister sp ace th at is the
source for the instruction. Arithmetic instructions require two
sources; the second source is the A register or X register
specified in the opcode. Instructions using this addressing
mode are two bytes in length.
Table 7-9. Source Indexed
OpcodeOperand 1
InstructionSource Index
Examples
ADDA,[X+7];In this case, the value in
;the memory location at
;address X + 7 is added with
;the Accumulator, and the
;result is placed in the
;Accumulator.
MOVX,REG[X+8];In this case, the value in
;the register space at
;address X + 8 is moved to
;the X register.
7.2.4Destination Direct
The result of an instruction using this addressing mode is
placed within either the RAM memory space or the register
space. Operand 1 is an address that points to the location of
the result. The so urce for the inst ruction is either the A re gister
or the X register, which is specified as part of the instruction
opcode. Arithmetic instructions require two sources; the
second source is t he locatio n specifie d by Operan d 1. Instru ctions using this addressing mode are two bytes in length.
Examples
ADD[7],A;In this case, the value in
;the memory location at
;address 7 is added with the
;Accumulator, and the result
;is placed in the memory
;location at address 7. The
;Accumulator is unchanged.
MOVREG[8], A;In this case, the Accumula-
;tor is moved to the regis;ter space location at
;address 8. The Accumulator
;is unchanged.
7.2.5Destination Indexed
The result of an instruction using this addressing mode is
placed within either the RAM memory space or the register
space. Operand 1 is added to the X register forming the
address that point s to the location o f the result . The source for
the instruction is the A regi ste r. Arithmetic instructions require
two sources ; the second s ource is the lo cation specifi ed by
Operand 1 added with the X register. Instructions using this
addressing mode are two bytes in length.
Table 7-11. Destination Indexed
OpcodeOperand 1
InstructionDestination Index
Example
ADD[X+7],A;In this case, the value in the
;memory location at address X+7
;is added with the Accumulator,
;and the result is placed in
;the memory location at address
;x+7. The Accumulator is
;unchanged.
7.2.6Destination Direct Immediate
The result of an instruction using this addressing mode is
placed within either the RAM memory space or the register
space. Operand 1 is th e ad d res s of th e re su lt. Th e sou rce fo r
the instruction is Operand 2, which is an immediate value.
Arithmetic instructi ons require two s ources; the second source
is the location specified by Operand 1. Instructions using this
addressing mode are three bytes in length.
Table 7-12. Destination Direct Immediate
OpcodeOperand 1Operand 2
InstructionDestination AddressImmediate Value
Table 7-10. Destination Direct
OpcodeOperand 1
InstructionDestination Address
Document 38-08035 Rev. *EPage 10 of 68
Page 11
CY7C63310
CY7C638xx
CY7C639xx
Examples
ADD[7],5;In this case, value in the mem-
;ory location at address 7 is
;added to the immediate value of
;5, and the result is placed in
;the memory location at address 7.
MOVREG[8], 6;In this case, the immediate
;value of 6 is moved into the
;register space location at
;address 8.
7.2.7Destination Indexed Immediate
The result of an instruction using this addressing mode is
placed within either the RAM memory space or the register
space. Operand 1 is added to the X register to form the
address of the result. The sou rce for the ins truction is Opera nd
2, which is an imm ediate va lue. Arithm etic inst ructions r equire
two sources; the second source is the location specified by
Operand 1 added with the X register. Instructions using this
addressing mode are three bytes in length.
Table 7-13. Destination Indexed Immediate
OpcodeOperand 1Operand 2
InstructionDestination IndexImmediate Value
Examples
ADD[X+7],5;In this case, the value in
;the memory location at
;address X+7 is added with
;the immediate value of 5,
;and the result is placed
;in the memory location at
;address X+7.
MOVREG[X+8],6;In this case, the immedi-
;ate value of 6 is moved
;into the location in the
;register space at
;address X+8.
7.2.8Destination Direct
The result of an instruction using this addressing mode is
placed within the RAM memory. Operand 1 is the address of
the result. Oper and 2 is an ad dres s tha t points to a loc ati on in
the RAM memory that is the source for the instruction. This
addressing mode is only valid on the MOV instruction. The
instruction us ing this a ddressing mode is t hree bytes in length.
Table 7-14. Destination Direct
OpcodeOperand 1Operand 2
InstructionDestination AddressSource Address
Example
MOV[7], [8] ;In this case, the value in the
;memory location at address 8 is
;moved to the memory location at
;address 7.
7.2.9Source Indirect Post Increment
The result of an instruction using this addressing mode is
placed in the Accumulator. Operand 1 is an address pointing
to a location within the memory space, which contains an
address (the indi rect address) for the source of the instruc tion.
The indirect address is incremented as part of the instruction
execution. This addressing mode is only valid on the MVI
instruction. The instruction using this addressing mode is two
bytes in length. Refer to the PSoC Designer: AssemblyLanguage User Guide for further details on MVI instruction.
Table 7-15. Source Indirect Post Increment
OpcodeOperand 1
InstructionSource Address Address
Example
MVIA,[8];In this case, the value in the
;memory location at address 8 is
;an indirect address. The memory
;location pointed to by the indi;rect address is moved into the
;Accumulator. The indirect
;address is then incremented.
7.2.10Destination Indirect Post Increment
The result of an instruction using this addressing mode is
placed within the memory space. Operand 1 is an address
pointing to a locati on within the memory space, which c ontains
an address (the indirect address) for the destination of the
instruction. The indirect address is incremented as part of the
instruction execution. The source for the instruction is the
Accumulator. This addressing mode is only valid on the MVI
instruction. The instruction using this addressing mode is two
bytes in length.
Table 7-16. Destination Indirect Post Increment
OpcodeOperand 1
InstructionDestination Address Address
Example
MVI[8],A;In this case, the value in
;the memory location at
;address 8 is an indirect
;address. The Accumulator is
;moved into the memory loca;tion pointed to by the indi;rect address. The indirect
;address is then incremented.
Document 38-08035 Rev. *EP age 11 of 68
Page 12
CY7C63310
CY7C638xx
CY7C639xx
8.0 Instruction Set Summary
The instruction set is summarized in Table8-1 by numerically
and serves as a quick reference. If more information is
Table 8-1. Instruction Set Summary Sorted Numerically by Opcode Order
Opcode Hex
00 151 SSC2D82 OR [X+expr], AZ5A52 MOV [expr], X
01 42 ADD A, exprC, Z2E93 OR [expr], exprZ5B41 MOV A, XZ
02 62 ADD A, [expr]C, Z2F 103 OR [X+expr], exprZ5C41 MOV X, A
03 72 ADD A, [X+expr]C, Z30 91 HALT5D62 MOV A, reg[expr]Z
04 72 ADD [exp r], AC, Z3142 XOR A, exprZ5E72 MOV A, reg[X+expr]Z
05 82 ADD [X +expr ], AC, Z3262 XOR A, [expr]Z5F 103 MOV [expr], [expr]
06 93 ADD [exp r], exprC, Z3372 XOR A, [X+expr]Z6052 MOV reg[expr], A
07 103 ADD [X+expr ], exprC, Z3472 XOR [expr], AZ6162 MOV reg[X+expr], A
08 41 PUSH A3582 XOR [X+expr], AZ6283 MOV reg[expr], expr
09 42 ADC A, exprC, Z3693 XOR [expr], exprZ6393 MOV reg[X+expr], expr
0A 62 ADC A, [expr]C, Z37 103 XOR [X+expr], exprZ64 41 ASL AC, Z
0B 72 ADC A, [X+expr]C, Z38 52 ADD SP, expr65 72 ASL [expr]C, Z
0C 72 ADC [expr], AC, Z39 52 CMP A, expr
0D 82 ADC [X+expr], AC, Z3A 72 CMP A, [expr]67 41 ASR AC, Z
0E 93 ADC [expr], exprC, Z3B 82 CMP A, [X+expr]68 72 ASR [expr]C, Z
0F 103 ADC [X+expr], exprC, Z3C 83 CMP [expr], expr69 82 ASR [X+expr]C, Z
29 42 OR A, exprZ5693 MOV [X+expr], exprBx52 JNZ
2A 62 OR A, [expr]Z5742 MOV X, exprCx 52 JC
2B 72 OR A, [X+expr]Z5862 MOV X, [expr]Dx52 JNC
2C 72 OR [expr], AZ5972 MOV X, [X+expr]Ex72 JACC
Notes:
2. Interrupt routines take 13 cycles before execution resumes at interrupt vector table.
3. The number of cycles required by an instruction is increased by one for instructions that span 256-byte boundaries in the Flash memory space.
Instruction FormatFlags
Cycles
Bytes
Opcode Hex
Instruction FormatFlags
Cycles
Bytes
needed, the Instruction Set Summary tables are described in
detail in the PSoC Designer Assembly Language User Guide
(available on the www.cypress.com web site).
[2, 3]
Opcode Hex
66 82 ASL [X+expr]C, Z
if (A=B) Z=1
if (A<B) C=1
Fx 132 INDEXZ
Instruction FormatFlags
Cycles
Bytes
Document 38-08035 Rev. *EPage 12 of 68
Page 13
9.0 Memory Organization
9.1Flash Program Memory Organization
after resetAddress
16-bit PC0x0000Program execution begins here after a reset
0x0004POR/LVD
0x0008INT0
0x000CSPI Transmitter Empty
0x0010SPI Receiver Full
0x0014GPIO Port 0
0x0018GPIO Port 1
0x001CINT1
0x0020EP0
0x0024EP1
0x0028EP2
0x002CUSB Reset
0x0030USB Active
0x00341 ms Interval timer
0x0038Programmable Interval Timer
0x003CTimer Capture 0
0x0040Timer Capture 1
0x004416 Bit Free Running Timer Wrap
0x0048INT2
0x004CPS2 Data Low
0x0050GPIO Port 2
0x0054GPIO Port 3
0x0058GPIO Port 4
0x005CReserved
0x0060Reserved
0x0064Sleep Timer
0x0068Program Memory begins here (if below interrupt s not used,
CY7C63310
CY7C638xx
CY7C639xx
program memory can start lower)
0x0BFF3-KB ends here (CY7C63310)
0x0FFF4-KB ends here (CY7C63801)
0x1FFF8-KB ends here (CY7C639xx and CY7C638x3)
Figure 9-1. Program Memory Space with Interrupt Vector Table
Document 38-08035 Rev. *EPage 13 of 68
Page 14
9.2Data Memory Organization
The CY7C633xx/638xx/639xx microcontrollers provide up to
256 bytes o f data R AM. In norma l usag e, t he SRAM is part itioned into two areas: stack, and user variables:
after resetAddress
8-bit PSP0x00Stack begins here and grows upward (user can modify)
Top of RAM Memory0xFF
Figure 9-2. Data Memory Organization
CY7C63310
CY7C638xx
CY7C639xx
The user determines the amount of memory needed for Stack
User Variables
9.3Flash
This section des cribes the F lash blo ck of the enCoRe II. Much
of the user-visible Flash functionality including programming
and security ar e implemente d in the M8C Supervi sory Read
Only Memory (SRO M ).
9.3.1Flash Programming and Security
All Flash programming is performed by code in the SROM. The
registers that control the Flash programming are only visible
to the M8C CPU w hen it is executing out of SROM. This m akes
it impossible to read, write or erase th e Flash by bypass ing the
security mec hanisms implemented in the S ROM.
Customer firmware can only program the Flash via SROM
calls. The data or code images can be sourced via any
interface with the appropriate support firmware. This type of
programming requires a ‘boot-loader’—a piece of firmware
resident on the Flash. For safety reasons this boot-loader
should not be overwritten during firmware rewrites.
The Flash provides four extra auxiliary rows that are used to
hold Flash block pro tec tion fl ags, b oot time c alibrat ion value s,
configurati on tables, an d any devic e values. The routin es for
accessing these auxiliary rows are documented in the SROM
section. The auxiliary rows are not affected by the device
erase function.
9.3.2In-System Programming
Most designs that include an enCoRe II part will have a USB
connector attached to the USB D+/D– pins on the device.
These designs require the ability to program or reprogram a
part through these two pins alone. The programming protocol
is not USB.
enCoRe II devi ces enabl e t his t ype o f in-s ystem prog ramming
by using the D+ and D – pins as the serial prog ramming mo de
interface. This allows an external controller to cause the
enCoRe II part to enter serial programming mode and then to
use the test queue to issue Flash access functions in the
SROM.
9.4SROM
The SROM holds code that is used to boot the part, calibrate
circuitry, and perform Flash operations. (Table 9-1 lists the
SROM functions.) The functions of the SROM may be
accessed in normal user code or operating from Flash. The
SROM exists in a separat e memory space from user code.
The SROM fun ctions ar e accessed b y executin g the Super visory System Call instruction (SSC), which has an opc od e of
00h. Prior to executing t he SSC the M8C’s accumulator needs
to be loaded with the desired SROM function code from
Table 9-1. Undefined functions wi ll cause a HA L T if called from
user code. The SROM functions are executing 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 must be configured before
executing the SSC. Table 9-2 lists all possible pa rameter block
variables. The meaning of each parameter, with regards to a
specific SROM function, is described later in this chapter.
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, whil e KEY2 m ust hav e the same
value as the stack pointer when the SROM function begins
execution. This would be the Stack Pointer value when the
SSC opcode is executed, plus three. If either of the keys do
not match the expected values, the M8C will halt (with the
exception of the SWBootReset function). The following code
puts the correct value in KEY1 an d KEY2. The code starts with
a halt, to forc e the program to jump directly into the setup code
and not run into it.
halt
SSCOP: mov [KEY1], 3ah
mov X, SP
mov A, X
add A, 3
mov [KEY2], A
Return codes 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 9-3. SROM Return Codes
Return CodeDescription
00hSuccess
01hFunction not allowed due to level of protec tion
on block.
02hSoftware reset without hardware reset.
03hFatal error, SROM halted.
Read, write, and erase operations may fail if the target block
is read or write protected. Block protection levels are set
during device programmin g.
The EraseAll functio n overwrites dat a in addition t o leaving the
entire user Flash in the erase state. The EraseAll function
loops through the number of Flash macros in the product,
executing the following sequence: erase, bulk program all
zeros, erase. After all the user space in all the Flash macros
are erased, a second loop erases and then programs each
protection block with zeros.
9.5SROM Function Descriptions
9.5.1SWBootReset Function
The SROM function, SWBootReset, is the function that is
responsible for transitioning the device from a reset state to
running user code. The SWBootReset function is executed
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 will happen, 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 00 h. Th e SWBo otR e se t fun cti on wi ll n ot
execute when the SSC instruction i s executed with a bad key
value and a non-zero function code. An enCoRe II device will
execute the HALT instruction if a bad value is given for either
KEY1 or KEY2.
The SWBootReset function verifies the integrity of the
calibration data by way of a 16-bit checksum, before releasing
the M8C to run user code.
9.5.2ReadBlock Function
The ReadBlock function is used to read 64 contiguous bytes
from Flash: a block.
The first thing this fu nction does is to check th e prot ectio n bit s
and determine if the desired BLOCKID is readable. If read
protection is turned on, the ReadBlock function wil l exit setting
the accumulator and KEY2 back to 00h. KEY1 will have a
value of 01h, indicating a read failure. If read protection is not
enabled, the function will read 64 bytes from the Flash using
a ROMX instruction and store the results in SRAM using an
MVI instruction. The first of the 64 bytes will be s tored in SRAM
at the address indicated by the value of the POINTER
parameter. When the ReadBlock completes successfully the
accumulator, KEY1 and KEY2 will all have a value of 00h.
Table 9-4. ReadBlock Parameters
NameAddressDescription
KEY10,F8h3Ah
KEY20,F9hStack Pointer value, when SSC is
executed.
BLOCKID0,FAhFlash block number
POINTER0,FBhFirst of 64 addresses in SRAM
where returned data should be
stored
9.5.3WriteBlock Function
The WriteBlock function is used to store data in th e Flash. Data
is moved 64 bytes at a time from SRAM to Flash using this
function. The first thing the WriteBlock function does is to
check the protection bits and determine if the desired
BLOCKID is writable. If w rite protection is turned on, the WriteBlock function will exi t setting the acc umulator and KEY2 b ack
to 00h. KEY1 will have a value of 01h, indicating a write fa ilure.
The configuration of the WriteBlock function is straightforward.
The BLOCKID of the Flash block, where the data is stored,
must be determined and stored at SRAM address FAh.
Document 38-08035 Rev. *EPage 15 of 68
Page 16
CY7C63310
CY7C638xx
CY7C639xx
The SRAM address of the first of the 64 bytes to be stored in
Flash must be in dicated using th e POINTER variabl e in the
parameter block (SRAM address FBh). Finally, the CLOCK
and DELAY value must be set correctly. The CLOCK value
determines the length of the write pulse that will be used to
store the data in th e Flash. The CLOCK and DELA Y val ues are
dependent on the CP U speed and m ust be set co rrectly . Refer
to “Clocking” Section for additional information.
Table 9-5. WriteBlock Parameters
NameAddressDescription
KEY10,F8h3Ah
KEY20,F9hStack Pointer value, when SSC is
executed.
BLOCKID0,FAh8KB Flash block number (00h–7Fh)
4KB Flash block number (00h–3Fh)
3KB Flash block number (00h–2Fh)
POINTER0,FBhFirst of 64 addresses in SRAM, where
the data to be stored in Flash is
located prior to calling WriteBlock.
CLOCK0,FChClock divider used to set the write
pulse width.
DELAY0,FEhFor a CPU speed of 12 MHz set to 56h
9.5.4EraseBlock Function
The EraseBlock function is used to erase a block of 64
contiguous bytes in Flash. The first thing the EraseBlock
function does is to check the protection bits and determine if
the desired BLOCKID is writable. If write protection is turned
on, the EraseBlock function will exit setting the accumulator
and KEY2 back to 00h. KEY1 will have a value of 01h,
indicating a write failure. The EraseBlock function is only
useful as the first step in programming. Erasing a block will not
cause data in a block to be one hundred percent unreadable.
If the objectiv e is to obl iterate dat a in a b lock, th e b est meth od
is to perform an EraseBlock followed by a WriteBlock of all
zeros.
To set up the parameter block for the EraseBlock function,
correct key values must be stored in KEY1 and KEY2. The
block number to be erased must be stored in the BLOCKID
variable and the CLOCK and DELA Y val ues must be set based
on the current CPU speed.
Table 9-6. EraseBlock Parameters
NameAddressDescription
KEY10,F8h3Ah
KEY20,F9hStack Pointer value, when SSC is
executed.
BLOCKID0,FAhFlash block number (00h–7Fh)
CLOCK0,FChClock divider used to set the erase
pulse width.
DELAY0,FEhFor a CPU speed of 12 MHz set to
56h
9.5.5ProtectBlock Function
The enCoRe II devices offer Flash protection on a block-byblock basis. Table 9-7 lists the protection modes available. In
the table, ER and EW are used to indicate the abi lity to perform
external reads and writes. For internal writes, IW is used.
Internal reading is always permitted by way of the ROMX
instruction. The ability to read by way of the SROM ReadBl ock
function is indicated by SR. The protection level is stored in
two bits accor din g to Table 9-7. These bits are bit packed into
the 64 bytes o f the protection b lock. Therefore, ea ch protection
block byte stores the protection level for four Flash blocks . The
bits are packed into a byte, with the lowest numbered block’s
protection level stored in the lowest numbered bits Table 9-7.
The first address of the protection block contains the
protection level for blocks 0 through 3; the second address is
for blocks 4 through 7. The 64th byte will store the protection
level for blocks 252 through 255.
Table 9-7. Protection Modes
ModeSettingsDescriptionMarketing
00bSR ER EW IW UnprotectedUnprotected
01bSR
10bSR
11bSR
76543210
Block n+3Block n+2Block n+1Block n
The level of pro tection is on ly decreased by an EraseAll, whic h
places zeros in all loc at ions of the protection block . To set the
level of protection, the ProtectBlock function is used. This
function takes data from SRAM, starting at address 80h, and
ORs it with the current values in the protection block. The
result of the OR operation is then stored in the protection
block. The EraseBlock function does not change the
protection level for a block. Because the SRAM location for the
protection data is fixed and there is only one protection block
per Flash macro, the ProtectBlock function expects very few
variables in the parameter block to be set prior to calling the
function. The p arameter block v alues that must be set, besides
the keys, are the CLOCK and DELAY values.
Table 9-8. ProtectBlock Parameters
NameAddressDescription
KEY10,F8h3Ah
KEY20,F9hStack Pointer value when SSC is
CLOCK0,FChClock divider used to set the write
DELA Y0,FEhFor a CPU speed of 12 MHz set to 56h
9.5.6EraseAll Function
The EraseAl l fu nct ion perf orm s a se ries of s teps t hat d est roy
the user data in the Flash macros and resets the protection
block in each Fl ash m acro to all zeros (the unprote cted s ta te).
The EraseAll function does not affect the three hidden blocks
above the protection block, in each Flash macro. The first of
these four hidden blocks is used to store the protection table
for its eight Kbytes of user data.
The EraseAll function begin s by eras ing the us er sp ace of the
Flash macro with the highest address range. A bulk program
of all zeros i s then performed on the same Flas h macro, to
ER EW IW Re ad protectFactory upgrade
ER EW IW Disable external
write
ER EW IW Disable internal
write
executed.
pulse width.
Field upgrade
Full protection
Document 38-08035 Rev. *EPage 16 of 68
Page 17
CY7C63310
CY7C638xx
CY7C639xx
destroy all traces of the previous contents. The bulk program
is followed b y a se cond eras e th at l eave s th e Flas h mac ro i n
a state ready f or writing . The erase , program, e rase sequ ence
is then performed on the next lowest Flash macro in the
address space if it exists. Following the erase of the user
space, the protection block for the Flash macro with the
highest address range is erased. Following the erase of the
protection block, zeros are written into every bit of the
protection table. The next lowest Flash macro in the address
space then has its protection block erased and filled with
zeros.
The end result of the EraseAll function is that all user data in
the Flash is destroyed and the Flash is left in an unprogrammed state, ready to accept one of the various write
commands. The prote cti on bits for all user dat a a re a ls o res et
to the zero state
The parameter block values that must be set, besides the
keys, are the CLOCK and DELAY values.
Table 9-9. EraseAll Parameters
NameAddressDescription
KEY10,F8h3Ah
KEY20,F9hStack Pointer value when SSC is
executed.
CLOCK 0,FChClock divider used to set the write puls e
width.
DELAY0,FEhFor a CPU speed of 12 MHz set to 56h
9.5.7TableRead Function
The TableRead function gives the user ac cess to p a rt-spec ific
data stored in the Flash during manufacturing. It also returns
a Revision ID for the die (not to be confused with the Silicon
ID).
Table 9-10. Table Read Parameters
NameAddressDescription
KEY10,F8h3Ah
KEY20,F9hStack Pointer value when SSC is
executed.
BLOCKID 0,FAhTable number to read.
The table space for the enCoRe II is simply a 64-byte row
broken up into eight tables of eight bytes. The tables are
numbered zero through seven. All user and hidden blocks in
the CY7C638xx and CY7C639xx parts consist of 64 bytes.
An internal table holds the Sili co n ID a nd r eturns the Revision
ID. The Silicon ID is returned in SRAM, while the Revision ID
is returned in the CPU_A and CP U_X registers. The Si licon ID
is a value placed in the t able by programming the Flash and is
controlled by Cypress Semiconductor Product Engineering.
The Revision ID is hard coded into the SROM. The Revision
ID is discussed in more detail later in this section.
An internal table holds alternate trim values for the device and
returns a one-byte internal revision counter. The internal
revision counter starts out with a value of zero and is incremented each time one of the other revision numbers is not
incremented. It is reset to zero each time one of the other
revision numbers is incremented. The internal revision count
is returned in the CPU_A register. The CPU_X register will
always be set to FFh when trim values are read. The BLOCKID
value, in the parameter block, is used to indicate which table
should be returned to the user. Only the three least significant
bits of the BLOCKID parameter are used by TableRead
function for the CY7C638xx and CY7C639xx. The upper five
bits are ignored . When th e func tion is calle d, it tran sfers b ytes
from the table to SRAM addresses F8h–FFh.
The M8C’s A and X registers are used by the TableRead
function to return the die’s Revision ID. The Revi sion ID is a
16-bit value hard coded in to the SROM that uniq uely identifie s
the die’s design.
9.5.8Checksum F unction
The Checksum function calculates a 16-bit checksum over a
user specifiable number of blocks, w ithin a single Fla sh macro
(Bank) starti ng from bloc k zero. The BL OCKID paramet er is
used to pass in the number of blocks to calculate the
checksum over. A BLOCKID value of 1 will calculate the
checksum of only block 0, while a BLOCKID value of 0 will
calculate the checksum of all 256 user blocks. The 16-bit
checksum is returned in KEY1 and KEY2. The parameter
KEY1 holds the lower eight bits of the checksum and the
parameter KEY2 holds the upper eight bits of the checksum.
The checksum algorithm executes the following sequence of
three instructions over the number of blocks times 64 to be
checksummed.
romx
add [KEY1], A
adc [KEY2], 0
Table 9-11. Checksum Parameters
NameAddressDescription
KEY10,F8h3Ah
KEY20,F9hStack Pointer value when SSC is
executed.
BLOCKID0,FAhNumber of Fl ash blocks to calculate
checksum on.
10.0 Clocking
The enCoRe II internal oscillator outputs two frequencies, the
Internal 24-MHz Oscillator and the 32-KHz Low-power Oscillator.
The Internal 24-MH z Oscillato r is designe d such that it may be
trimmed to an output frequency of 24 MHz over temperature
and voltage variation. With the presence of USB traffic, the
Internal 24-MHz O scillator c an be se t to preci sely tune t o USB
timing requirement s (24 MHz ± 1.5%). Withou t USB traffic, the
Internal 24-MHz Oscillator a ccuracy is 24 MHz ± 5% (between
0°–70°C). No external components are required to achieve
this level of accuracy.
The internal low- speed oscilla tor of nominally 32 KHz provides
a slow clock sourc e for the enCoRe II i n suspend mode, p articularly to generate a periodic wake-up interrupt and also to
provide a clock to s equential logic duri ng power-up and powerdown events when the main clock is stopped. In addition, this
oscillator can also be used as a clocking source for the Interval
Timer clo ck (ITMRCLK) and Capt ure Timer clock (TCAPCLK).
The 32-KHz Low-power Oscillator can operate in low-power
mode or can provide a more accurate clock in normal mode.
Document 38-08035 Rev. *EPage 17 of 68
Page 18
CY7C63310
CY7C638xx
CY7C639xx
The Internal 32-KHz Low-power Oscillator accuracy ranges
from –85% to +120% (between 0°–70° C).
For applications that require a higher clock accuracy, the
CY7C639xx part can optionally be sourced from an external
crystal oscillator. When operating in USB mode, the supplied
crystal oscillator must be either 12 MHz or 24 MHz in order for
the USB blocks to function properly. In non-USB mode, the
external oscillator can be up to 24 MHz.
10.1Clock Architecture Description
The enCoRe II clock selection circuitry allows the selection of
independent clocks for the CPU, USB, Interval Timers and
Capture Timers.
On the CY7C639xx, the external oscillator can be sourced by
the crystal o scillato r or when t he cryst al osc illator is disabled it
is sourced directly from the CLKIN pin. The external crystal
oscillator is fed through the EFTB block, which can optionally
be bypassed.
The CPU clock, CPUCLK, can be sourced from the external
crystal oscillator or the Internal 24-MHz Oscillator. The
selected clock sou rce can op tional ly be div ided by 2
is 0-5,7 (see Table 10-5).
USBCLK, which must be 12 MHz for the USB SIE to function
properly, can be sourced by the Internal 24-MHz Oscillator or
Table 10-1. IOSC Trim (IOSCTR) [0x34] [R/W]
Bit #76543210
Fieldfoffset[2:0]Gain[4:0]
Read/WriteR/WR/WR/WR/WR/WR/WR/WR/W
Default000DDDDD
The IOSC Calibrate register is used to calibrate the internal oscillator. The reset value is undefined but during boot the SROM
writes a calibration valu e that is determi ned during manu facturing test. This va lue should not req uire change durin g normal use.
This is the meaning of ‘D’ in the Default field
Bit [7:5]: foffset [2:0]
This value is used to trim the freq uency of the internal oscillat or. These bits are not used in factory calibration and will be zero.
Setting each of these bits causes the appropriate fine offset in oscillator frequency.
foffset bit 0 = 7.5 KHz
foffset bit 1 = 15 KHz
foffset bit 2 = 30 KHz
Bit [4:0]: Gain [4:0]
The effective freq uency change of the of fset input is contro lled through the gain input. A lower value of the ga in setting increases
the gain of the offset input. This value sets the size of each offset step for the internal oscillator. Nominal gain change
(KHz/offsetStep) at each bit, typical conditions (24 MHz operation):
Gain bit 0 = –1.5 KHz
Gain bit 1 = –3.0 KHz
Gain bit 2 = –6 KHz
Gain bit 3 = –12 KHz
Gain bit 4 = –24 KHz
n
where n
the external cryst al os cillat or. An optional divide by two allows
the use of 24-MHz source.
The Interval T imer clock (ITMRCLK) , can be sourced from the
external crystal oscillator, the Internal 24-MHz Oscillator, the
Internal 32-KHz Low-power Oscillator, or from the timer
capture clock (TCAPCLK). A prog ram ma bl e presc ale r of 1 , 2,
3, 4 then divides the selected source.
The Tim er Capture clock (TCAPCLK) can b e sourced from t he
external crystal oscillator, Internal 24-MHz Oscillator, or the
Internal 32-KHz Low-power Oscillator.
When it is not be ing us ed by the ex ternal cryst al o scillat or, the
CLKOUT pin can be driven from one of ma ny sourc es. This is
used for test and can also be used in some applications. The
sources that can drive the CLKOUT are:
• CLKIN after the optional EFTB filter
• Internal 24-MHz Oscillator
• Internal 32-KHz Low-power Oscillator
• CPUCLK after the programmable divider
10.1.1Clock Control Registers
10.1.2Internal Clock Trim
Document 38-08035 Rev. *EPage 18 of 68
Page 19
10.1.3External Clock Trim
Table 10-2. XOSC Tr im (XOSCTR) [0x35] [R/W]
CY7C63310
CY7C638xx
CY7C639xx
Bit #7654321
FieldReservedXOSC XGM [2:0]ReservedMode
Read/Write–––R/WR/WR/W–R/W
Default000DDD0D
0
This register is us ed to c al ibra te the external crysta l os c ill ator. Th e re set va lue is un defined but during boot the SROM writes a
calibration value that is determined during manufacturing test. This is the meaning of ‘D’ in the Default field
Bit [7:5]: Reserved
Bit [4:2]: XOSC XGM [2:0]
Amplifier transconductance setting. The Xgm settings are recommended for resonators with frequencies of interest for the
enCoRe II as below
0 = Oscillator Mode
1 = Fixed Maximum Bias test Mode
10.1.4LPOSC Trim
Table 10-3. LPOSC Trim (LPOSCTR) [0x36] [R/W]
Bit #76543210
Field32-KHz Low
Read/WriteR/W–R/WR/WR/WR/WR/WR/W
DefaultDDDDDDDD
Power
Reserved32-KHz Bias Trim [1:0]32-KHz Freq Trim [3:0]
This register is us ed to calibrate the 32-KHz Low -speed Oscillat or. The reset valu e is undefined but during boo t the SROM wri tes
a calibration value that is dete rmi ned duri ng m anu fac turi ng test. This value should not require change during norma l use. Th is
is the meaning of ‘D’ in the Default field. If the 32-KHz Low-power bit needs to be written, care should be taken not to disturb
the 32-KHz Bias Trim and the 32-KHz Freq Trim fields from their factory calibrated values
Bit 7: 32-KHz Low Power
0 = The 32-KHz Low-speed Oscillator operates in normal mode
1 = The 32-KHz Low-speed Oscillator operates in a low-power mode. The oscillator continues to function normally but with
reduced ac curacy
Bit 6: Reserved
Bit [5:4]: 32-KHz Bias Trim [1:0]
These bits c ontrol the bi as current of the low-power oscillator.
0 0 = Mid bias
0 1 = High bias
1 0 = Reserved
1 1 = Disable (off)
Important Note: D o not program the 32-KH z Bias Tri m [1:0] field with the reserved 10b val ue as the oscillat or does not osci llate
at all corner conditions with this setting
Bit [3:0]: 32-KHz Freq Trim [3:0]
These bits are used to trim the frequency of the low-power oscillator
This bit only affects the USBCLK when the source is the external crystal oscillator. When the USBCLK source is the Internal
24-MHz Oscillator, the divide by two is always enabled
0 = USBCLK source is divided by two. This is the correct setting to use when the Internal 24-MHz Oscillator is used, or when
the external source is used with a 24-MHz clock
1 = USBCLK is undivided. Use this setting only with a 12-MHz external clock
Bit 5: USB CLK Select
This bit controls the clock source for the USB SIE
0 = Internal 24-MHz Os cillator . Wi th the presenc e of USB traffi c, the Internal 24-MHz Osci llator can be t rimmed to me et the USB
requirement of 1.5% to lerance (see Table 10-6)
1 = External clock—external oscillator on CLKIN and CLKOUT if the external oscillator is enabled (the XOSC Enable bit set in
the CLKIOCR Register—Table 10-8), or the CLKIN input if the external oscillator is disabled. Internal Oscillator is not trimmed
to USB traffic. Proper USB SIE operation requires a 12-MHz or 24-MHz clock accurate to <1.5%.
Bit [4:1]: Reserved
Bit 0: CPU CLK Select
0 = Internal 24-MHz Oscillator.
1 = External crystal oscillator—External crystal oscillator on CLKIN and CLKOUT if the external crystal oscillator is enabled,
CLKIN input if the external crystal oscillator is disabled
Note: the CPU speed selection is configured using the OSC_CR0 Register (Table 10-5)
Disable
USB CLK SelectReservedCPUCLK Select
Document 38-08035 Rev. *EPage 20 of 68
Page 21
CY7C63310
CY7C638xx
CY7C639xx
10.1.6OSC_CR0 Cloc k Configuration
Table 10-5. OSC Control 0 (OSC_CR0) [0x1E0] [R/W]
Bit #76543210
FieldReservedNo BuzzSleep Timer [1:0]CPU Speed [2:0]
Read/Write––R/WR/WR/WR/WR/WR/W
Default00000000
Bit [7:6]: Reserved
Bit 5: No Buzz
During sleep (the Sleep bit is set in the CPU_SCR Register—Table 11-1), the LVD and POR detection circuit is turned on
periodically to detect any POR and LVD events on the VCC pin (the Sleep Duty Cycle bits in the ECO_TR are used to control
the duty cycle—Table 13-3). To facilitate the detection of POR and LVD events, the No Buzz bit is used to force the LVD and
POR detection circui t to b e con tinuou sly e nable d duri ng sl eep. Th is re sult s in a fa ster respons e to a n LVD or POR event during
sleep at the expense of a slightly higher than average sleep current
0 = The LVD and POR detection circuit is turned on periodically as configured in the Sleep Duty Cycle
1 = The Sleep Duty Cycle value is overridden. The LVD and POR detection circuit is always enabled
Note: The periodic Sleep Duty Cycle enabling is independent with the sleep interval shown in the Sleep [1:0] bits below
Bit [4:3]: Sleep Timer [1:0]
Sleep Timer
[1:0]
00512 Hz1.95 m s6 ms
0164 Hz15.6 ms47 ms
108 Hz125 ms375 ms
111 Hz1 sec3 sec
Note: Sleep intervals are approximate
Bit [2:0]: CPU Speed [2:0]
The enCoRe II may operate over a range of CPU clock speeds. The reset value for the CPU Speed bits is zero; therefore, the
default CPU speed is one-eighth of the internal 24 MHz, or 3 MHz
Regardless of the CPU S peed bit’s setting, if the actual CPU speed is greater than 12 MHz, the 24-MH z operating requ irements
apply. An example of this scenario is a device that is configured to use an external clock, which is supplying a frequency of 20
MHz. If the CPU speed register’s value is 0b0 11, the CPU clock will be 20 M Hz. Therefore the supp ly vo lt a ge re quirements for
the device are the same as if the part was operating at 24 MHz. The operating voltage requirements are not relaxed until the
CPU speed is at 12 MHz or less
CPU Speed
[2:0]
000 3 MHz (Default)Clock In / 8
0016 MHzClock In / 4
01012 MHzClock In / 2
01124 MHzClock In / 1
1001.5 MHzClock In / 16
101750 KHzClock In / 32
110187 KHzClock In / 128
111ReservedReserved
Important Note: Correct USB operation s require the CPU cloc k speed to be at least eight times gre ater than the USB cloc k. If
the two clocks have the same source then the CPU clock divider should not be set to divide by more than 8. If the two clocks
have different sources, care must be taken to ensure that the maximum ratio of USB Clock/CPU Clock can never exceed 8
across the full specif ication rang e of both clock sources
Sleep Timer Clock
Frequency (Nominal)
CPU when Internal
Oscillator is selectedExternal Clock
Sleep Period
(Nominal)
Watchdog Period
(Nominal)
Document 38-08035 Rev. *EPage 21 of 68
Page 22
CY7C63310
CY7C638xx
CY7C639xx
10.1.7USB Oscillator Lock Configuration
Table 10-6. USB Osclock Clock Configuration (OSCLCKCR) [0x39] [R/W]
Bit #76543210
FieldReservedFine Tune OnlyUSB Osclock
Read/Write––––––R/WR/W
Default00000000
This register is used to trim the Internal 24-MHz Oscillator using received low-speed USB packets as a timing reference. The
USB Osclock circuit is active when the Internal 24-MHz Oscillator provides the USB clock
Bit [7:2]: Reserved
Bit 1: Fine Tune Only
0 = Enable
1 = Disable the oscillator lock from performing the course-tune portion of its retuning. The oscillator lock must be allowed to
perform a course tuning in order to t une the os cillator f or correct USB SIE ope ration. Af ter the os cillator i s properly tun ed this b it
can be set to reduce variance in the internal oscillator frequency that would be caused course tuning
Bit 0: USB Osclock Disable
0 = Enable. With the presence of USB traffic, the Internal 24-MHz Oscillator precisely tunes to 24 MHz ± 1.5%
1 = Disable. The Internal 24-MHz Oscillator is not trimmed based on USB packets. This setting is useful when the internal
oscillator is not sourcing the USBSIE clock
Bit #76543210
FieldTCAPCLK DividerTCAPCLK SelectITMRCLK DividerITMRCLK Select
Read/WriteR/WR/WR/WR/WR/WR/WR/WR/W
Default10001111
Bit [7:6]: TCAPCLK Divider [1:0]
TCAPCLK Divider controls the TCAPCLK divisor
0 0 = Divider Value 2
0 1 = Divider Value 4
1 0 = Divider Value 6
1 1 = Divider Value 8
Bit [5:4]: TCAPCLK Select
The TCAPCLK Select field controls the source of the TCAPCLK
0 0 = Internal 24-MHz Oscillator
0 1 = External crystal oscillator—external crystal oscillator on CLKIN and CLKOUT if the external crystal oscillator is enabled,
CLKIN input if the external crystal oscillator is disabl ed (the XOSC Enable bit of th e C L KIOCR R egi st er i s cl eare d —Table 10-8)
1 0 = Internal 32-KHz Low-power Oscillator
1 1 = TCAPCLK Disabled
Note: The 1024-µs interval timer is based on the assumption that TCAPCLK is running at 4 MHz. Changes in TCAPCLK
frequency will cause a corresponding change in the 1024-µs interval timer frequency
Bit [3:2]: ITMRCLK Divider
ITMRCLK Divider controls the ITMRCLK divisor.
0 0 = Divider value of 1
0 1 = Divider value of 2
1 0 = Divider value of 3
1 1 = Divider value of 4
Bit [1:0]: ITMRCLK Select
0 0 = Internal 24-MHz Oscillator
0 1 = External crystal oscillator – external crystal oscillator on CLKIN and CLKOUT if the external crystal oscillator is enabled,
CLKIN input if the external crystal oscillator is disabled
1 0 = Internal 32-KHz Low-power Oscillator
1 1 = TCAPCLK
This bit when set, selects the external crystal oscillator clock as clock source of external clock. Care needs to be taken while
selecting the crystal oscillator clock. First enable the crystal oscillator and wait for few cycles, which is oscillator stabilization
period. Then select the cry stal clock as clock source. Similarly, while deselect crys t al cl ock , fi rst des el ec t cry stal clock as clock
source then disable the cryst al osc il lat or.
0 = Not select external crystal oscillator clock
1 = Select the external crystal oscillator clock
Bit 3: XOSC Enable
This bit when set enables the external crystal oscillator. The external crystal oscillator shares pads CLKIN and CLKOUT with
two GPIOs—P0.0 and P0.1, respectively. When the external crystal oscillator is enabled, the CLKIN signal comes from the
external crystal os ci ll ator block and the output enables on th e G PIO s for P0.0 and P0.1 are dis ab led , e li mi nati ng th e p os si bil ity
of contention. When the external crystal oscillator is disabled the source for CLKIN signal comes from the P0.0 GPIO input.
0 = Disable the external oscillator
1 = Enable the external oscillator
Note: The external crystal oscillator startup time takes up to 2 ms.
Bit 2: EFTB Disabled
This bit is only available on the CY7C639xx
0 = Enable the EFTB filter
1 = Disable the EFTB filter, causing CLKIN to bypass the EFTB filter
Bit [1:0]: CLKOUT Select
0 0 = Internal 24-MHz Oscillator
0 1 = External crystal oscillator – external crystal oscillator on CLKIN and CLKOUT if the external crystal oscillator is enabled,
CLKIN input if the external oscillator is disabled
1 0 = Internal 32-KHz Low-power Oscillator
1 1 = CPUCLK
10.2CPU Clock During Sleep Mode
When the CPU enters sl eep mod e th e CP UC LK Sel ect (Bit 1,
Table 10-4) is forced to the Internal Oscillator, and the oscillator is stopped. When the CPU com es ou t of sleep mode it i s
running on the internal oscillator. The internal oscillator
recovery time is three clo ck cycles of the Internal 32-KH z Lowpower Oscillator.
If the system requires the CPU to run off the external clock
after awaking from sleep mode, firmware will need to switch
the clock sour ce for the CPU. If t he external c lock source is the
external oscillator and the oscillator is disabled, firmware will
need to enab le the external oscillator, wait for it to stabilize ,
and then cha nge the clock source.
11.0 Reset
The microcontroller supports two types of resets: Power-on
Reset (POR) and Watchdog Reset (WDR). When reset is
initiated, all regi sters are rest ored to their def ault states and all
interrupts are disabled.
The occurrence of a reset is recorde d in the System Sta tus and
Control Register (CPU_SCR). Bits within this register record
the occurrence of POR and WDR Reset respectively. The
firmware can interrogate these bits to determine the cause of
a reset.
The microcontroller resumes execution from Flash address
0x0000 after a reset . The interna l clocking mod e is active af ter
a reset, until changed by user firmware.
Note: The CPU clock defaults to 3 MHz (Internal 24-MHz
Oscillator divide -by-8 mode) at POR to guarantee operation at
the low V
that might be present during the supply ramp.
CC
Document 38-08035 Rev. *EPage 23 of 68
Page 24
CY7C63310
CY7C638xx
CY7C639xx
Table 11-1. System Status and Control Register (CPU_SCR) [0xFF] [R/W]
Bit #76543210
FieldGIESReservedWDRSPORSSleepReservedStop
Read/WriteR–R/C
Default00010000
The bits of the CPU_SC R re gis ter a r e us ed to co nv ey st a tus and con trol of ev en ts for various functio ns o f an e nC oRe II devic e
Bit 7: GIES
The Global Interrupt Enable Status bit is a read only status bit and its use is discouraged. The GIES bit is a legacy bit, which
was used to provide the ab ili ty to read the GIE bit of t he CP U_ F register. However, the CPU_F regi ste r is no w rea dab le. Whe n
this bit is set, it indicates that the GIE bit in the CPU_F register is also set which, in turn, indicates that the microprocessor will
service interrupts
0 = Global interrupts disabled
1 = Global interrupt enabled
Bit 6: Reserved
Bit 5: WDRS
The WDRS bit is set by th e CPU to indic ate tha t a WDR event has occu rred. The user c an read this b it to de termin e the type of
reset that has occurred. The user can clear but not set this bit
0 = No WDR
1 = A WDR event has occurred
Bit 4: PORS
The PORS bit is set by the CP U to indi cate that a POR event has oc cur r ed. T he us er c an read this bit to de term in e the typ e of
reset that has occurred. The user can clear but not set this bit
0 = No POR
1 = A POR event has occurred. (Note that WDR events will not occur until this bit is cleared)
Bit 3: SLEEP
Set by the user to enable CPU sleep s tate. CP U will remain in sleep mode unti l any interrupt is pendin g. The Sleep bit is c overed
in more detail in the Sleep Mode section
0 = Normal operation
1 = Sleep
Bit [2:1]: Reserved
Bit 0: STOP
This bit is set by the user to halt the CPU. The CPU will remain halted until a reset (WDR, POR, or external reset) has taken
place. If an application wants to stop code execution until a reset, the preferred method would be to use the HALT instruction
rather than writing to this bit
0 = Normal CPU operation
1 = CPU is halted (not recommended)
[4]
R/C
[4]
R/W––R/W
11.1Power-on Reset
POR occurs every ti me the power to the dev ice is switched on.
POR is released when the supply is typically 2.6V for the
upward suppl y transition, with ty pically 50 mV of hysteres is
during the power-on transient. Bit 4 of the System Status and
Control Register (CPU_SCR) is set to record this event (the
register contents are set to 00010000 by the POR). After a
POR, the microprocessor is held off for approximately 20 ms
for the V
instruction at address 0x00 in the Flash. If the V
drops below the POR downward supply trip point, POR is
reasserted. The V
4V in 0 to 200 ms.
supply to stabilize before executing the first
CC
supply needs to ramp linearly from 0 to
CC
voltage
CC
Important: The PORS status bit is set at POR and can only
be cleared by the user. It cannot be set by firmware.
11.2Watchdog Timer Reset
The user has the option to enable the WDT. The WDT is
enabled by clearing the PORS bit. Once the PORS bit is
Note:
4. C = Clear. This bit can only be cleared by the user and cannot be set by firmware.
cleared, the WDT cannot be disabled. The only exception to
this is if a POR ev ent ta kes place, w hich wil l disabl e the WDT.
The sleep timer is u se d to ge nera te t he s le ep time period and
the Watchdog time period. The sleep timer uses the Internal
32-KHz Low-power Oscillator system clock to produce the
sleep time period. T he user ca n program the sleep time p eriod
using the Sleep Timer bits of the OSC_CR0 Register
(Table 10-5). When the sleep time elapses (sleep timer
overflows), an interrupt to t he Sleep Timer Interrupt Vector will
be generated.
The Watchdog Timer period is automatically set to be three
counts of the Sleep T imer overflows . This represen ts betwe en
two and th ree sleep in tervals de pending on the count in the
Sleep Timer at the previous WDT clear. When this timer
reaches three, a WDR is generated.
The user can either clear th e WDT, or the WDT and the Sle ep
Timer. Whenever the user writes to the Reset WDT Register
(RES_WDT), the WDT will be cleared. If the da ta that is written
is the hex value 0x38, the Sleep Timer will also be cleared at
the same time.
Any write to this register will clear Watchdog Timer, a write of 0x38 will also clear the Sleep Timer
Bit [7:0]: Reset Watchdog Timer [7:0]
12.0 Sleep Mode
The CPU can only be put to sleep by the firmware. This is
accomplished by se tting the Sleep bit i n the System S tatus and
Control Register (CPU_SCR). This stops the CPU from
executing instru ctions, and the CP U will remain asleep until an
interrupt comes pending, or there is a reset event (either a
Power-on Reset, or a Watchdog Timer Reset).
The Low-voltage Detection circuit (LVD) drops into fully
functional power-reduced states, and the latency for the LVD
is increased. The actual latency can be traded against power
consumption by changing Sleep Duty Cycle field of the
ECO_TR Register.
The Internal 32-KHz Low-speed Oscillator remains running.
Prior to entering suspend mode, firmware can optionally
configure the 32-KHz Low-speed Oscillator to operate in a lowpower mode to help reduce the over all power consumption
(Using Bi t 7, Table 10-3). This will help save approximately
5 µA; however, the trade off is that the 32-KHz Low-speed
Oscillator will be less accurate (–85% to +120% deviation).
All interrupts rem ain active. Only the occu rrence of an interrupt
will wake the part from sleep. The Stop bit in the System Status
and Control Register (CPU_SCR) must be cleared for a part
to resume out of sleep. The Global Interrupt Enable bit of the
CPU Flags Register (CPU_F) does not have any effect. Any
unmasked interrupt will wake the system up. As a result, any
interrupts not intended for waking should be disabled through
the Interrupt Mask Registers.
When the CPU enters sl eep mod e the CP UCL K Sele ct (Bit 1,
Table 10-4) is forced to the Internal Oscillator. The internal
oscillator r ecovery time is thre e clock cycles of the Internal
32-KHz Low-power Oscillator. The Internal 24-MHz Oscillator
restarts immediately on exiting Sleep mode. If the external
crystal oscilla tor is used, firmware will need to switc h the clock
source for the CPU.
Unlike the Internal 2 4-MHz Os cilla tor, the external oscillator is
not automati ca l ly sh ut do wn du r ing sl e ep . S ys t em s th at n ee d
the external oscillator disabled in sleep mode will need to
disable the external oscillator prior to entering sleep mode. In
systems where the CPU runs off the external oscillator,
firmware will need to switch the CPU to the internal oscillator
prior to disabling the external oscillator.
On exiting sleep mode , onc e the clo ck is s t ab le and the delay
time has expired, the instruction immediately following the
sleep instruction is executed before the interrupt service
routine (if enabled).
The Sleep interrupt allows the microcontroller to wake up
periodically and poll system components while maintaining
very low average power consumption. The Sleep interrupt
may also be us ed to provide pe riodic interrupts during nonsleep modes.
Document 38-08035 Rev. *EPage 25 of 68
Page 26
CY7C63310
CY7C638xx
CY7C639xx
13.0 Low-voltage Detect Control
Table 13-1. Low-voltage Control Register (LVDCR) [0x1E3] [R/W]
Bit #76543210
FieldReservedPORLEV[1:0]ReservedVM[2:0]
Read/Write––R/WR/W–R/WR/WR/W
Default00000000
This register controls the configuration of the Power-on Reset / Low-voltage Detection block
Bit [7:6]: Reserved
Bit [5:4]: PORLEV[1:0]
This field controls the level below which the precision power-on-reset (PPOR) detector generates a reset
0 0 = 2.7V Range (trip near 2.6V)
0 1 = 3V Range (trip near 2.9V)
1 0 = 5V Range, >4.75V (trip near 4.65V)
1 1 = PPOR will not generate a reset, but values read from the Voltage Monitor Comparators Register (Table 13-2) give the
internal PPOR comparator state with trip point set to the 3V range setting
Bit 3: Reserved
Bit [2:0]: VM[2:0]
This field controls the level below which the low- voltage -detect trips—p ossibly ge nerating an int errupt and the le vel at whic h the
Flash is enabled for operation.
Table 13-2. Voltage Monitor Comparators Register (VLTCMP) [0x1E4] [R]
Bit #76543210
FieldReservedLVDPPOR
Read/Write––––––RR
Default00000000
This read-only register allows reading the current state of the Low-voltage-Detection and Precision-Power-On-Reset comparators
Bit [7:2]: Reserved
Bit 1: LVD
This bit is set to indicate th at the low- v ol t age -de tec t com parator has tripped, indicating that the supply vo ltage has gone below
the trip point set by VM[2:0] (See Table 13-1)
0 = No low-voltage-detect event
1= A low-voltage-detect has tripped
Bit 0: PPOR
This bit is set to indicate that the precision-power-on-reset comparator has tripped, indicating that the supply voltage is below
the trip point set by PORLEV[1:0]
0 = No precision-power-on-reset event
1= A precision-power-on-reset event has tripped
Document 38-08035 Rev. *EPage 26 of 68
Page 27
CY7C63310
CY7C638xx
CY7C639xx
13.0.2ECO Trim Register
Table 13-3. ECO (ECO_TR) [0x1EB] [R/W]
Bit #76543210
FieldSleep Duty Cycle [1:0]Reserved
Read/WriteR/WR/W––––––
Default00000000
This register controls the ratio s (in nu mb ers of 32-KHz cl oc k peri od s) of “on” tim e versus “off” time for LVD and POR detection
circuit
Bit [7:6]: Sleep Duty Cycle [1:0]
0 0 = 128 periods of the Internal 32-KHz Low-speed Oscillator
0 1 = 512 periods of the Internal 32-KHz Low-speed Oscillator
1 0 = 32 periods of the Internal 32-KHz Low-speed Oscillator
1 1 = 8 periods of the Internal 32-KHz Low-speed Oscillator
14.0 General-purpose I/O Ports
14.1Port Data Registers
14.1.1P0 Data
Table 14-1. P0 Data Register (P0DATA)[0x00] [R/W]
Bit #76543210
FieldP0.7P0.6/TIO1P0.5/TIO0P0.4/INT2P0.3/INT1P0.2/INT0P0.1/CLKOUTP0.0/CLKIN
Read/WriteR/WR/WR/WR/WR/WR/WR/WR/W
Default00000000
This register contains the data for Port 0. W riting to this regis ter sets the bit va lues to be output on ou tput enabled pins. R eading
from this register returns the current state of the Port 0 pins.
Bit 7: P0.7 Data
P0.7 only exists in the CY7C638xx and CY7C639xx
Bit [6:5]: P0.6–P0.5 Data / TIO1 and TIO0
Beside their use as the P0.6–P0.5 GPIO s, these pins can also be used for the alternate functions as the Capture T imer in put or
Timer output pins (TIO1 and TIO0). T o configure the P0.5 and P0. 6 pins, refer to the P0.5/TIO0–P0.6/TIO1 Co nfiguration Register
(Table 14-9)
The use of the pins as the P0.6–P0.5 GPIOs and the alternate functions exist in all the enCoRe II parts
Bit [4:2]: P0.4–P0.2 Data / INT2 – INT0
Beside their use as the P0.4–P0.2 GPIOs, these pins can also be used for the alternate functions as the Interrupt pins
(INT0–INT2). To configure the P0.4–P0.2 pins, refer to the P0.2/INT0–P0.4/INT2 Configuration Register (Table 14-8)
The use of the pins as the P0.4–P0.2 GPIOs and the alternate functions exist in all the enCoRe II parts
Bit 1: P0.1/CLKOUT
Beside its use as th e P0.1 GP IO, th is pi n can als o be u sed for the altern ate fu nction as the CLK OUT pin. To configure the P0.1
pin, refer to the P0.1/CLKOUT Configuration Register (Table 14-7)Bit 0: P0.0/CLKIN
Beside its use as the P0.0 GPIO, this pin can also be used for the alternate function as the CLKIN pin. To configure the P0.0
pin, refer to the P0.0/CLKIN Configuration Register (Table 14-6)
Document 38-08035 Rev. *EPage 27 of 68
Page 28
CY7C63310
CY7C638xx
CY7C639xx
14.1.2P1 Data
Table 14-2. P1 Data Register (P1DATA) [0x01] [R/W]
Bit #76543210
FieldP1.7P1.6/SMISOP1.5/SMOSIP1.4/SCLKP1.3/SSELP1.2/VREGP1.1/D–P1.0/D+
Read/WriteR/WR/WR/WR/WR/WR/WR/WR/W
Default00000000
This register contains the data for Port 1. W riting to this regis ter sets the bit va lues to be output on ou tput enabled pins. R eading
from this register returns the current state of the Port 1 pins.
Bit 7: P1.7 Data
P1.7 only exists in the CY7C638xx and CY7C639xx
Bit [6:3]: P1.6–P1.3 Data/SPI Pins (SMISO, SMOSI, SCLK, SSEL)
Beside their use as the P1.6–P1.3 GPIOs, these pins can also be used for the alternate function as the SPI interface pins. To
configure the P1.6–P1.3 pins, refer to the P1.3–P1.6 Configuration Register (Table 14-14)
The use of the pins as the P1.6–P1.3 GPIOs and the alternate functions exist in all the enCoRe II parts.
Bit 2: P1.2/VREG
On the CY7C639xx, this pin can be used as the P1.2 GPIO or the VREG output. If the VREG output is enabled (Bit 0
Table 19-1 is set), a 3.3V source is placed on the pin and the GPIO function of the pin is disabled
On the CY7C63813, this pin c an only be used as the VREG output whe n USB mode is enab led. In non-USB mo de, this pin can
be used as the P1.2 GPIO
The VREG output is not available in the CY7C63310 and CY7C63801
Bit [1:0]: P1.1–P1.0 / D– and D+
When USB mode is disabled (Bit 7 in Table 21-1 is clear), the P1.1 and P1.0 bits are used to control the state of the P1.0 and
P1.1 pins. When the USB mode is enabled, the P1.1 and P1.0 pins are used as the D– and D+ pins respectively. If the USB
Force State bit (Bit 0 in Table 18-1) is set, the state of the D– and D+ pins can be controlled by writing to the D– and D+ bits
14.1.3P2 Data
Table 14-3. P2 Data Register (P2DATA) [0x02] [R/W]
Bit #76543210
FieldP2.7–P2.2P2.1–P2.0
Read/WriteR/WR/WR/WR/WR/WR/WR/WR/W
Default00000000
This register contains the data for Port 2. W riting to this regis ter sets the bit va lues to be output on ou tput enabled pins. R eading
from this register returns the current state of the Port 2 pins
Bit [7:2]: P2 Data [7:2]
P2.7–P2.2 only exist in the CY7C639xx. Note that the CY7C63903-PVXC (28 pin SSOP package) only has P2.7–P2.4
Bit [1:0]: P2 Data [1:0]
P2.1–P2.0 only exist in the CY7C63823 and CY7C639xx (except the CY7C63903-PVXC 28 pin SSOP pa ckage)
14.1.4P3 Data
Table 14-4. P3 Data Register (P3DATA) [0x03] [R/W]
Bit #76543210
FieldP3.7–P3.2P3.1–P3.0
Read/WriteR/WR/WR/WR/WR/WR/WR/WR/W
Default00000000
This register contains the data for Port 3. W riting to this regis ter sets the bit va lues to be output on ou tput enabled pins. R eading
from this register returns the current state of the Port 3 pins
Bit [7:2]: P3 Data [7:2]
P3.7–P3.2 only exist in the CY7C639xx. Note that the CY7C63903-PVXC 28 pin SSOP package only has P3.7–P3.4
Bit [1:0]: P3 Data [1:0]
P3.1–P3.0 only exist in the CY7C63823 and CY7C639xx (except the CY7C63903-PVXC 28 pin SSOP pa ckage)
Document 38-08035 Rev. *EPage 28 of 68
Page 29
CY7C63310
CY7C638xx
CY7C639xx
14.1.5P4 Data
Table 14-5. P4 Data Register (P4DATA) [0x04] [R/W]
Bit #76543210
FieldReservedP4.3–P4.0
Read/WriteRRRRR/WR/WR/WR/W
Default00000000
This register contai ns the data fo r Port 4. Wri ting to this registe r sets the bi t values to be o utput on output-e nabled pins. Reading
from this register returns the current state of the Port 2 pins
Bit [7:4]: Reserved
Bit [3:0]: P4 Data [3:0]
P4.3–P4.0 only exist in the CY7C639xx except the CY7C63903-PVXC
14.2GPIO Port Configuration
All the GPIO configuration registers have common configuration controls. The foll owing are the bit definiti ons of the GPIO
configuration registers
14.2.1Int Enable
When set, the Int Enable bit allows the GPIO to generate interrupts. Interrupt generate can occur regardless of whether the
pin is configured for input or output. All interrupts are edge
sensitive, however for any interrupt that is shared by multiple
sources (i.e., Ports 2, 3, and 4) all inputs must be deasserted
before a new interrupt can occur.
When clear , the corres ponding interru pt is disabled on the pin.
It is possible to configure GPIOs as outputs, enable the
interrupt on the pin and then to generate the interrupt by
driving the approp riate pin st ate. This is usefu l in test an d may
have value in applications as well.
14.2.2Int Act Low
When set, the corresponding interrupt is active on the falling
edge.
When clear, the corresponding interrupt is active on the ri si ng
edge.
14.2.3TTL Thresh
When set, the input has TTL threshold. When clear, the input
has standard CMOS threshold.
14.2.4Hi gh Sink
When set, the output can sink up to 50 mA.
When clear, the output can sink up to 8 mA.
On the CY7C639xx, only the P3.7, P2.7 , P0.1, and P0 .0 have
50-mA sink drive capability. Other pins have 8-mA sink drive
capability.
On the CY7C638 xx, only the P1.7 –P1.3 have 50-mA sink drive
capability. Other pins have 8-mA sink drive capability.
14.2.5Open Drain
When set, the output o n the pin is d etermined by the Port Data
Register. If the corresponding bit in the Port Data Register is
set, the pin is in high-impe dance stat e. If the correspond ing bit
in the Port Data Register is clear, the pin is driven low.
When clear, the output is driven low or high.
14.2.6Pull-up Enable
When set the pin has a 7K pull-up to V
with V3.3 enabled).
When clear, the pull-up is disabled.
14.2.7Output Enable
When set, the output driver of the pin is enabled.
When clear, the output driver of the pin is disabled.
For pins with shared functions there are some s pec ia l c ase s.
P0.0(CLKIN) and P0.1(CLKOUT) can not be output enabled
when the crystal osci llator is enabled. Output enable s for these
pins are overridden by XOSC Enable.
P1.2(VREG), P1.3(SSEL), P1.4(SCLK), P1.5(SMOSI) and
P1.6(SMISO) can be used for their dedicated functions or for
GPIO. To enable the pin for GPIO use clear the co rresponding
SPI Use bit or the Output Enable will have no effect.
14.2.8VREG Output / SPI Use
The P1.2(VREG), P1.3(SSEL), P1.4(SCLK), P1.5(SMOSI)
and P1.6(SMISO) pins can be used for their dedicated
functions or for GPIO. To enable the pin for GPIO, clear the
corresponding VREG Out put or SPI Use bit . The SPI func ti on
controls the output e nable for i ts d edicated function pin s when
their GPIO enable bit is clear. The VREG output is not
available on the CY7C63801 and CY7C63310.
14.2.93.3V Drive
The P1.3(SSEL), P1.4(SCLK), P1.5(SMOSI) and
P1.6(SMISO) pins have an alternate voltage source from the
voltage regul ator. If the 3.3V Drive bi t is set a high level is
driven from the voltage regulator instead of from V
the 3.3V Drive bit does not enable the voltage regulator. That
must be done explicitly by setting the VREG Enable bit in the
VREGCR Register (Table 19-1).
This pin is shared betw een the P0.0 GPIO use and the CLKIN pin for th e external cr ysta l oscillator. When the external oscillator
is enabled the settings of this register are ignored
The use of the pin as the P0 .0 GPIO is availab le in all the enCoR e II p arts. T he alterna te functi on of the pin as th e CLKIN is only
available in the CY7C639xx. When the external oscillator is enabled (the XOSC Enable bit of the CLKIOCR Register is
set—Table 10-8), the GPIO function of the pin is disabled
The 50-mA sink dr ive capability is only available i n the CY7C639xx. In the CY7C638xx, onl y 8-mA sink drive capability is a vailable
on this pin regardless of the setting of the High Sink bit
This pin is shared between the P0.1 GPIO use and the CLKOUT pin for the external crystal oscilla tor. When the ex ternal oscillator
is enabled the settings of this register are ignored. When CLK output is set, the internally selected clock is sent out onto
P0.1CLKOUT pin.
The use of the pin as the P0.1 GPIO is avai la ble in all the en C oRe II p arts. The alternate function of the pin as the CLKOUT is
only available in the CY7C639xx. When the external oscillator is enabled (the XOSC Enable bit of the CLKIOCR Register is
set—Table 10-8), the GPIO function of the pin is disabled
The 50-mA sink dr ive capability is only available i n the CY7C639xx. In the CY7C638xx, onl y 8-mA sink drive capability is a vailable
on this pin regardless of the setting of the High Sink bit
Bit 7: CLK Output
0 = The clock output is disabled
1 = The clock selected by the CLK Select field (Bit [1:0] of the CLKIOCR Register—Table 10-8) is driven out to the pin
Bit #76543210
FieldReservedInt Act LowTTL ThreshReservedOpen DrainPull-up EnableOutput Enable
Read/Write––R/WR/W–R/WR/WR/W
Default00000000
These registers contro l the operatio n of pins P0.2–P0.4 respectively. These pins are shared betwee n the P0.2–P0.4 GPI Os and
the INT0–INT2. These registers exist in all enCoRe II parts. The INT0–INT2 interrupts are different than all the other GPIO
interrupts. These p ins are connected di rectly to the interrupt con troller to provide three edge-sensitive interrupt s with independent
interrupt vectors. These interru pts occur on a rising ed ge when Int act Low is clear and on a fall ing edge when Int act Low is set.
These pins are enabled as interrupt sources in the interrupt controller registers (Table 17-8 and Table 17-6).
To use these pins as interrupt inputs configure them as inputs by clearing the corresponding Output Enable. If the INT0–INT2
pins are configure d as output s with inte rrupts ena bled, firmware can generat e an interrupt by writing the appropri ate value to the
P0.2, P0.3 and P0.4 data bits in the P0 Data Register
Regardless of wheth er the pins are us ed as Inte rrupt or GPIO pins the In t Enab le, Int act Low, TTL Threshold, Open Drain, and
Pull-up Enable bits control the behavior of the pin
The P0.2/INT0–P0.4/INT2 pins are individually configured with the P02CR (0x07), P03CR (0x08), and P04CR (0x09) respectively.
Note: Changing the state of the Int Act Low bit can cause an unintentional interrupt to be generated. When configuring these
interrupt sources, it is best to follow the following procedure:
These registers control the operation of pins P0.5 through P0.6, respectively. These registers exist in all enCoRe II parts.
P0.5 and P0.6 are share d with TIO0 and TIO1, re spectively. T o use these pi ns as Capture T imer in puts, configu re them as input s
by clearing the correspond ing Ou tput Enabl e. To use TIO0 and TIO1 as T i mer outp uts , set the TIO x Out put and Outpu t Enable
bits. If these pins are configured as outputs and the TIO Output bit is clear, firmware can control the TIO0 and TIO1 inputs by
writing the value to the P0.5 and P0.6 data bits in the P0 Data Register
Regardless of whether eit her pin is used as a TIO or GPI O pin the Int Enable, Int ac t Low , TTL T hreshold, O pen Drain, an d Pullup Enable control the behavior of the pin.
TIO0(P0.5) when enabled ou tputs a posit ive pulse from th e 1024-µs interv al timer . This is the same signal tha t is used internal ly
to generate the 1024-µs timer interrupt. This signal is not gated by the interrupt enable state.
TIO1(P0.6) when enabled outputs a positive pulse from the programmable interval timer. This is the same signal that is used
internally to generate the programmable timer interval interrupt. This signal is not gated by the interrupt enable state
The P0.5/TIO0 and P0.6/TIO1 pins are individually configured with the P05CR (0x0A) and P06CR (0x0B), respectively
Bit #76543210
FieldReservedInt EnableInt Act LowReservedPS/2 Pull-up
Read/WriteR/WR/WR/W–––R/WR/W
Default00000000
Enable
This register controls the operation of the P1.0 (D+) pin when the USB interface is not enabled, allowing the pin to be used as
a PS2 interface or a GPIO. See Table 21-1 for information o n enabl ing U SB. When USB i s enabl ed, non e of the c ontrol s in this
register have any affect on the P1.0 pin.
Note: The P1.0 is an open drain only output. It can actively drive a signal low, but cannot actively drive a signal high.
Bit 1: PS/2 Pull-up Enable
0 = Disable the 5K-ohm pull-up resistors
1 = Enable 5K-ohm pull-u p resis tors f or both P1.0 and P1.1. En able th e use of the P 1.0 (D +) and P1.1 (D –) pi ns as a PS 2 st yle
interface
14.2.16 P1.1/D– Configuration
T a ble 14-1 2. P1.1/D– Configuration (P11CR) [0x0E] [R/W]
Bit #76543210
FieldReservedInt EnableInt Act LowReservedOpen DrainReservedOutput Enable
Read/Write–R/WR/W––R/W–R/W
Default00000000
This register controls the operation of the P1.1 (D–) pin when the USB interface is not enabled, allowing the pin to be used as
a PS2 interface or a GPIO. See Table 21-1 for information o n enabl ing U SB. When USB i s enabl ed, non e of the c ontrol s in this
register have any affect on the P1.1 pin. When USB is disabled, the 5-Kohm pull-up resistor on this pin can be enabled by the
PS/2 Pull-up Enable bit of the P10CR Register (Table 14-11)Note: There is no 2-mA sourcing capability on this pin. The pin can only sink 5 mA at V
This register controls the operation of the P1.2
Bit 7: CLK Output
0 = The internally selected clock is not sent out onto P1.2 pin
1 = This CLK Output is use d to observe conne cted external crystal osci llator clock connected in CY7 C639xx. When C LK Output
is set, the internally selected clock is sent out onto P1.2 pin
This register controls the operation of the P1.3 pin. This register exists in all enCoRe II parts
The P1.3 GPIO’s threshold is always set to TTL
When the SPI hardware is enab led, the output en able and output s tate of the pi n is co ntrolled by the SPI circuit ry. When the SPI
hardware is disabled, the pin is controlled by the Output Enable bit and the corresponding bit in the P1 data register.
Regardless of whether the p in is used as an SPI or GPIO pin the Int Enable, Int a ct Low , 3.3V Drive , High Sink, Open Drain, and
Pull-up Enable control the behavior of the pin
The 50-mA sink dr ive capability is only available i n the CY7C638xx. In the CY7C639xx, onl y 8-mA sink drive capability is a vailable
on this pin regardless of the setting of the High Sink bit
These registers control the operation of pins P1.4–P1.6, respectively. These registers exist in all enCoRe II parts
The P1.4–P1.6 GPIO’s threshold is always set to TTL
When the SPI hardware is enable d, pins that are con figured as SPI Use have their output enable and ou tput stat e controlle d by
the SPI circuitry. When the SPI hardware is disabled or a p in has it s SPI Use bi t clear, the pin is controlled by the Output En able
bit and the corresponding bit in the P1 data register.
Regardless of whether any pin is used as an SPI or GPIO pin the Int Enable, Int act Low, 3.3V Drive, High Sink, Open Drain,
and Pull-up Enable control the behavior of the pin
The 50-mA sink dr ive capability is only available i n the CY7C638xx. In the CY7C639xx, onl y 8-mA sink drive capability is a vailable
on this pin regardless of the setting of the High Sink bit
Bit 7: SPI Use
0 = Disable the SPI alternate function. The pin is used as a GPIO
1 = Enable the SPI function. The SPI circuitry controls the output of the pin
Important Note for Comm Modes 01 or 10 (SPI Master or SPI Slave, see Table 15-2):
When configured for SPI (SPI Use = 1 and Comm Modes [1:0] = SPI Master or SPI Slave mode), the input/output direction of
pins P1.3, P1.5, an d P1 .6 is s et a uto ma tic all y by th e SPI lo gic. However, pin P1.4's input/output direction i s NOT au tom ati ca lly
set; it must be explici tly se t by firm ware . For SPI M as ter mod e, p in P1 .4 mus t be con fig ured as an o utpu t; fo r SPI Sla ve m od e,
pin P1.4 must be configured as an input.
This register controls the operation of pin P1.7. This register only exists in CY7C638xx and CY7C639xx
The 50-mA sink dr ive capability is only available i n the CY7C638xx. In the CY7C639xx, onl y 8-mA sink drive capability is a vailable
on this pin regardless of the setting of the High Sink bit
The P1.7 GPIO’s threshold is always set to TTL
This register only exists in CY7C638xx and CY7C639xx. In CY7C638xx this register controls the operation of pins P2.0–P2.1.
In the CY7C639xx, this register controls the operation of pins P2.0–P2.7
The 50-mA sink drive capability is only available on pin P2.7 and only on the CY7C639xx. In the CY7C638xx, only 8-mA sink
drive capability is available on this pin regardless of the setting of the High Sink bit
This register exist s in CY7 C638xx and CY7C639x x. In CY7C6 38xx this register con trols the op eration of pins P3.0 –P3.1. In the
CY7C639xx, this register controls the operation of pins P3.0–P3.7
The 50-mA sink drive capability is only available on pin P3.7 and only on the CY7C639xx. In the CY7C638xx, only 8-mA sink
drive capability is available on this pin regardless of the setting of the High Sink bit
This register exists only in the CY7C639xx. This register controls the operation of pins P4.0–P4.3
15.0 Serial Peripheral Interface (SPI)
The SPI Ma ster/Slave Interface core lo gic runs on the SP I
clock domain, making its functionality independent of system
clock speed. SPI is a four pin serial interface comprised of a
clock, an enable and two data pins.
15.1SPI Data Register
Table 15-1. SPI Data Register (SPIDATA) [0x3C] [R/W]
Bit #76543210
FieldSPIData[7:0]
Read/WriteR/WR/WR/WR/WR/WR/WR/WR/W
Default00000000
When read, this register returns the contents of the receive buffer. When written, it loads the transmit holding register
Bit [7:0]: SPI Data [7:0]
When an interrupt occ urs to indi cate to firmware th at a byt e of
receive data is available, or the transmitter holding register is
empty, firmware has 7 SPI clocks to manage the buffers—to
empty the receiver buffer, or to refill the transmit holding
register. Failure to meet this timing requirement will result in
incorrect data transfer.
Bit #76543210
FieldSwapLSB FirstComm ModeCPOLCPHASCLK Select
Read/WriteR/WR/WR/WR/WR/WR/WR/WR/W
Default00000000
Bit 7: Swap
0 = Swap function disabled
1 = The SPI block swa ps its use of SMOSI and SMISO. Among oth er thin gs, thi s ca n be us eful i n imple mentin g sin gle wire SPI-
like communicatio ns
Bit 6: LSB First
0 = The SPI transmits and receives the MSB (Most Significant Bit) first
1 = The SPI transmits and receives the LSB (Least Significant Bit) first.
Bit [5:4]: Comm Mode [1:0]
0 0: All SPI communication disabled
0 1: SPI master mode
1 0: SPI slave mode
1 1: Reserved
Bit 3: CPOL
This bit controls the SPI clock (SCLK) idle polarity
0 = SCLK idles low
1 = SCLK idles high
Bit 2: CPHA
The Clock Phase bit controls the phase of the clock on which data is sampled. Table 15-3 below shows the timin g for the various
combinations of LSB First, CPOL, and CPHA
Bit [1:0]: SCLK Select
This field selects the speed of the master SCLK. When in master mode, SCLK is generated by dividing the base CPUCLK
Important Note for Comm Modes 01b or 10b (SPI Master or SPI Slave):
When configured for SPI, (SPI Use = 1—Table 14-15), the input/output direction of pins P1.3, P1.5, and P1.6 is set automati-
cally by the SPI logic. Howev er, pin P1.4's input/output direction i s NOT auto ma tic all y s et; it must be e xpl icitl y s et by firm ware.
For SPI Master mode, pin P1.4 must be configured a s a n ou tput ; for SPI Slav e m od e, p in P1 .4 m us t be con fig ured as an i np ut.
Document 38-08035 Rev. *EPage 35 of 68
Page 36
Table 15-3. SPI Mode Timing vs. LSB First, CPOL and CPHA
This register holds the low-order byte of the 16-bit free-running timer. Reading this register causes the high-order byte to be
moved into a holding register allowing an automatic read of all 16 bits simultaneously.
For reads, the actua l read oc curs in the cycl e when the low order i s read. Fo r writes, the actual t ime the w rite occ urs is the cycle
when the high order is written.
When reading the Free Runn ing T imer , the low-orde r byte should b e read first and the hig h-order second . When writing, the loworder byte should be written first then the high-order byte
When reading the Free-runn ing T imer, the low-order byte should be read first an d the high-order se cond. W hen writing, the lowo order byte should be written first then the high-order byte
This register holds the v alue of the Free-ru nning T imer when the last rising edg e occurred on th e TCAP0 input. When Cap ture 0
is in 8-bit mode, the bits that are stored here are selected by the Prescale [2:0] bits in the Timer Configuration register. When
Capture 0 is in 16-bit mode this register holds the lower order 8 bits of the 16-bit timer
This register holds the valu e of the F ree-runni ng T imer when the l ast rising e dge occ urred on the T CAP1 inp ut. The bi ts tha t are
stored here are selected by the Prescale [2:0] bits in the Timer Configuration register. When Capture 0 is in 16-bit mode this
register holds the hi gh-orde r 8 bit s of the 16 -bit tim er from the last Ca ptur e 0 ri sing edge. When Ca ptur e 0 is i n 16-bi t mod e this
register will be loaded with high-order 8 bits of the 16-bit timer on TCAP0 rising edge
This register holds the value of the Fre e-running Timer when the last falling edge occurred on the TCAP0 inpu t. When Cap ture
0 is in 8-bit mo de , th e b it s t hat are stored here are s ele ct ed by th e Pre sc al e [ 2:0 ] bi t s in the Timer Co nfi guration register. When
Capture 0 is in 16-bit mode this register holds the lower-order 8 bits of the 16-bit timer
This register holds the value of the Free-running Timer when the last falling edge occurred on the TCAP1 input. The bits that
are stored here are s electe d by the Pre scal e [2:0] bit s in the Timer Configuration register. When capture 0 is in 16 -bit mod e this
register holds the high -order 8 b its of the 1 6-bit timer from the las t Capture 0 fa lling edg e. When C apture 0 is in 16-bit mode this
register will be loaded with high-order 8 bits of the 16-bit timer on TCAP0 falling edge
This register holds the low- order byte of the 12-bit program mable interval timer . Reading this register caus es the high-order byte
to be moved into a holding register allowing an automatic read of all 12 bits simultaneously
Document 38-08035 Rev. *EPage 38 of 68
Page 39
CY7C63310
CY7C638xx
CY7C639xx
16.1.8Programmable Interval High Byte
Table 16-8. Programmable Interval Timer High (PITMRH) [0x27] [R/W]
Bit #76543210
FieldReservedProg Interval Timer [11:8]
Read/Write––––R/WR/WR/WR/W
Default00000000
Bit [7:4]: Reserved
Bit [3:0]: Prog Internal Timer [11:8]
This register holds the high-order nib ble of the 12-b it pro gram m abl e inte rva l tim er. Reading this register returns the high-order
nibble of the 12-bit timer at the instant that the low-order byte was last read
Bit #76543210
FieldFirst Edge Hold8-bit Capture Prescale [2:0]Cap0 16bit
Read/WriteR/WR/WR/WR/WR/W–––
Default00000000
Enable
Bit 7: First Edge Hold
The First Edge Hold function applies to all four capture timers.
0 = The time of the most recen t edge is held in th e Capture Timer Data Register . If mul tiple ed ges hav e occu rred sin ce readi ng
the capture timer, the time for the most recent one will be read
1 = The time of the first occurrence of an edge is held in the Capture Timer Data Register until the data is read. Subsequent
edges are ignored until the Capture Timer Data Register is read.
Bit [6:4]: 8-bit Capture Prescale [2:0]
This field controls which 8 bits of the 16 Free Running Timer are captured when in bit mode
0 0 0 = capture timer[7:0]
0 0 1 = capture timer[8:1]
0 1 0 = capture timer[9:2]
0 1 1 = capture timer[10:3]
1 0 0 = capture timer[11:4]
1 0 1 = capture timer[12:5]
1 1 0 = capture timer[13:6]
1 1 1 = capture timer[14:7]
Bit 3: Cap0 16-bit Enable
0 = Capture 0 16-bit mode is disabled
1 = Capture 0 16-b it mode is enabled. C apture 1 is disable d and the Capture 1 r ising and falling reg isters are used as an e xtension
to the Capture 0 registers—extending them to 16 bits
Bit [2:0]: Reserved
0 = Disable the capture 1 falling edge interrupt
1 = Enable the capture 1 falling edge interrupt
Bit 2: Cap1 Rise Enable
0 = Disable the capture 1 rising edge interrupt
1 = Enable t he capture 1 rising edge interrupt
Bit 1: Cap0 Fall Enable
0 = Disable the capture 0 falling edge interrupt
1 = Enable the capture 0 falling edge interrupt
Bit 0: Cap0 Rise Enable
0 = Disable the capture 0 rising edge interrupt
1 = Enable t he capture 0 rising edge interrupt
Cap0 Rise
Enable
Document 38-08035 Rev. *EPage 40 of 68
Page 41
CY7C63310
CY7C638xx
CY7C639xx
16.1.13 Capture Interrupt Status
Table 16-13. Capture Interrupt Status (TCAPINTS) [0x2C] [R/W]
Bit #76543210
FieldReservedCap1 Fall
Read/Write––––R/WR/WR/WR/W
Default00000000
Active
Bit [7:4]: Reserved
Bit 3: Cap1 Fall Active
0 = No event
1 = A falling edge has occurred on Cap1
Bit 2: Cap1 Rise Active
0 = No event
1 = A rising edge has occurred on Cap1
Bit 1: Cap0 Fall Active
0 = No event
1 = A falling edge has occurred on Cap0
Bit 0: Cap0 Rise Active
0 = No event
1 = A rising edge has occurred on Cap0
Cap1 Rise
Active
Cap0 Fall
Active
Cap0 Rise
Active
17.0 Interrupt Controller
The interrupt controller and its associated registers allow the
user’s code to respond to an interrupt from almost every
functional block in the enCoRe II devices. The registers
associated with the interrupt controller allow interrupts to be
disabled either globally or individually. The registers also
provide a mechanism by which a user may clear all pending
and posted interrupts, or clear individual posted or pending
interrupts.
The following t abl e lis ts all interru pts and the p rio rities th at are
available in the enCoRe II devices.
170044h16-bit Free Running Timer Wrap
180048hINT2
19004ChPS2 Data Low
200050hGPIO Port 2
210054hGPIO Port 3
220058hGPIO Port 4
23005ChReserved
240060hReserved
250064hSleep Timer
17.1Archi tect ural Desc rip tio n
An interrupt is posted when its interrupt conditions occur. This
results in the flip-flop in Figure 17-1 clocking in a ‘1’. The
interrupt will remain posted until the interrupt is taken or until
it is cleared by writing to the appropriate INT_CLRx register.
A posted interrupt is not p ending unless i t is enabled by setti ng
its interrupt mask bit (in the appropriate INT_MSKx register).
All pending interrup ts are proces sed by the Prio rity Encoder to
determine the highest priority interrupt which will be 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 being posted. It simply
prevents a posted interrupt from becoming pending.
Nested interrupts can be accomplished by re-enabling interrupts inside an interrupt service routine. To do this, set the IE
bit in the Flag Register.
A block diagram of the enCoR e II Interrupt Control ler is shown
in Figure 17-1.
Document 38-08035 Rev. *EPage 41 of 68
Page 42
CY7C63310
CY7C638xx
CY7C639xx
Interrupt Taken
or
INT_CLRx Write
Posted
Interrupt
DRQ1
Interrupt
Source
(Timer,
GPIO, etc.)
INT_MSKx
M ask Bi t Se tting
Figure 17-1. Interrupt Controller Block Diagram
Pending
Interrupt
17.2Interrupt Processing
The sequence of e vents that occ ur during inte rrupt processi ng
is as follows:
1. An interrupt becomes active, either because:
a. The interrupt condition occurs (e.g., a timer expires)
b. A previously posted interrupt is enabled through an up-
date of an interrupt mask register
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 in terrupt is dispatched, ta king 13 cycles. During
this time, the following actions occur: he MSB and LSB of
Program Counter and Flag registers (CPU_PC and
CPU_F) are stored on to the program sta ck by an automati c
CALL instruction (13 cy cles) generated duri ng the interrupt
acknowledge proces s.
a. The PCH, PCL, and Flag register (CPU_F) are stored
onto the program stack (in that order) by an automatic
CALL instruction (13 cy cles ) generate d during the interrupt acknowledge proces s
b. The CPU_F register is then cleared. Sin ce this clears the
GIE bit to 0, additional interrupts are temporarily dis-
abled
c. The PCH (PC[15:8]) is cleared to zero
d. The interrupt v ec tor is re ad from th e i nte rrupt c ontroller
and its value placed into PCL (PC[7:0]). This sets the
program counter to point to the appropriate address in
the interrupt table (e.g., 0004h for the POR/LVD inter-
rupt)
4. Program exe cution v ectors to the interru pt t able. Typically,
a LJMP instruction i n the interrupt t able send s execution to
the user’s Interrupt Service Routine (ISR) for this interrupt
5. The ISR executes. Note that interrupts are disabled since
GIE = 0. In the ISR, interrupts ca n be re-enabled if desired
Priority
Encoder
...
Inte r ru p t Ve cto r
Interrupt
Request
M8C Co re
...
CPU_F[0]
GIE
by setting GIE = 1 (care must be taken to avoid stack
overflow).
6. The ISR ends with a RETI instruction which restores the
Program Counter and Flag registers (CPU_PC and
CPU_F). The restored Flag register re-enables interrupts,
since GIE = 1 again.
7. Execution resumes at the next instruc tion, after the one tha t
occurred before the interrupt. However, if there are more
pending interrupts, the subsequent interrupts will be
processed before the next normal program instruction.
17.3Interrupt Latency
The time between the assertion of an enabled interrup t and the
start of its ISR can be calculated from the following equation.
Latency = Time for current instruction to finish + Time for
internal interrupt routine to execute + Time for LJMP
instruction in interrupt table to execute.
For example, if the 5-cycl e JMP instruc tion is executing when
an interrupt becomes active, the total number of CPU clock
cycles before the ISR begins would be as follows:
(1 to 5 cycles for JMP to finish) + (13 cycles for interrupt
routine) + (7 cycles for LJMP) = 21 to 25 cycles.
In the example abo ve , at 2 4 M H z, 2 5 c loc k c yc le s t a ke 1.042
ms.
17.4Interrupt Registers
17.4.1I nter rupt C lea r Regist er
The Interrupt Clear Regist ers (INT_ C LRx) are used to enab le
the individual interrupt sources’ ability to clear posted interrupts.
When an INT_CLRx register is read, any bits that are set
indicates an interrupt has been posted for that hardware
resource. Therefore , reading these regi sters gives the user t he
ability to determine all posted interrupts.
Bit #76543210
FieldGPIO Port 1Sleep TimerINT1GPIO Port 0SPI ReceiveSPI TransmitINT0POR/LVD
Read/WriteR/WR/WR/WR/WR/WR/WR/WR/W
Default00000000
When reading this register,
0 = There’s no posted interrupt for the corresponding hardware
1 = Posted interrupt for the corresponding hardware present
Writing a ‘0’ to the bits will clear the posted interrupts f or the corresponding hardware. Writi ng a ‘1’ to the bits AND to the ENSWINT
(Bit 7 of the INT_MSK3 Register) will post the corresponding hardware interrupt
When reading this register,
0 = There’s no posted interrupt for the corresponding hardware
1 = Posted interrupt for the corresponding hardware present
Writing a ‘0’ to the bits will clear the posted interrupts f or the corresponding hardware. Writi ng a ‘1’ to the bits AND to the ENSWINT
(Bit 7 of the INT_MSK3 Register) will post the corresponding hardware interrupt
Bit #76543210
FieldReservedGPIO Port 4GPIO Port 3GPIO Port 2PS/2 Data LowINT216-bit Counter
Read/WriteR/WR/WR/WR/WR/WR/WR/WR/W
Default00000000
Wrap
TCAP1
When reading this register,
0 = There’s no posted interrupt for the corresponding hardware
1 = Posted interrupt for the corresponding hardware present
Writing a ‘0’ to the bits will clear the posted interrupts f or the corresponding hardware. Writi ng a ‘1’ to the bits AND to the ENSWINT
(Bit 7 of the INT_MSK3 Register) will post the corresponding hardware interrupt
17.4.2Interrupt Mask Registers
The Interrupt Mas k Regi sters (I NT_M SKx) are us ed to e nable
the individual inter rupt sourc es’ abi lity to cre ate pendi ng interrupts.
There are four Interrupt Mask Registers (INT_MSK0,
INT_MSK1, INT_MSK2, and INT_MSK3) which may be
referred to in general as INT_MSKx. If cleared, each bit in an
INT_MSKx register pre vents a post ed interrupt from be coming
a pending interrup t (input to the priority enco der). However , an
interrupt can still post even if its mask bit is zero. All INT_MSKx
bits are independent of all other INT_MSKx bits.
If an INT_MSKx bit is set, the interru pt sour ce ass ociat ed with
that mask bit may generate an interrupt that will become a
The Enable Software Interrup t (ENSWINT) bit in INT_MSK3[7]
determines the way an individual bit value written to an
INT_CLRx register is interpreted. When is cleared, writing 1's
to an INT_CLRx regi ster ha s no ef fec t. Ho wever, writing 0's to
an INT_CLRx register, when ENSWINT is cleared, will cause
the corresponding interrupt to clear. If the ENSWINT bit is set,
any 0s written to the INT_CLRx registers are ignored.
However, 1s written to an INT_CLRx register , while ENSWINT
is set, will cause an interrupt to post for the corresponding
interrupt.
Software interrupts can aid in debugging interrupt service
routines by eliminating the need to create system level interactions that are sometimes necessary to create a hardwareonly interrupt.
pending interrupt.
Document 38-08035 Rev. *EPage 43 of 68
Page 44
CY7C63310
CY7C638xx
CY7C639xx
Table 17-5. Interrup t Mask 3 (INT_MSK3) [0xDE] [R/W]
Bit #76543210
FieldENSWINTReserved
Read/WriteR/W–––––––
Default00000000
Bit 7: Enable Software Interrupt (ENS WINT)
0= Disable. Writing 0s to an INT_CLRx register, when ENSWINT is cleared, will cause the corresponding interrupt to clear
1= Enable. Writing 1s to an INT_CLRx register, when ENSWINT is set, will cause the corresponding interrupt to post.
Bit [6:0]: Reserved
Table 17-6. Interrup t Mask 2 (INT_MSK2) [0xDF] [R/W]
Bit #76543210
FieldReserv edGPIO Port 4
Read/Write–R/WR/WR/WR/WR/WR/WR/W
Default00000000
Int Enable
Bit 7: Reserved
Bit 6: GPIO Port 4 Interrupt Enable
0 = Mask GPIO Port 4 interrupt
1 = Unmask GPIO Port 4 interrupt
Bit 5: GPIO Port 3 Interrupt Enable
0 = Mask GPIO Port 3 interrupt
1 = Unmask GPIO Port 3 interrupt
Bit 4: GPIO Port 2 Interrupt Enable
0 = Mask GPIO Port 2 interrupt
1 = Unmask GPIO Port 2 interrupt
Bit 3: PS/2 Data Low Interrupt Enable
0 = Mask PS/2 Data Low interrupt
1 = Unmask PS/2 Data Low interrupt
Bit 2: INT2 Interrupt Enable
0 = Mask INT2 interrupt
1 = Unmask INT2 interrupt
Bit 1: 16-bit Counter Wrap Interrupt Enable
0 = Mask 16-bit Counter Wrap interrupt
1 = Unmask 16-bit Counter Wrap interrupt
Bit 0: TCAP1 Interrupt Enable
0 = Mask TCAP1 interrupt
1 = Unmask TCAP1 interrupt
GPIO Port 3
Int Enable
GPIO Port 2
Int Enable
PS/2 Data Low
Int Enable
INT2
Int Enable
16-bit Counter
Wrap Int Enable
TCAP1
Int Enable
Document 38-08035 Rev. *EPage 44 of 68
Page 45
CY7C63310
CY7C638xx
CY7C639xx
Table 17-7. Interrup t Mask 1 (INT_MSK1) [0xE0] [R/W]
Bit #76543210
FieldTCAP0
Read/WriteR/WR/WR/WR/WR/WR/WR/WR/W
Default00000000
Int Enable
Bit 7: TCAP0 Interrupt Enable
0 = Mask TCAP0 interrupt
1 = Unmask TCAP0 interrupt
Bit 6: Prog Interval Timer Interrupt Enable
0 = Mask Prog Interval Timer interrupt
1 = Unmask Prog Interval Timer interrupt
Bit 5: 1-ms Timer Interrupt Enable
0 = Mask 1-ms interrupt
1 = Unmask 1-ms interrupt
Bit 4: USB Active Interrupt Enable
0 = Mask USB Active interrupt
1 = Unmask USB Active interrupt
Bit 3: USB Reset Interrupt Enable
0 = Mask USB Reset interrupt
1 = Unmask USB Reset interrupt
Bit 2: USB EP2 Interrupt Enable
0 = Mask EP2 interrupt
1 = Unmask EP2 interrupt
Bit 1: USB EP1 Interrupt Enable
0 = Mask EP1 interrupt
1 = Unmask EP1 interrupt
Bit 0: USB EP0 Interrupt Enable
0 = Mask EP0 interrupt
1 = Unmask EP0 interrupt
The Interrupt V ecto r Clear Reg ister (INT_VC ) holds th e interrupt vector for t he highes t priority pending i nterrupt when read, and
when written will clear all pending interrupts
Bit [7:0]: Pending Interrupt [7:0]
8-bit data value holds the interrupt vector for the highest priority pending interrupt. Writing to this register will clear all pending
interrupts.
18.0 USB/PS2 Transceiver
Although the USB transceiver has features to assist in interfacing to PS/2 these features are not controlled using these
registers. These registers only control the USB interfacing
features. PS/2 interfac ing options are con trolled by the D+/D–
GPIO Configuration register (See Section Table 14.2.15).
18.1USB Transceiver Configuration
Table 18-1. USB Transceiver Configure Register (USBXCR) [0x74] [R/W]
Bit #76543210
FieldUSB Pull-up
Read/WriteR/W––––––R/W
Default00000000
Enable
ReservedUSB Force State
Bit 7: USB Pull-up Enable
0 = Disable the pull-up resistor on D–
1 = Enable the pull-up resistor on D–. This pull-up is to VCC IF VREG is not enabled or to the internally generated 3.3V when
VREG is enabled
Bit [6:1]: Reserved
Bit 0: USB Force State
This bit allows the state of the USB I/O pins D- and D+ to be forced to a state while USB is enabled
0 = Disable USB Force State
1 = Enable USB Force State. Allows the D- and D+ pins to be controlled by P1.1 and P1.0 respectively when the USBIO is in
USB mode. Refer to Section 14.2.15 for more information
Document 38-08035 Rev. *EPage 46 of 68
Page 47
CY7C63310
CY7C638xx
CY7C639xx
19.0 USB Regulator Output
19.1VREG Control
Table 19-1. VREG Control Register (VREGCR) [0x73] [R/W]
Bit #76543210
FieldReservedKeep AliveVREG Enable
Read/Write––––––R/WR/W
Default00000000
Bit [7:2]: Reserved
Bit 1: Keep Alive
Keep Alive when set allows the voltage regulator to source up to 20µA of current when voltage regulator is disabled,
P12CR[0],P12CR[7] should be cleared.
0 = Disabled
1 = Enabled
Bit 0: VREG Enable
This bit turns on the 3.3V voltage regulator. The voltage regulator only functions within specifications when V
This block should not be enabled when V
0 = Disable the 3.3V voltage regulator output on the VREG/P1.2 pin
1 = Enable t he 3.3V voltage regulator output on the VREG/P1.2 pin. GPIO functionality of P1.2 is disabled
Note: Use of the alternate drive on pins P1.3–P1.6 requires that the VREG Enable bit be set to enable the regulator and pro-
vide the alternate voltage
is below 4.35V—although no damage or irregularities will occur if it is enabled below 4.35V
CC
is above 4.35V.
CC
20.0 USB Serial Interface Engine (SIE)
The SIE allows the microcontroller to communicate with the
USB host at low-speed data rates (1.5 Mbps). The SIE
simplifies the interface between the microcontroller and USB
by incorporating hard ware that han dles the f ollowin g USB bus
activity independently of the microcontroller:
• Trans late the encoded re ceived data an d format the data to
be transmitted on the bus.
• CRC checking and generation. Flag the microcontroller if
errors exist during transmission.
• Address checking. Ignore the transactions not addressed
to the device.
• Send appropriate ACK/NAK/STALL handshakes.
• Token type identification (SETUP, IN, or OUT). Set the
appropriate token bit once a valid token is received.
• Place valid receive d data in the appropriate endpoint FIFOs.
• Send and update the data toggle bit (Data1/0).
• Bit stuffing/unstuffing.
Firmware is required to handle the rest of the USB interface
with the following tasks:
• Coordinate enum eration by decoding U SB device requests.
• Fill and empty the FIFOs.
• Suspend/Resume coordination.
• Verify and select Data toggle values.
Document 38-08035 Rev. *EPage 47 of 68
Page 48
CY7C63310
CY7C638xx
CY7C639xx
21.0 USB Device
21.1USB Device Addr ess
Table 21-1. USB Device Address (USBCR) [0x40] [R/W]
Bit #76543210
FieldUSB EnableDevice Address[6:0]
Read/WriteR/WR/WR/WR/WR/WR/WR/WR/W
Default00000000
The conten t of this register is cleared when a USB Bus Reset condition occurs
Bit 7: USB Enable
This bit must be enabled by firmware befo re the seria l interface engine (SIE) will respond to USB traf fic at the address sp ecified
in Device Address [6:0]. When this bit is cleared, the USB transceiver enters power-down state. User’s firmware should clear
this bit prior to entering sleep mode to save power
0 = Disable USB device address and put the USB transceiver into power-down state
1 = Enable USB device address and put the USB transceiver into normal operating mode
Bit [6:0]: Device Address [6:0]
These bits must be set by firmware during the USB enumeration process (i.e., SetAddress) to the non-zero address assigned
Bit #76543210
FieldData ToggleData ValidReservedByte Count[3:0]
Read/WriteR/WR/WR/WR/WR/WR/WR/WR/W
Default00000000
Bit 7: Data Toggle
This bit selects the DATA packet’s toggle state. For IN transacti ons , fi rmwa re m ust s et t his bi t to the s ele ct the transmitted Data
Toggle. For OUT or SETUP transactions, the hardware sets this bit to the state of the received Data Toggle bit.
0 = DATA0
1 = DATA1
Bit 6: Data Valid
This bit is used for OUT and SETUP tokens only. This bit is cleared to ‘0’ if CRC, bitstuff, or PID errors have occurred. This bit
does not update for some endpoi nt mo de settings
0 = Data is invalid. If enabled, the endpoint interrupt will occur even if invalid data is received
1 = Data is valid
Bit [5:4]: Reserved
Bit [3:0]: Byte Count Bit [3:0]
Byte Count Bits i ndicate the number of da ta byt es in a tran saction: For IN transaction s, firmware lo ads the co unt with the nu mber
of bytes to be transmitted to the host from the en dpoint FIFO. Valid values are 0 to 8 inclusive. For OUT or SETU P transacti ons,
the count is updated by hardware to the number of data bytes r eceived, plus 2 for the CRC bytes. V alid values are 2–10 i nclusive.
For Endpoint 0 Count Register, whenever the count updates from a SETUP or OUT transaction, the count register locks and
cannot be written by the CPU. Reading the register unlocks it. This prevents firmware from overwriting a status update on it.
Document 38-08035 Rev. *EPage 48 of 68
Page 49
CY7C63310
CY7C638xx
CY7C639xx
21.3Endpoint 0 Mode
Because both firmware and the SIE are allow ed to write to the
Endpoint 0 Mode and Count Registers the SIE provides an
interlocking mechanism to prevent accidental overwriting of
When the SIE writes to these regist ers they are locked and the
processor cannot write to them until after it has read them.
Writing to this register clears the upper four bits regardless of
the value written.
Bit 7: SETUP Received
This bit is set by hardware when a valid SETUP packet is received. It is forced HIGH from the start of the data packet phase of
the SETUP transactions until the end of the data phase of a control write transfer and cannot be cleared during this interval.
While this bit is set to ‘1’, the CPU cannot write to the EP0 FIFO. This prevents firmware from overwriting an incoming SETUP
transaction before firmware has a chance to read the SETUP data.
This bit is cleared by any non-locked writes to the register.
0 = No SETUP received
1 = SETUP received
Bit 6: IN Received
This bit when set indica tes a valid IN pa cket has be en receiv ed. This bit is upd ated to ‘1’ af ter the host ack nowledges an IN data
packet.When clear, it indicates either no IN has been received or that the host didn’t acknowledge the IN data by sending ACK
handshake.
This bit is cleared by any non-locked writes to the register.
0 = No IN received
1 = IN received
Bit 5: OUT Received
This bit when set indicates a valid OUT packet has been received and ACKed. This bit is updated to ‘1’ after the last received
packet in an OUT transaction. When clear, it indicates no OUT received.
This bit is cleared by any non-locked writes to the register.
0 = No OUT received
1 = OUT received
Bit 4: ACK’d Transaction
The ACK’d transaction bi t is set w henever th e SIE engag es in a t ransaction to the regis ter’s endpoint that com pletes with a ACK
packet.
This bit is cleared by any non-locked writes to the register
1 = The transaction completes with an ACK
0 = The transaction does not complete with an ACK
Bit [3:0]: Mode [3:0]
The endpoint modes determine how the SIE responds to USB traffic that the host sends to the endpoint. The mode controls
how the USB SIE responds to t raf fic and how the USB SIE will ch ange the mode of that endpoint as a result of host packets to
the endpoint.
Bit #76543210
FieldStallReservedNAK Int EnableACK’d
Read/WriteR/WR/WR/WR/C (Note 4)R/WR/WR/WR/W
Default00000000
Transaction
Bit 7: Stall
When this bit is set the SIE will stall an OUT packet if the Mode Bits are set to ACK-OUT, and the SIE will stall an IN packet if
the mode bits are set to ACK-IN. This bit must be clear for all other modes
Bit 6: Reserved
Bit 5: NAK Int Enable
This bit when set causes an endpoint interrupt to be generated even when a transfer completes with a NAK. Unlike enCoRe,
enCoRe II family members do not generate an endpoint interrupt under these conditions unless this bit is set
0 = Disable interrupt on NAK’d transactions
1 = Enable interrupt on NAK’d transaction
Bit 4: ACK’d Transaction
The ACK’d transaction bit is set whenever the SIE engages in a transaction to the register’s endpoint that completes with an
ACK packet.
This bit is cleared by any writes to the register
0 = The transaction does not complete with an ACK
1 = The transaction completes with an ACK
Bit [3:0]: Mode [3:0]
The endpoint modes determine how the SIE responds to USB traffic that the host sends to the endpoint. The mode controls how the
USB SIE responds to traffic and how the USB SIE will change the mode of that endpoint as a result of host packets to the endpoint.
Mode[3:0]
21.4.1Endpoint 0, 1, and 2 Data Buffer
Table 21-5. Endpoint 0 Data (EP0DATA) [0x50-0x57] [R/W]
The Endpoint 2 buffer is comprised of 8 bytes located at address 0x60 to 0x67
The three data buffers used to hold data for both IN and OUT
transactions. Each data buffer is 8 bytes long.
Unlike past enCoRe parts the USB data buffers are only
accessible in the I/O space of the processor.
The reset values of the End point Data Registe rs are unknown.
Document 38-08035 Rev. *EPage 50 of 68
Page 51
CY7C63310
CY7C638xx
CY7C639xx
22.0 USB Mode Tables
ModeEncodingSETUPINOUTComments
DISABLE0000IgnoreIgnoreIgnoreIgnore all USB traffic to this endpoint. Used by Data and
NAK IN/OUT0001AcceptNAKNAKNAK IN and OUT token. Control endpoint only
STA TUS OUT ONL Y0010AcceptSTALLCheckSTALL IN and ACK zero byte OUT . Control endpoint only
STALL IN/OUT0011AcceptSTALLSTALLSTALL IN and OUT token. Control endpoint only
STATUS IN ONLY0110AcceptTX0 byteSTALLSTALL OUT and send zero byte data for IN token. Con-
ACK OUT – ST ATUS
ACK O UT (STALL = 0)1001IgnoreIgnoreACKThis mode is changed by the SIE to mode 1000 on is-
ACK OUT (ST ALL = 1)1001Ignore IgnoreSTALLSTALL the OUT transfer
ACK IN (STALL = 0)1101IgnoreTX CountIgnoreThis mode is changed by the SIE to mode 1100 after
ACK IN (STALL = 1)1101IgnoreSTALLIgnoreSTALL the IN transfer. Data endpoint only
IN
ACK IN – STATUS
OUT
NAK OUT1000IgnoreIgnoreNAKSend NAK handshake to OUT token. Data endpoint only
NAK IN1100IgnoreNAKIgnoreSend NAK handshake for IN token. Data endpoint only
1011AcceptTX0 byteACKACK the OUT token or send zero byte data for IN token.
11 1 1AcceptTX CountCheckRespond to IN data or St atus OUT . Control endpoint only
Control endpoints
trol endpoint only
Control endpoint only
suance of ACK handshake to an OUT. Data endpoint
only
receiving ACK handshake to an IN data. Data endpoint
only
Reserved0101 IgnoreI gnoreIgnoreThese modes are not supported by SIE. Firmware
Reserved0111IgnoreIgnoreIgnore
Reserved1010 IgnoreIgnoreIgnore
Reserved0100 IgnoreIgnoreIgnore
Reserved1110IgnoreIgnoreIgnore
Mode Column
The ’Mode’ column contains the mnemonic nam es given to the
modes of the endpoint. The mode of the endpoint is determined by the four-bit binaries in the ’Encoding’ column as
discussed below . The S t atus IN and S tatu s OUT represent the
status IN or OUT stage of the control transfer.
Encoding Column
The contents of the ’Encoding’ column represent the Mode Bits
[3:0] of the Endpoint Mode Registers (Table 21-3 andTable 21-4). The endpoint modes determine how the SIE
responds to different tokens that the host sends to the
endpoints. For example, if the Mode Bits [3:0] of the Endpoint
0 Mode Register are set to ’0001’, which is NAK IN/OUT mode,
the SIE will send an ACK handshake in response to SETUP
tokens and NAK any IN or OUT tokens.
SETUP, IN, and OUT Columns
Depending on the mode specified in the ’Encoding’ column,
the ’SETUP’, ’IN’, and ’OUT’ columns contain the SIE’s
responses when the endpoint receives SETUP, IN, and OUT
tokens, respectively.
A ’Check’ in the Out column means that upon receiving an
OUT token the SIE checks to see whether the OUT is of zero
length and has a Data Toggle (Data1/0) of 1. If these conditions are true, the SIE responds with an ACK. If any of the
above condition s is not met, the SIE will respond w it h ei the r a
STALL or Ignore.
A ’TX Count’ entry in the IN column means that the SIE will
transmit the number of bytes specified in the Byte Count Bit
[3:0] of the Endpoint Count Register (Table 21-2) in response
to any IN token.
should not use this mode in Control and Data endpoints
Document 38-08035 Rev. *EPage 51 of 68
Page 52
CY7C63310
CY7C638xx
CY7C639xx
23.0 Details of Mode for Differing Traffic Conditions
Note: In the R/W column,
b = Both Read and Write
r = Read Only
w = Write Only
c = Read/Clear
? = Unknown
d = calibration value. Should not change during normal use
Enable
Toggle
Toggle
Toggle
rcv’d
up Enable
Int Enable
1
Int Enable
Data ValidReservedByte Count[3:0]bbbbbbbb00000000
Data ValidReservedByte Count[3:0]bbbbbbbb00000000
Data ValidReservedByte Count[3:0]bbbbbbbb00000000
IN rcv’dOUT rcv’dACK’d transMode[3:0]ccccbbbb00000000
Ack’d transMode[3:0]b-bcbbbb00000000
Ack’d transMode[3:0]b-bcbbbb00000000
INT1GPIO Port 0SPI
1-ms
USB Active USB ResetUSB EP2USB EP1 USB EP0bbbbbbbb00000000
Timer
GPIO Port 2
3
1-ms
USB Active
Timer
INT1
GPIO Port 0
Timer
Interval
Timer
4
Int Enable
Prog
Interval
Timer
Int Enable
Sleep
Timer
Int Enable
Enable
Enable
GPIO Port
Int Enable
Int Enable
Int Enable
Device Address[6:0]bbbbbbbb00000000
ReservedUSB Force
SPI TransmitINT0POR/LVDbbbbbbbb00000000
Low
SPI
INT216-bit
INT2
Int Enable
USB EP2
Int Enable
SPI Transmit
Int Enable
Int Enable
Int Enable
Int Enable
Receive
PS/2 Data
Low Int
Enable
USB Reset
Int Enable
Receive
Int Enable
Only
Counter
Wrap
16-bit
Counter
Wrap
Int Enable
USB EP1
Int Enable
INT0
Int Enable
USB
Osclock
Disable
Enable
State
TCAP1-bbbbbbb00000000
TCAP1
Int Enable
USB EP0
Int Enable
POR/ LVD
Int Enable
------bb00000000
------bb00000000
b------b00000000
-bbbbbbb00000000
bbbbbbbb00000000
bbbbbbbb00000000
Document 38-08035 Rev. *EPage 55 of 68
Page 56
CY7C63310
CY7C638xx
CY7C639xx
25.0 Absolute Maximum Ratings
Storage Temperature .................................–65°C to +150°C
Ambient Temperature with Power Applied..... –0°C to +70°C
Supply Voltage on VCC Relative to VSS.........–0.5V to +7.0V
DC Input Volt a ge.................................–0.5V to + V
+ 0.5V
CC
DC Voltage Applied to Outputs in
High-Z State....................................... –0.5V to + V
CC
+ 0.5V
26.0 DC Characteristics
Description
Parameter
V
CC1
V
CC2
V
CC3
T
FP
I
CC1
I
CC2
I
SB1
Low-voltage Detect
V
LVD
3.3V Regulator
I
VREG
I
FA
V
REG1
V
REG2
USB Interface
V
ON
V
OFF
V
DI
V
CM
V
SE
C
IN
I
IO
PS/2 Interface
V
OLP
R
PS2
Notes:
5. Keep-alive mode regulator output voltage min. 2.35V, max 3.80V
Operating V olt ageNo USB ac t ivity, CPU spe ed < 12 MHz4.05.25V
Operating VoltageUSB activity, CPU speed < 12 MHz.
and 1 and Pins.............................................................70 mA
Maximum Total Source Output Current into GPIO Pins30 mA
Maximum On-chip Power Dissipation
on any GPIO Pin.........................................................50 mW
Power Dissipation ....................................................300 mW
Static Discharge Voltage .............................................2200V
Latch-up Current ...................................................... 200 mA
ConditionsMin.TypicalMax.UnitGeneral
4.355.25V
2.6814.872V
3.03.6V
< 125 mA (3.3V ± 8%)
3.153.45V
< 25 mA (3.3V ± 4%)
SS
2.83.6V
0.82.5V
40mA
10µA
20µA
Document 38-08035 Rev. *EPage 56 of 68
Page 57
26.0 DC Characteristics (continued)
Description
Parameter
General Purpose I/O Interface
R
UP
V
ICR
V
ICF
V
HC
V
ILTTL
V
IHTTL
V
OL1
V
OL2
V
OL3
V
OH
Pull-up Resistance412KΩ
Input Threshold Voltage Low, CMOS
mode
Input Threshold Voltage Low, CMOS
mode
Input Hysteresis V oltage , CMOS Mode High to low edge3%10%V
Input Low Voltage, TTL ModeI/O-pin Supply = 2.9-3.6V0.8V
Input HIGH Voltage, TTL ModeI/O-pin Supply = 4.0-5.5V2.0V
Output Low Voltage, High Drive
Output Low Voltage, High Drive
Output Low Voltage, Low Drive
Output Hi gh Voltage
[7]
[7]
27.0 AC Characteristics
ConditionsMin.TypicalMax.UnitGeneral
Low to High edge40%65%V
High to Low edge30%55%V
[6]
I
= 50 mA0.8V
[6]
OL1
I
= 25 mA0.4V
OL1
I
= 8 mA0.4V
OL2
IOH = 2 mAVCC –
0.5
CY7C63310
CY7C638xx
CY7C639xx
CC
CC
CC
V
ParameterDescriptionConditionsMin.TypicalMax.Unit
Clock
T
ECLKDC
T
ECLK1
T
ECLK2
External Clock Duty Cycle4 555%
External Clock Frequency
External Clock Frequency
External clock is the source of the
CPUCLK
External clock is not th e source of the
0.187
0
24
24
MHz
MHz
CPUCLK
USB Driver
T
T
T
T
T
V
R1
R2
F1
F2
R
CRS
Transition Rise TimeC
Transition Rise TimeC
Transition Fall TimeC
Transition Fall TimeC
Rise/Fall Time Matching80125%
Output Signal Crossover Voltage1.32.0V
= 200 pF75ns
LOAD
= 600 pF300ns
LOAD
= 200 pF75ns
LOAD
= 600 pF300ns
LOAD
USB Data Timing
T
DRATE
T
DJR1
T
DJR2
T
DEOP
T
EOPR1
T
EOPR2
T
EOPT
T
UDJ1
T
UDJ2
T
LST
Notes:
6. Available only onCY7C639XX
7. Except for pins P1.0, P1.1 in GPIO mode.
Low-speed Data RateAve. Bit Rate (1.5 Mbps ± 1.5%)1.47751.5225Mbps
Receiver Data Jitter ToleranceTo next transition–7575ns
Receiver Data Jitter ToleranceTo pair transition–4545ns
Differential to EOP Transition Skew–40100ns
EOP Width at ReceiverRejects as EOP330ns
EOP Width at ReceiverAccept as EOP675ns
Source EOP Width1.251.5us
Differential Driver JitterTo next transition–9595ns
Differential Driver JitterTo pair transition–9595ns
Width of SE0 during Diff. Transition210ns
SPI Slave Clock Rate2.2MHz
SPI Clock High TimeHigh for CPOL = 0, Low for CPOL = 1125ns
SPI Clock Low TimeLow for CPOL = 0, High for CPOL = 1125ns
Master Data Output Time
Master Data Output Time,
[8]
SCK to data valid–2550ns
Time before leading SCK edge100ns
First bit with CPHA = 0
Master Input Data Set-up time50ns
Master Input Data Hold time50ns
Slave Input Data Set-up Time50ns
Slave Input Data Hold Time50ns
Slave Data Output TimeSCK to data valid100ns
Slave Data Output Time,
Time after SS LOW to data valid100ns
First bit with CPHA = 0
Slave Select Set-up TimeBefore first SCK edge150ns
Slave Select Hold TimeAfter last SCK edge150ns
T
CYC
T
CH
CLOCK
T
CL
Figure 27-1. Clock Timing
90%
T
F
10%
T
D+
V
oh
V
crs
V
ol
−
D
R
90%
10%
Figure 27-2. USB Data Signal Timing
Note:
8. In Master mode first bit is available 0.5 SPICLK cycle before Master clock edge available on the SCLK pin.
Document 38-08035 Rev. *EPage 58 of 68
Page 59
Differential
Data Lines
T
PERIOD
Differential
Data Lines
T
PERIOD
T
JR
Consecutive
Transitions
PERIOD
+ T
JR1
N * T
Paired
Transitions
PERIOD
+ T
N * T
Figure 27-3. Receiver Jitter Tolerance
Crossover
Crossover
Point
Point Extended
CY7C63310
CY7C638xx
CY7C639xx
T
JR1
JR2
T
JR2
Diff. Data to
N * T
SE0 Skew
+ T
PERIOD
DEOP
Source EOP Width: T
Receiver EOP Width: T
EOPT
EOPR1
, T
EOPR2
Figure 27-4. Differential to EOP Transition Skew and EOP Width
PSoC is a trademark of Cypress MicroSy stem s. enCoRe is a tradema rk of Cy press Semic onduc tor Corpora tion. All product an d
company names mentioned in this document are the trademarks of their respective holders.
*E341277See ECNBHACorrected VIH TTL value in DC Characteristics table
Orig. of
ChangeDescription of Change
information to preliminary
Updated with the latest information
Updated Table 9-5, Table 10-4, Table 13-1, Table 17-2, Table 17-4, Table 17-6.
and Table 15-2. Added various updates to the GPIO Section (Section 14.0).
Corrected Table 15-3. Corrected Figure 27-6 and Figure 27-7. Added the 16-pin
PDIP package diagram (Section 29.0).
Introduction section: Last para removed Low-voltage reset. There is no LVR
there is only LVD (Low voltage detect). explained more about LVD and POR.
Changed capture pins from P0.0,P0.1 to P0.5,P0.6.
T able 6-1: Change d table heading (Remove d Mnemonics and made as Re gister
names). Table 9-5: Included #of rows for different flash sizes
Section10-1: Changed CPUCLK selectable options from n=0-5,7,8 to n=0-5,7.
Clocks section: C ha nge d ITMRCLK division to 1,2,3,4. updated the sources to
ITMRCLK, TCAPCLKs. Ment ioned P17 is T TL enabled permanently. Corrected
FRT, PIT data write order. Updated INTCLR,INTMSK registers. in the register
table also. DC spec sheet: changed LVR to LVD included max min programmable trip points based on char data. Updated the 50ma sink pins on 638xx,
639xx. Keep-alive voltage mentioned corresponding to Keep-alive current of
BON
20uA. Included Notes regarding VOL,VOH on P1.0,P1.1 and TMDO spec. AC
Spe cs: T
Section 5: Removed the VREG from the CY7C63310 and CY7C63801.
Removed SCLK and SDATA. Created a separate pinout diagram for the
CY7C63813.
Added the GPIO Block Diagram (Figure 14-1.)
Table 10-5: Changed the Sleep Timer Clock unit from 32 KHz count to Hz
Table 21-1: Added more descriptions to the register
Updated VIL TTL value.
Added footnote to pin description table for D+/D- pins.
Added Typical Values to Low Voltage Detect table.
Corrected Pin label on 16-pin PDIP package.
Corrected minor typos
MDO1
, T
In description column changed Phase to 0.
SDO1
Document 38-08035 Rev. *EPage 68 of 68
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.