6.6.1 Data ........................................................................................................................................................9
6.6.2 Direct .....................................................................................................................................................9
21.3.3 USB Endpoint Int e r ru pts ................... .......... ......... .......... ......... .........................................................35
21.3.4 SPI Inte rru pt .. ......... .......... .................................................................................... .............................35
Table 22-1. USB Register Mode Encoding ......................................................................................37
Table 22-2. Decode table for
Table 22-3
: “Details of Modes for Differing Traffic Conditions” ...3 8
Table 22-3. Details of Modes for Differing Traffic Conditions .......................................................39
4
FOR
FOR
enCoRe™
USB CY7C63722/23
PRELIMINARY
CY7C63742/43
1.0 Features
• enCoRe™ USB - enhanced Component Reduction
—Internal oscillator eli m inates the need for an exte rnal crystal or resonator
—Interface can auto-configure to opera te as PS/2 or USB without the need for external components to switch between
modes (no GPIO pins needed to manage dual mode capability)
—Internal 3.3V regulator for USB pull-up resistor
—Configurable GPIO for real-world interface without external components
• Flexible, cost-effective solution for applications that combine PS/2 and low-speed USB, such as mice, gamepads,
joysticks, and many others.
• USB Specification Complia nce
—Conforms to USB Specification, Version 1.1
—Conforms to USB HID Specification, Version 1.1
—Supports 1 Low-Speed USB device address and 3 data endpoints
—Integrated USB transceiver
—3.3V regulated output for USB pull-up resist or
• 8-bit RISC microcontroller
—Harvard architecture
—6-MHz external ceramic resonator or internal clock mode
—12-MHz internal CPU clock
—Internal memory
—256 bytes of RAM
—6 Kbytes of EPROM (CY7C63722, CY7C63742)
—8 Kbytes of EPROM (CY7C63723, CY7C63743)
—Interface can auto-configure to operate as PS/2 or USB
—No external components for switching between PS/2 and USB modes
—No GPIO pins needed to manage dual mode capability
• I/O ports
—Up to 16 versatile General Purpose I/O (GPIO) pins, individually configurable
—High current drive on any GPIO pin: 50 mA/pin current sink
—Each GPIO pin supports high-impedance i nputs, internal pull-ups, open dr ain outputs or traditional CMOS outputs
—Maskable interrupts on all I/O pins
• SPI serial communication block
—Master or slave operation
—2 Mbit/s transfers
• Four 8-bit Input Capture registers
—Two registers each for two input pins
—Capture timer setting with 5 pre-scaler settings
—Separate registers for rising and falling edge capture
—Simplifies interface to RF inputs f or wir eless applications
• Internal lo w -power wake-up timer during suspend mode
—Periodic wake-up with no external components
• Optional 6-MHz internal oscillator mode
—Allows fast start-up from suspend mode
• Watch dog timer (WDT)
• Low Voltage Reset at 3.75V
• Internal br own-out reset for suspend mode
• Improved output drivers to reduce EMI
• Operating vol tage from 4.0V to 5.5VDC
5
FOR
FOR
enCoRe™
USB CY7C63722/23
PRELIMINARY
• Operating temperature from 0 to 70 degrees Celsius
• CY7C63722/23 available in 18-pin PDIP
• CY7C63742/43 available in 24-pin SOIC, 24-pin PDIP
• Industry standard programmer support
CY7C63742/43
2.0 Functional Overview
2.1
Cypress has re-invented its leadership position in the low-speed USB market with a new family of innovative microcontrollers.
Introducing...
create a new family of low-speed USB microcontrollers that will enable peripheral developers to design new products with a
minimum number of components. At the heart of our
oscillator. By int egrat ing t he osc illato r into our chi p , an e xternal crystal o r resona tor is no longer need ed. We ha ve also integrated
other external components commonly found in low-speed USB applications such as pull-up resistors, wake-up circuitry, and a
3.3V regulator. All of this adds up to a lower system cost.
The CY7C63722/23 and CY7C63742/ 43 are 8-bit RISC One Time Progr ammable (O TP) mic rocontroll ers. The instructi on set has
been optimiz ed specif ical ly f or USB an d PS/ 2 opera tions , al though t he mi crocont roll ers ca n be u sed f or a va riety o f o ther embed ded applications.
The CY7C637xx features up to 16 general purpose I/O (GPIO) pins to support USB, PS/2 and other applications. The I/O pins
are grouped into two ports (Port 0 to 1) where each pin can be i ndividually configured as i nputs with internal pull-ups, open drain
outputs, or tr adit ional CMOS outpu ts with pr og rammab le driv e streng th o f up to 50 mA out put driv e . Addit ional ly, each I/O pin can
be used to gener at e a GPIO inte rrupt to t he mi crocont roll er . Note t he GPI O inter rupts all shar e the s ame “GPIO” int errupt vect or .
The CY7C637xx microcontrollers feature an internal 5% accurate 6-MHz clock source. Optionally, an external 6-MHz ceramic
resonator can be used to provide a highe r precision reference for USB operation. This cloc k generator reduces the clock-related
noise emissions (EMI). The clock generator provides the 6- and 12-MHz clocks that remain internal to the microcontrol ler.
The CY7C637xx is offered with two EPROM options to maximize flexibility and minimize cost. The CY7C637x2 has 6 Kbytes of
EPROM. The CY7 C637x3 has 8 Kbyt es of EPR OM. Al l v ersi ons hav e 2 56 b ytes of dat a RAM f or stac k spac e, u ser v ariab l es, and
USB FIFOs.
These parts include low-voltage reset logic, a watch dog timer, a vectored interrupt controller, a 12-bit free-running timer, and
capture timers. The l ow-voltage reset (LVR) logic detects when power is applied to the device, resets the logic to a known state,
and begins executing instructions at EPROM addres s 0x0000. LVR will also reset the part when V
voltage r ange. The watch dog timer can be used to ensure the firmware never gets stalled for more than approxim ately 8 ms.
The microcontroller supports 10 maskable interrupts in the vectored interrupt controller. Interrupt sources include the USB
Bus-Reset, the 128-µs and 1.024-ms outputs from the free-running timer, three USB endpoints, two capture timers, an internal
wake-up timer and the GPIO ports. The timers bits cause periodic interrupts when enabled. The USB endpoints interrupt after
USB transact ions c omple te on t he b us. Th e captur e ti mers in terrupt whene v er a ne w tim er v alue i s sav ed due to a sel ected GPIO
edge event. The GPIO ports have a level of masking to select which GPIO inputs can cause a GPIO interrupt. For additional
flexibility, the input transition polarity that causes an interrupt is programmable for each GPIO pin. The interrupt polarity can be
either rising or falling edge.
The free-running 12-bit timer clocked at 1 MHz provides two interrupt sources as noted above (128 µs and 1.024 ms ). The timer
can be used to measure the duration of an event under firmware control by reading the timer at the start and end of an event,
and subtracting the two values. The four capture timers save a programmable 8 bit range of t he free-running timer when a GPIO
edge occurs on the two capture pins (P0.0, P0.1).
The CY7C637xx incl udes an int egrat ed USB seri al int erf ace eng in e (SIE) that su pports the int egrat ed p eripher als. The har dwar e
supports one USB device ad dress with t hree endpoin ts. The SIE all ows the USB host to communicat e with the funct ion integr ated
into the microcontroller. A 3.3V regulated output pin provides a pull-up source for t he external USB resistor on the D– pin.
The USB D+ and D– USB pins can alternately be used as PS/2 SCLK and SDATA 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 pull-up resistors on SCLK and
SDATA, the ability to disable the re gulato r output pin, and an interru pt to signal t he start of PS/2 activity. No external components
are necessary fo r dual USB and PS/2 sys tems, and no GPIO pins need to be dedic ated to s witc hing betw een modes . Slo w edge
rates operate in both modes to reduce EMI.
enCoRe
USB - The New USB Standard
enCoRe
USB—“enhanced Componen t Reducti on.” Cy press has leveraged its design e xpertise in USB solutions to
enCoRe
TM
USB technology is the breakthrough design of a crystal-less
drops below the operat ing
CC
6
FOR
FOR
enCoRe™
USB CY7C63722/23
3.0 Logic Block Diagram
Internal
Oscillator
Oscillator
EPROM
6K/8 K B yte
Brown-out
Reset
Watch
Dog
Timer
Low
Voltage
Reset
4.0 Pin Configurations
CY7C63722/23
18-pin PDIP
P0.0
P0.1
P0.2
P0.3
VSS
VPP
VREG
XTALIN/P2.1
PRELIMINARY
Xtal
8-bit
RISC
core
1
2
3
4
5
6
7
8
9
18
17
16
15
14P1.0
13
12
11
10
Wake-Up
Interrupt
Contro ller
Regulator
P0.4
P0.5
P0.6
P0.7
P1.1
D+/SCLK
D–/SDATA
VCC
XTALOUT
Timer
3.3V
VREG
256 Byte
Top View
RAM
USB
Engine
USB &
PS/2
Xcvr
D+,D–
12-bit
Timer
Port 1
GPIO
P1.0–P1.7
CY7C63742/43
24-pin SOIC/PDIP
P0.0
P0.1
P0.2
P0.3
P1.0
P1.2
P1.4
P1.6
VSS
VPP
VREG
XTALIN/P2.1
CY7C63742/43
Capture
Timers
Port 0
GPIO
P0.0–P0.7
24
23
22
21
20
19
18
17
16
15
14
13
P0.4
P0.5
P0.6
P0.7
P1.1
P1.3
P1.5
P1.7
D+/SCLK
D–/SDATA
VCC
XTALOUT
1
2
3
4
5
6
7
8
9
10
11
12
SPI
5.0 Pin Assignments
CY7C63722/23 CY7C63742/43
NameI/O
D–/SDATA,
D+/SCLK
P0[7:0]I/O1, 2, 3, 4,
I/O12
13
15, 16, 17, 18
15
16
1, 2, 3, 4,
21, 22, 23, 24
P1[7:0]I/O5, 145, 6, 7, 8,
17, 18, 19, 20
XTALIN/P2.1IN9126-MHz cerami c resonator or ext ernal clock input, or P2.1 input
XTALOUTOUT10136-MHz cerami c resonator return pin or internal oscillator output
V
PP
V
CC
710Programming v oltage supply, ground for normal oper ati on
1114V olt age supply
VREG/P2.0 811Vo ltage su ppl y for 1.5-kΩ USB pull-up resistor (3.3V nomi nal). Als o
V
SS
69Ground
Description18-Pin24-Pin
USB diff erential data lines (D– and D+), or PS/2 clock and data signals (SDATA and SCLK)
GPIO Po rt 0 capable of sinking up t o 50 mA/pin, or sinking co ntrolled
low or high prog rammable current. Can also source 2 mA current,
provide a res istive pul l-up , or serve as a high impedance input. P0. 0
and P0.1 provi de inputs to Capture Timers A and B, respect ively.
IO Port 0 capable of sinking up to 50 mA/pin, or sinking controlled
low or high prog rammable current. Can also source 2 mA current,
provide a resistive pull-up, or serve as a high impedance input.
serves as P2.0 input.
7
FOR
FOR
enCoRe™
USB CY7C63722/23
PRELIMINARY
CY7C63742/43
6.0 Programming Model
Refer to the
6.1Program Counter (PC)
The 13-bit program counter (PC) allows access for up to 8 Kbytes of EPROM using the CY7C637xx architecture. The program
counter is cleared during res et, such that the first instruction executed after a reset is at ad dress 0x0000. This is typically a jump
instruction to a res et handler that initializes the applicat ion.
The lower 8 bi ts of the progr am counter are incremented as i nstructio ns are loaded and e xecu ted. The upp er 5 bits of the pr ogram
counter are increment ed by executing an XPAGE instruction. As a result, the last instruction executed within a 256-byte “page”
of sequential code should be an XPAGE instruction. The assembler directive “XPAGEON” will ca use the assembler to inser t
XPAGE instructions automatically. As instructions can be either one or two bytes long, the assembler may occasionally need to
insert a NOP followed by an XPAGE for correct execution.
The program counte r of t he ne xt i nstruct ion t o be e x ecut ed, car ry flag, and z er o fla g are sav ed a s two b yt es on the prog ram stack
during an interrupt acknowledge or a CALL instruction. The program counter, carry flag, and zer o flag are restored from the
program stack only during a RETI instructio n.
Please note the program counter cannot be accessed directly by the firmware. The progr am stack can be examined by reading
SRAM from locat ion 0x00 and up.
6.28-bit Accumulator (A)
The accumulator is the general purpose, do everything register in the architecture where results are usually calculated.
6.38-bit Index Register (X)
The inde x r egist er “X” is availabl e to the firmware as an auxiliary accu mulator . The X register also allows the processor to perf orm
indexed operations by loading an index value into X.
CYASM Assembler User’s Guide
for more details on f irmwar e operation with the CY7C637xx mic rocontrollers.
6.48-bit Program Stack Pointer (PSP)
During a reset, the pr ogram stack pointer (PSP) is set to zero. This m eans the program “stack” starts at RAM address 0x00 and
“grows” upward from there . Note the prog ram stac k pointe r is directl y address ab le under firmware control , using the MO V PSP,A
instruction. The PSP supports interrupt service under hardware control and CALL, RET, and RETI instructions under firmware
control.
During an interrupt acknowledge, interrupts are disabled and the program counter, carry flag, and zero flag are written as two
bytes of data memory . The first byte is stor ed in the memory addressed by the progr am stack pointe r, then the PSP is inc remented.
The second b yte is stored in memory addressed by the program stac k pointer and the PSP is incremented again. Th e net effect
is to store the progr am cou nter and flags on the program “stack” and increment the program stack pointer by two.
The return from interrupt (RETI) instruction decrements the program stack pointer, then restores the second byte from memory
addressed by the PSP. The program stack pointer is decremented again and the first byte is restored from memory addressed
by the PSP. Aft er th e prog r am cou nter and flags hav e be en rest ored fr om stac k, the inte rrupts are en ab le d. The eff e ct i s to res tore
the program counter and flags from the program stack, decrement the pr ogram stack pointer by two, and re-enable interrupt s.
The call subr outine (CAL L) instruction s tores the p rogram counter and flags on t he progra m stack and incremen ts the PSP b y two .
The return fr om subr out ine ( RET) ins tructi on re sto res t he prog r am co unter, but not th e fla gs, from pr og ram stac k and decrement s
the PSP by two.
Note that t here ar e rest ricti ons i n us ing some ju mp , cal l, a nd index instructions across the 4KB boundary of the prog ram memory.
Refer to the
CYASM Assembler User’s Guide
for a detailed description.
6.58-bit Data Stack Pointer (DSP)
The data stack pointer (DSP) supports PUSH and POP instructions that use the data stack for temporary storage. A PUSH
instruction wi ll pre- decr ement th e DSP, then write data to t he memory l ocatio n address ed b y the DSP. A POP instruction will rea d
data from the memory location addressed by the DSP, then post-increment the DSP.
During a reset, the Data Stack Poi nter will be set to zero. A PUSH instruction when DSP equal zero will write data at th e to p of
the data RAM (address 0xFF). This would write data to the memory area reserved for a FIFO for USB endpoint 0. In non-USB
applications, this works fine and is not a prob lem.
8
FOR
FOR
enCoRe™
USB CY7C63722/23
PRELIMINARY
For USB appl icati ons, the fi rmware sh ould set the DSP t o an a ppropria te loc ation to av o id a memory conf lict wi th RAM dedicat ed
to USB FIFOs. The memory requirements for the USB endpoints are shown in Section 8.2. For example, assembly instructions
to set the DSP to 20h (giving 32 bytes for program and data stack combined) are shown below:
MOV A,20h; Move 20 hex into Accumulator (must be D8h or le ss to avoid USB FIFOs)
SWAP A,DSP ; swap accumulator value into DSP register
CY7C63742/43
6.6Address Modes
The CY7C637xx microcontrollers support three addressing modes for instructions that require data operands: data, direct, and
indexed.
6.6.1Data
The “Data” address mode ref er s to a da ta operand that i s a ctual ly a con stant encod ed in t he inst ructi on. As an e xa mple, cons ider
the instruction that loads A with the constant 0x30:
• MOV A, 30h
This instruction will require two bytes of code where the first byte identifies the “MOV A” instruction with a data operand as the
second byte. The second byt e of the instruction will be the constant “0xE8h”. A constant may be referred to by name if a prior
“EQU” statement assigns the constant value to the name. For example, the following code is equivalent to the example shown
above:
• DSPINIT: EQU 30h
• MOV A,DSPINIT
6.6.2Direct
“Direct” address mode is used when the data operand is a variable stored in SRAM. In that case, the one byte address of the
variable is encoded in the instruction. As an example, consider an instruction that loads A with the contents of memory address
location 0x10h:
• MOV A, [ 10h]
In normal usage, variable nam es are assigned to var iable addresses using “EQU” statements to improve the readability of the
assembl er source code. As an example, the following code is equivalent to the example shown above:
• buttons: EQU 10h
• MOV A,[buttons]
6.6.3Indexed
“Indexed” address mode allows the firmware to manipulate arrays of data stored in SRAM. The address of the data operand is
the sum of a constant encoded in the instruction and the contents of the “X” register. In normal usage, the constant will be the
“base” address of an array of data and the X register will contain an index that indicates which element of the array is actually
addressed:
• array: EQU 10h
• MOV X,3
• MOV A,[x+array]
This would have the effect of loading A with the fourth element of the SRAM “array” that begins at address 0x10h. The fourth
element would be at add ress 0x13h.
9
FOR
FOR
enCoRe™
USB CY7C63722/23
PRELIMINARY
CY7C63742/43
7.0 Instructio n Set Summary
Refer to the
HALT007NOP204
ADD A,expr data014INC Aacc214
ADD A,[expr] direct026INC Xx224
ADD A,[X+expr] index037INC [expr]direct237
ADC A,exprdata044INC [X+expr]index248
ADC A,[expr]direct056DEC Aacc254
ADC A,[X+expr]index067DEC Xx264
SUB A,exprdata074DEC [expr]direct277
SUB A,[expr]direct086DEC [X+expr]index288
SUB A,[X+expr]index097IORD expraddress295
SBB A,exprdata0A4IOWR expraddress2A5
SBB A,[expr]direct0B6POP A2B4
SBB A,[X+expr]index0C7POP X2C4
OR A, ex prdata0D4PUSH A2D5
OR A,[expr]direct0E6PUSH X2E5
OR A,[X+expr]index0F7SWAP A,X2F4
AND A,exprdata104SWAP A,DSP304
AND A,[expr]direct116MO V [expr],Adirect315
AND A,[X+expr]index127MOV [X+expr],Aindex326
XOR A,exprdata134OR [expr],Adirect337
XOR A,[expr]direct146OR [X+expr],Aindex348
XOR A,[X+expr]index157AND [expr],Adirect357
CMP A,exprdata165AND [X+expr],Aindex368
CMP A,[expr]direct177XOR [expr],Adirect377
CMP A,[X+expr]index188XOR [X+expr],Aindex388
MOV A,exprdata194IOWX [X+expr]index396
MOV A,[ex pr]direct1A5CPL3A4
MOV A,[X+expr]index1B6ASL3B4
MOV X,exprdata1C4ASR3C4
MOV X,[ex pr]direct1D5RLC3D4
13 -bit PC0x0000Program execution begins here after a reset.
CY7C63742/43
0x0002USB Bus Reset interrupt vector
0x0004128-µs timer interrupt vector
0x00061.024-ms timer interrupt vector
0x0008USB endpoint 0 interrupt vector
0x000AUSB endpoint 1 interrupt vecto r
0x000CUSB endpoint 2 interrupt vecto r
0x000ESPI interrupt vector
0x0010Capture timer A interrupt Vector
0x0012Capture timer B interrupt vector
0x0014GPIO inte r r u pt vec tor
0x0016Wake-up i n terrupt vector
0x0018
0x0FFF
0x17FF
0x1FDF8 KB PROM ends here (CY7C63723, CY7C63743)
Program Memory begins here
4 KB
6 KB PROM ends here (CY7C63722, CY7C63742)
(8K - 32 bytes)
Figure 8-1. Program Memory Space with Interrupt Vector Table
11
FOR
FOR
enCoRe™
USB CY7C63722/23
PRELIMINARY
CY7C63742/43
8.2Data Memory Organization
The CY7C637xx microcontrollers provide 256 bytes of data RAM. In normal usage, the SRAM is partitioned into four areas:
program stack, data stack , user variables and USB endpoint FIFOs as shown below:
After re s e tAddress
8-bit D S P8-bit PSP0x00
(Move DSP)
8-bit DSPuser selected
User Var iables
0xE8
USB FIFO for Address A endpoint 2
0xF0
USB FIFO for Address A endpoint 1
Program Stack Gr owth
Data Stack Growth
0xF8
Top of RAM Memory0xFF
USB FIFO for Address A endpoint 0
12
FOR
FOR
enCoRe™
USB CY7C63722/23
PRELIMINARY
CY7C63742/43
8.3I/O Register Summary
I/O registers are accessed via the I/O Read (IORD) and I/O Write ( IOWR, IOWX) instructions. IORD reads the selected port into
the accumulator. IOWR writes data from the accumulator to the selected port. Indexed I/O Write (IOWX) adds the contents of X
to the address in the instruction to form the port address and writes data from the accumulator to the specified port. Note that
specifying address 0 with IOWX (e.g., IOW X 0h) means the I/O port is selected solely by the contents of X.
Note: All bits of all registers are cleared to all zeros on reset,
All registers not listed are reserved, and should never be written by firmware. All bits marked as reserved should always
0xFF).
be written as 0.
Table 8-1. I/O Register Summary
Register NameI/O AddressRead/WriteFunctionFig.
Port 0 Data0x00R/WGPIO Port 012-2
Port 1 Data0x01R/WGPIO Port 112-3
Port 2 Data0x02RAuxiliary input regis ter for D+, D–, VREG, XTALIN 12-8
Port 0 Interrupt Enabl e0x04WInterrupt enable for pins in Port 021-4
Port 1 Interrupt Enabl e0x05WInterrupt enable for pins in Port 121-5
Port 0 Interrupt Polarity 0x06WInterrupt polarity for pins in Port 021-6
Port 1 Interrupt Polarity 0x07WInterrupt polarity for pins in Port 121-7
Port 0 Mode0 0x0AWControls output configuration for Port 012-4
Port 0 Mode10x0BW12-5
Port 1 Mode00x0CWControls output configuration for Port 112-6
Port 1 Mode10x0DW12 -7
USB Device Address0x10R/WUSB Device Address register14-1
EP0 Counter Register0x11R/WUSB Endpoint 0 counter regi ster14-4
EP0 Mode Register0x12R/WUSB Endpoint 0 configuration register14-2
EP1 Counter Register0x13R/WUSB Endpoint 1 counter regi ster14-4
EP1 Mode Register0x14R/WUSB Endpoint 1 configuration register14-3
EP2 Counter Register0x15R/WUSB Endpoint 2 counter regi ster14-4
EP2 Mode Register0x16R/WUSB Endpoint 2 configuration register14-3
USB Status & Control0x1FR/WUSB status and control re gister13-1
Global Interrupt Enable0x20R/WGlobal interrupt enable register21-1
Endpoint Interrupt Enab le0x21R/WUSB endpoint interrupt enables21-2
Timer (LSB)0x24RLower 8 bits of free-running timer (1 MHz)18-1
Timer (MSB)0x25RUpper 4 bits of free-running timer18-2
WDR Clear0x26WWatch Dog Reset clear-
Capture Timer A Rising0x40RRising edge Capture Timer A data register19-2
Capture Timer A Fa ll ing0x41RFalling edge Capture Timer A data register19-3
Capture Timer B Rising0x42RRising edge Capture Timer B data register19-4
Capture Timer B Fa ll ing0x43RFalling edge Capture Timer B data register19-5
Capture TImer Conf iguration0x44R/WCapture Timer configuration register19-6
Capture Timer Status0x45RCapture Timer status register19-7
SPI Data0x60R/WSPI read and write data register17-2
SPI Control0x61R/WSPI status and control register17-3
Clock Configuration0xF8R/WInternal / External Clock configuration register9-2
Processor Status & Control0xFFR/WProcessor status and contr ol20-1
except the Processor Status and Control Register (address
13
FOR
FOR
enCoRe™
USB CY7C63722/23
PRELIMINARY
CY7C63742/43
9.0 Clocking
The chip can be clocked from either the internal on-chip clock, or from an oscillator based on an ex ternal resonator/crystal, as
shown in
Configuration Register,
Figure 9-1
Clk2x (12 MHz)
(to Microcontroller)
. No addit ional capacitan ce is included on chip at the XTALIN/OUT pins. Oper ati on is controlled by the Clock
Figure 9-2
Int Clk Output Disable
Interna l Osc
Ext Clk Enable
Clk1x (6 MHz)
(to USB SIE)
.
Clock
Doubler
XTALOUT
XTALIN
30 pF
Port 2.1
Figure 9-1. Clock Oscillator On-chip Circui t
76543210
R/WR/WR/WR/WR/W-R/WR/W
Ext. Clock
Resume
Delay
All bits of the Clock Configuration Register reset to 0. Reserved bits must always be written as a 0.
Setting External Oscillator Enable (bit 0) high causes the part to switch to external clock mode, as described in Section 9.1. (If
the bit is already set, writing a ‘1’ again has no effect.) Clearing this bit has no immediate effect, although the state of this bit is
used when waking out of suspend mode to select between internal and external clock. When this bit is cleared XTALIN will be
configured as an input with a weak pull down and can be used as a GPIO input (P2.1).
The Internal Clock Output Disable ( bit 1) can be set to 1 to keep the internal clock from driving out to XTALOUT. If set, XTALOUT
will drive hi gh. Thi s bit has no effect when the external oscillator is enabled.
The Precisi on USB Clocking Enabl e (bit 2) only affects operation in Internal Oscillator M ode. In that mode, this bit mus t be set to
1 to cause t he internal c lo ck t o a utomati call y preci se ly tu ne to USB t iming r equir ement s (6 M Hz ±1. 5%). The f requ ency m ay ha v e
a looser initia l to lerance at power-up, but all USB transmissions from the chip wil l meet the USB specification.
The Low Voltage Reset Disable (bit 3) disables the LVR circuit when set to 1. See Section 10.1.
The Wake-up Timer Adjust Bits (bit s 6:4) are used to adjust the Wake-up timer period, as descri bed in Section 11.2.
The Resume Delay (bit 7) selects the delay time when switching to the external oscillator, or when waking from suspend mode
with the e xternal oscil lator enab led. The del ay is 128 µs when this bit is 0, and 4 ms when this bit is 1. The sho rter time is adequat e
for operation with ceramic re sonators, while the long er ti m e is preferred for start-up with a crystal. (These times
an initial osci llator st art-up time which depends on t he resonatin g element. This ti me is typicall y 50–100 µs for ce ramic r esonators
and 1–10 ms for crystals). When waking from suspend mode with the internal osci llator , t he delay time is only 8 µs in addition to
a delay of appr oximately 1 µs for the oscillator to start.
The internal oscillator provi des an operating clock, factory set to a nominal frequency of 6 MHz. This clock requires no external
components . At power-up, the chip operates from the internal c lock. In this mode, t he internal clock is b uffered and driven to the
XTALOUT pin by default, and the state of the XTALIN Pin can be read at Port 2.1. While the internal clock is enabled, its output
can be disable d at the XTALOUT pin by setting the Internal Clock Output Disable bit of the Clock Confi guration Register.
Setting bit 0 o f the Cl oc k Confi gura tion Reg ister disab l es the i nternal cloc k, and ha lts t he pa rt while the e x ternal resona tor/crystal
oscillator is started. The steps involved in switching from Internal to External Cloc k m ode are as follows:
1. At reset, chip begins operation using the internal clock.
2. Firmware sets Bit 0 of the Clock Configuration Register. For example,
mov A, 1h ; Set Bit 0 (External Oscillator Enable); bit 7 cleared gives fas ter start-up
iowr F8h; Write to Clock Configuration Register
3. Internal clocking is halted, the internal oscillator is disabled, and the external cloc k oscillator is enabled.
4. After the e xternal cloc k bec omes sta ble , ch ip cloc ks are re -enab le d using the e xternal cloc k signal . (Note t hat the tim e for the
external cl ock to become stable depends on the external resonating device; see next section.)
5. After an addition al del ay the CPU i s released to run. This delay depends on the state of the Ext. Clock Resum e Delay bit of
the Clock Configuration Register. The time is 128 µs if the bit is 0, or 4 ms if the bit is 1.
6. Once the chip ha s been set to ext ernal oscill ator , it can only retu rn to internal cloc k when wak ing from sus pend mode. Clearing
bit 0 of the Clock Conf iguration Register will not re-enable internal clock mode until suspend mode is ent ered. See Section
11.0 for more details on suspend mode oper ation.
If the Internal Clock is enabled, the XTALIN pin can serve as a general purpose input, and its state can be read at Port 2, Bit 1
(P2.1) . Refer to
cannot provi de an interrupt source to the CPU .
Figure 12-8
for the Port 2 data register. In this mode, there is a weak pull-down at the XTALIN pin. This input
9.2External Oscillator
The user can connect a l ow-cost ceramic re sonator or an external osci ll ator to the XTALIN / XTALOUT pins to provi de a precise
reference frequency for the chip clock, as shown in
crystal with external capacitors. To run from the external resonator, Bit 0 o f the Clock Conf iguration Register must be set to 1, as
explained in the previous section.
Start up times for the external oscillator depend on the resonating device. Ceramic resonator based oscillators typically start in
less than 100 µs, while cryst al based oscillators take l onger, typically 1 to 10 ms. Board capacitance s hould be minimized on the
XTALIN and XTALOUT pins by keeping the traces as short as possible.
An external 6 MHz cloc k can be appli ed to the XTALIN pin if the XTALOUT pin is left open.
Figure 9-1
. The ext ernal components required are a ceramic resonator or
10.0 Reset
The USB Controller supports three ty pes of resets. The effects of the reset are listed below. The reset types are:
1. Low Voltage Reset (L VR)
2. B rown Out Res e t (B O R)
3. Watch Dog Reset (WDR)
The occurrence of a reset is recorded in the Processor Status and Control Register (see
record the occurrence of LVR/BOR and WDR respectivel y. The firmware can interrogate these bits to determine the cause of a
reset.
The microcont roller begi ns e xecut ion fro m ROM addr ess 0x00 00 after a LVR, BOR or WDR reset. A lthough t his looks lik e interrupt
vector 0, there is an important difference. Reset processing does NOT push the program counter, carry flag, and zero flag onto
program stack. Attempting to execute either a RET or RETI in the reset handler will cause unpredictable execution results.
The foll owing eve nts take place on reset. More det ails on the various resets are given in the following sections.
1. All registers are reset to their default st ates (all bits cleared, except in Processor Status and Control Register).
2. GPIO and USB pins are set to high-impedance state.
3. The VREG pin is set to high-impe dance state.
4. Interrupts are disabled.
5. USB operation is disabled and must be enabl ed by fi rmware if desired, as explained in Section 14.1 .
6. For a BOR or LVR, the external oscil lator is disab led and Internal Clo ck mode is acti vated, follo wed by a t ime-out period t
for V
to stabilize . A WDR does not change the cloc k mode , and there is no dela y for VCC stabilizati on on a WDR. Note that
CC
Figure 20-1
). Bits 4 and 6 are used to
START
15
Loading...
+ 33 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.