5.6.1 Data (Immediate ) ............................................................................................................................20
5.6.2 Direct ...... ........................................................................................................................................20
• Hardware-assisted Parallel Interface (HAPI) for data transfer to external devices
•I/O ports
—Three GPIO ports (Port 0 to 2) capable of sinking 8 mA per pin (typical)
—An additional GPIO port (Port 3) capable of sinking 12 mA per pin (typical) for high current requirements: LEDs
—Higher current drive achievable by connectin g multiple GPIO pins together to drive a common output
—Each GPIO port can be configured as inputs with inter nal pull-ups or open drain output s or traditional CMOS output s
—A Digital-to-Analog Conversion (DAC) port with programmable current sink output s is available on the CY7C661 13C
device
—Maskable interrupts on all I/O pins
• 12-bit free-runni ng ti me r wit h one microsecond clock ticks
• Watchdog T imer (WDT)
• Internal Power-on Reset (POR)
• USB Specification compliance
—Conforms to USB Specification, Version 1.1
—Conforms to USB HID Specification, Version 1.1
—Supports one or two device addresses with up to five user-configured endpoints
• Up to two 8-byte control endpoi nts
• Up to four 8-byte data endpoints
• Up to two 32-byte data end points
—Integrated USB transceivers
—Supports four downstream USB ports
—GPIO pins can provide individual power control outputs for each downstream USB port
—GPIO pins can provide indivi dual port over current inputs for each downstream USB port
• Improved output drive rs to reduce electromagnetic inte rference (EMI)
• Operating voltage from 4.0V–5.5V DC
• Operating temperature from 0°–70°C
• CY7C66013C available in 48-pin SSOP (-PVC) packages
• CY7C66113C available in 56-pin QFN or 56-pin SSOP (-PVC) packages
• Industry-standard programmer support
C-compatible controller (100 kHz) enabled through General-purpose I/O (GPIO) pins
Document #: 38-08024 Rev. *BPage 6 of 61
C
C
CY7C66013
CY7C66113
2.0 Functional Overview
The CY7C66013C and CY7C66113C are compound devices with a full-speed USB microcontroller in combination with a USB
hub. Each device is well-suited for combination peripheral functions with hubs, such as a keyboard hub function. The eight-bit
one-time-programm able microcontroller with a 12-Mbps USB Hub supports as many as four downstream ports.
2.1GPIO
The CY7C66013C feat ures 29 G PIO pins t o support USB and other applic ations. The I /O pins are grouped into fo ur port s (P0[7:0 ],
P1[7:0], P2[7:0], P3[4:0]) where each port can be configured as inputs with internal pull-ups, open drain outputs, or traditional
CMOS outputs. Ports 0 to 2 are rated at 8 mA per pin (typical) sink current. Port 3 pins are rated at 12 mA per pin (typical) sink
current, which allows these pins to drive LEDs. Multiple GPIO pins can be connected together to drive a single output for more
drive curre nt capacity. Additional ly, each I/O pin can be used to generate a GPIO interrupt to the m icrocontroller. All of the GPIO
interrupts all share the same “GPIO” interrupt vector.
The CY7C66113C has 31 GPIO pins (P0[7:0], P1[7:0], P2[7:0], P3[6:0]).
2.2DAC
The CY7C66113C has an additional port P4[7:0] that features an additional eight programmable sink current I/O pins (DAC).
Every DAC pin includes an integrated 14-kΩ pull-up resistor. When a ‘1’ is written to a DAC I/O pin, the output current sink is
disabled and the output pin is driven HIGH by the internal pull-up resistor. When a ‘0’ is written to a DAC I/O pin, the internal
pull-up is disabled and the output pin provides the programmed amount of sink current. A DAC I/O pin can be used as an input
with an internal pull- up by wri ting a ‘1’ to the pin.
The sink current for each DAC I/O pin can be individually programmed to one of sixteen values using dedicated Isink registers.
DAC bits DAC[1:0] can be used as high current outputs with a programmable sink current range of 3.2 to 16 mA (typical). DAC
bits DAC[7:2] have a programmable current sink range of 0.2 to 1.0 mA (typical). Multiple DAC pins can be connected together
to drive a single output that requires more sink current capacity. Each I/O pin can be used to generate a DAC interrupt to the
microcontroller. Also, the int errupt polarity for each DAC I/O pin is indi vidually programmable.
2.3Clock
The microcontroller uses an external 6-MHz crystal and an internal oscillator to provide a reference to an internal PLL-based
clock generator. This technology all ows the customer application to use an inexpensive 6-MH z fundamental crystal that r educes
the clock-related noise emissions (EMI). A PLL clock generator provides the 6-, 12-, and 48-MHz clock signals for distribution
within the microcont roller.
2.4Memory
The CY7C66013C and CY7C66113C have 8 KB of PROM.
2.5Power-on Reset, Watchdog, and Free-running Timer
These parts include POR logic, a WDT, and a 12-bit free-running timer. The POR logic detects when power is applied to the
device, rese ts the l ogic to a known sta te, and begins exec uting in structions at PROM addre ss 0x0000 . The WDT is us ed to en sure
that the microco ntrolle r recover s aft er a period of inact ivit y. The firmware may become inactive for a vari ety of reas ons, inc luding
errors in the code or a hardwar e fai lure such as waiting for an interrupt that never occurs.
2.6I2C and HAPI Interface
The microcontroller can communicate with external electronics through the GPIO pins. An I2C-compatible interface accommodates a 100-kHz serial link with an external device. There is also a Hardware-assisted Parallel Interface (HAPI) which can be
used to transfer data to an external device.
2.7Timer
The free-running 12-bit timer clocked at 1 MHz provides two interrupt sources, 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 of the event and after the event is
complete. The difference between the two readings indicates the duration of the event in microseconds. The upper four bits of
the timer are lat ched i nto an i nternal r egist er when th e fir mware reads the l ower ei ght bi t s. A read f rom the upper four bit s actually
reads data fr om the i nternal regi ster, instead of the timer. This feature eliminates t he need f or fir mware to try to compens ate if the
upper four bits increment immediately after the lower eight bits are read.
Document #: 38-08024 Rev. *BPage 7 of 61
C
C
CY7C66013
CY7C66113
2.8Interrupts
The microcontrol ler support s eleven mask abl e inter rupt s in the vec tored i nterr upt contr oll er . Inter rupt sour ces incl ude the 128 -µs
(bit 6) and 1.024-ms (bit 9) outputs from the fr ee-running timer, five USB end points, the USB hub, the DAC port, the GPIO ports,
and the I
to HIGH ‘1.’ The USB endpoints interrupt after the USB host has written data to the endpoint FIFO or after the USB controller
sends a packet to the USB host. The DAC ports have an additional level of masking that allows the user to select which DAC
inputs can cause a DAC inte rr upt. The GPIO ports also have a level of mask ing to select which GPIO inputs can cause a GPI O
interrupt. For additional flexibility, the input transition polarity that causes an interrupt is programmable for each pin of the DAC
port. Input transition polarity can be programmed for each GPIO port as part of the port configuration. The interrupt polarity can
be rising edge (‘0’ to ‘1’ ) or falling edge (‘1’ to ‘0’).
2.9USB
The CY7C66013C and CY7C66113C include an integrated USB Serial Interface Engine (SIE) that supports the integrated
peripherals and the hub cont roller func tion. The har dwar e support s up to t wo USB devi ce address es with one device addr ess for
the hub (two endpo int s) and a devi ce address f or a compound devi ce (thr ee endpo int s). The SI E allows the USB host t o communicate with the hub and func tions int egrate d into t he microco ntr olle r . The p art incl udes a 1:4 hub r epeater with one up st ream port
and four downstream ports. The USB Hub allows power-management control of the downstream ports by using GPIO pins
assigned by the user firmware. The user has the option of ganging the downstream ports together with a single pair of
power-management pins, or providing power management for each port with four pairs of power- m anagement pins.
2
C-compatible master mode interface. The timer bits cause an interrupt (if enabled) when the bit toggles from LOW ‘0’
Document #: 38-08024 Rev. *BPage 8 of 61
C
C
Logic Block Diagram
CY7C66013
CY7C66113
External 6-MHz crystal
PLL
48 MHz
Clock
Divider
6 MHz
12 MHz
12-MHz
8-bit
CPU
PROM
8 KB
RAM
256 byte
12-bit
Timer
8-bit Bus
USB
SIE
Interrupt
Controller
GPIO
PORT 0
P0[0]
P0[7]
USB
Transceiver
Repeater
Power management under firmware
D+[0]
Upstream
USB Port
D–[0]
USB
Transceiver
USB
Transceiver
USB
Transceiver
USB
Transceiver
Downstream USB Ports
control using GPIO pins
D+[1]
D–[1]
D+[2]
D–[2]
D+[3]
D–[3]
D+[4]
D–[4]
Watchdog
Timer
Power-On
Reset
GPIO
PORT 1
GPIO/
HAPI
PORT 2
GPIO
PORT 3
GPIO
PORT 3
DAC
PORT
I2C
Interface
*I2C-compatible interface enabled by firmware through
P2[1:0] or P1[1:0]
D+[0], D–[0]I/O 8, 956, 18, 9Upstream port, USB differential data.
D+[1], D–[1]I/O 12, 135, 613, 14Downstream port 1, USB differential data.
D+[2], D–[2]I/O 15, 168, 916, 17Downstream port 2, USB differential data.
D+[3], D–[3]I/O 40, 4140, 4148, 49Downstream port 3, USB differential data.
D+[4], D–[4]I/O 35, 3636, 3744, 45Downstream port 4, USB differential data.
P0[7:0]I/O 21, 25, 22, 26,
23, 27, 24, 28
P1[7:0]I/O6, 43, 5, 44, 4,
P2[7:0]I/O 19, 30, 18, 31,
P3[6:0]I/O 37, 10, 39, 7, 4255, 2, 4, 35,
DAC[7:0]I/O n/a1 3, 18, 19, 20,
XTAL
IN
XTAL
OUT
V
PP
V
CC
GND1 1, 20, 32, 38 3, 3211, 40Ground.
V
REF
45, 47, 46
17, 33, 14, 34
IN25026-MHz crystal or external clock input.
OUT 14916-MHz crystal out.
292836Programming voltage supply, tie to ground during
484856Voltage supply.
IN3513External 3.3V supply voltage for the differential data
14, 15, 16, 17,
24, 25, 26, 27
52, 53, 54, 43,
44, 45, 46, 47
7, 10, 11, 12,
30, 31, 33, 34
38, 39, 42,
21, 22, 23, 29
22, 32, 23, 33,
24, 34, 25, 35
6, 51, 5, 52, 4,
53, 55, 54
20, 38, 19, 39,
18, 41, 15, 42
43, 12, 46, 10,
47, 7, 50
21, 29, 26, 30,
27, 31, 28, 37
GPIO Port 0.
GPIO Port 1.
GPIO Port 2.
GPIO Port 3, capab le of sinking 12 mA (typical).
Digital to Analog Converter (DAC) Port with program-
mable current sink outputs. DAC[1 :0] offer a pro grammable
range of 3.2 to 16 mA typical. DAC[7:2] have a programmable sink current range of 0.2 to 1.0 mA typical.
norma l op e r at io n .
output buffers and the D+ pull-up.
4.2I/O Register Summary
I/O registers ar e access ed via the I/O Rea d ( IORD) and I/O W rite ( I OWR, IOWX) inst ructi ons. I ORD reads dat a fr om t he sele cted
port into the accumul ator. IOWR performs the reverse; it writes dat a from the accumul ator to the sel ected port . Index ed I/O W rite
(IOWX) adds the contents of X to the address in the instruction to form the port address and writes dat a from the accumula tor to
the specified po rt . Specifying address 0 (e.g., IOWX 0h) means the I/ O regi ster is selected solely by the contents of X.
All undefined registers are reserved. It is important not to write to reserved registers as this may cause an undefined operation
or increased curre nt consumpti on dur in g operat ion. When writing to regi sters with res erved bi ts, the res erved b its must be wr it ten
with ‘0 .’
Table 4-2. I/O Register Summary
Register NameI/O AddressRead/WriteFunction
Port 0 Data0x00R/WGPIO Port 0 Data 23
Port 1 Data0x01R/WGPIO Port 1 Data23
Port 2 Data0x02R/WGPIO Port 2 Data23
Port 3 Data0x03R/WGPIO Port 3 Data23
Port 0 Interrupt Enable0x04WInterrupt Enable for Pins in Port 024
Port 1 Interrupt Enable0x05WInterrupt Enable for Pins in Port 125
Port 2 Interrupt Enable0x06WInterrupt Enable for Pins in Port 225
Port 3 Interrupt Enable0x07WInterrupt Enable for Pins in Port 325
Document #: 38-08024 Rev. *BPage 14 of 61
Page
C
C
CY7C66013
CY7C66113
Table 4-2. I/O Register Summary ( continued)
Register NameI/O AddressRead/WriteFunction
GPIO Configuration0x08R/WG PIO Port Configurations23
2
HAPI and I
USB Device Address A0x10R/WUSB Device Address A42
EP A0 Counter Register0x11R/WUSB Address A, Endpoint 0 Counter 44
EP A0 Mode Register0x12R/WUSB Address A, Endpoint 0 Configuration 43
EP A1 Counter Register0x13R/WUSB Address A, Endpoint 1 Counter 44
EP A1 Mode Register0x14R/WUSB Address A, Endpoint 1 Configuration 44
EP A2 Counter Register0x15R/WUSB Address A, Endpoint 2 Counter 44
EP A2 Mode Register0x16R/WUSB Address A, Endpoint 2 Configuration 44
USB Status & Control0x1FR/WUSB Upstream Port Traffic Status and Control41
Global Interrupt Enab le0x20R/WGlobal Interrupt Enab le 32
Endpoint Interru pt Enable0x21R/WUSB Endpoint Interrupt Enables32
Interrupt Vector0x23RPending Interrupt Vector Read/Clear34
Timer (LSB)0x24RLower 8 Bits of Free-running Timer (1 MHz)27
Timer (MSB)0x25RUpper 4 Bits of Free-running T imer 27
WDT Clear0x26WWatchdog Timer Clear21
2
C Control & Status0x28R/WI2C Status and Control28
I
2
C Data0x29R/WI2C Data28
I
DAC Data0x30R/WDAC Data26
DAC Interrupt Enable0x31WInterrupt Enable for each DAC Pin26
DAC Int er ru p t P o la rity0x32WInterr u pt Po la r ity fo r ea c h DAC P in26
DAC Isink0x38-0x3FWInput Sink Current Control for each DAC Pin26
USB Device Address B0x40R/WUSB Device Address B (not used in 5-endpoint mode)42
EP B0 Counter Register0x41R/WUSB Address B, Endpoint 0 Counter44
EP B0 Mode Register0x42R/WUSB Address B, Endpoint 0 Configuration, or
EP B1 Counter Register0x43R/WUSB Address B, Endpoint 1 Counter44
EP B1 Mode Register0x44R/WUSB Address B, Endpoint 1 Configuration, or
Hub Port Connect Status0x48R/ WHub Downstream Port Connect Status38
Hub Port Enable0x49R/WHub Downstream Ports Enable38
Hub Port Speed0x4AR/WHub Downstream Ports Speed38
Hub Port Control (Ports [4:1])0x4BR/WHub Downstream Ports Control 39
Hub Port Suspend0x4DR/WHub Downstream Port Suspend Control40
Hub Port Resume Status0x4ERHub Downstream Ports Resume Status40
Hub Ports SE0 Status0x4FRHub Downstream Ports SE0 Status39
Hub Ports Data0x50RHub Downstream Ports Differential data40
Hub Downstream Force Low0x51R/WHub Downstream Ports Force LOW39
Processor Status & Control0xFFR/WMicroprocessor Status and Control Register31
C Configuration0x09R/WHAPI Width and I2C Position Configur ati on27
USB Address A, Endpoint 3 in 5-endpoint mode
USB Address A, Endpoint 4 in 5-endpoint mode
Page
43
44
Document #: 38-08024 Rev. *BPage 15 of 61
C
C
CY7C66013
CY7C66113
4.3Instruction Set Summary
Refer to the CYASM Assembler User’s Guide for more details.
HALT 007NOP204
ADD A,exprdata014INC 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,exprdata0D4PUSH A2D5
OR A,[expr]direct0E6PUSH X2E5
OR A,[X+expr]index0F7SWAP A,X2F5
AND A,exprdata104SWAP A,DSP305
AND A,[ex p r]direct1 16MOV [expr],Adirect315
AND A,[X+expr]index127MOV [X+expr],Aindex326
XOR A,exprdata134O R [expr],Adirect337
XOR A,[expr]direct146OR [X+expr],Aindex348
XOR A,[X+expr]index157AND [expr],Adirect357
CMP A,exprdata165AND [X+expr],Ai ndex368
CMP A,[expr]direct177XOR [expr],Adirect377
CMP A,[X+expr]index188XOR [X+expr],Aindex388
MOV A,exprdata194IOWX [X+expr]index396
MOV A,[expr]direct1A5CPL3A4
MOV A,[X+expr]index1B6ASL3B4
MOV X,exprdata1C4ASR3C4
MOV X,[expr]direct1D5RLC3D4
reserved1ERRC 3E4
XPAGE1F4RET 3F8
MOV A,X404DI704
MOV X,A414EI724
MOV PSP,A604RETI738
CALLaddr50 - 5F10JCaddrC0-CF5
JMPaddr80-8F5JNCaddrD0-DF5
CALLaddr90-9F10JACCaddrE0-EF7
JZaddrA0-AF5INDEXaddrF0-FF14
JNZaddrB0-BF5
Document #: 38-08024 Rev. *BPage 16 of 61
C
C
CY7C66013
CY7C66113
5.0 Programming Model
5.114-bit Program Counter (PC)
The 14-bit Program Counter (PC) allows access to up to 8 KB of PROM available with the CY7C66x13C architecture. The top
32 bytes of the ROM in the 8K part are reserved for testi ng purposes. The program count er is cleared duri ng reset, such that th e
first instr uction executed after a reset is at a ddress 0x0000h. Typically, this is a jump instruction t o a reset handler that initializes
the application (see Section 16.1, Interru pt Vectors, on page 33).
The lower eight bits of the program counter are incremented as instructions are loaded and executed. The upper six bits of the
program counter ar e incr emented by exe cut ing an XPAGE instruction. As a result , the la st inst ruct ion execu ted within a 256- byt e
“page” of sequen tial code should be an XPAGE instructi on. T he assembler direct ive “XPAGEON” causes the assembler to insert
XPAGE instructions automatically. Because instructions can be either one or two bytes long, the assembler may occasionally
need to insert a NOP followed by an XPAGE to execute corr ectly.
The address of the next instr ucti on to be execute d, the carr y flag, and the zer o flag ar e saved as two bytes on the program st ack
during an interrupt acknowledge or a CALL instruction. The program counter, carry flag, and zero flag are restored from the
program stack during a RETI instruction. Onl y the pr ogram counter is restored during a RET instruction.
The program counter cannot be accessed directly by the firmware. The program stack can be ex am ined by reading SRAM from
location 0x00 and up.
Document #: 38-08024 Rev. *BPage 17 of 61
C
C
5.1.1Program Memory Organization
after resetAddress
14-bit PC0x0000
Program execution begins here after a reset
CY7C66013
CY7C66113
0x0002
0x0004
0x0006
0x0008
0x000A
0x000C
0x000E
0x0010
0x0012
0x0014
0x0016
0x0018
USB Bus Reset interrupt vector
128-µs timer interrupt vector
1.024-ms timer i nterrupt vector
USB address A endpoint 0 interrupt vector
USB address A endpoint 1 interrupt vector
USB address A endpoint 2 interrupt vector
USB address B endpoint 0 interrupt vector
USB address B endpoint 1 interrupt vector
Hub interrupt vector
DAC interrupt vector
GPIO/HAPI interrupt vector
I2C interrupt vector
0x001A
0x1FDF
Figure 5-1. Progra m Memory Space with Interr upt Vector Table
Program Memory begins here
8 KB (-32) PROM ends here.
Document #: 38-08024 Rev. *BPage 18 of 61
C
C
CY7C66013
CY7C66113
5.28-bit Accumulator (A)
The accumulator is the general-purpose register for the microcontroller.
5.38-bit Temporary Register (X)
The “X” regi ster i s avail able to the firmwar e for t emporary storage of int ermediate results. The mi crocontro ller ca n perform indexed
operations based on the value in X. Refer to Section 5.6.3 for addi ti onal information.
5.48-bit Progr a m Stack Pointer (PSP)
During a reset, the Program Stack Pointer (PSP) is set to 0x00 and “grows” upward from this address. The PSP may be set by
firmware, using the MOV PSP,A instruction. The PSP supports interrupt service under hardware control and CALL, RET, and
RETI instructions under firmware control. The PSP is not readable by the firmware.
During an interrupt acknowledge, interrupts are disabled and the 14-bit progr am counter, carry flag, and zero flag are written as
two bytes of dat a memory . The f irst byte i s stored in the m emory address ed by the PSP, then the PSP is incre mented. The secon d
byte is stored in memory addressed by the PSP, and the PSP is incremented again. The overall effect is to store the program
counter and flags on the pro gram “stack” and increment th e PSP by two.
The Return From I nterr upt (RETI ) ins truct ion dec remen ts t he PSP, then rest ores t he second b yte from mem ory addr essed by th e
PSP. The PSP is decremente d ag ain and the f irst byte is r estor ed f rom m emory add ressed by t he PSP. After the pro gram count er
and flags hav e be en rest ored f r om sta ck, the i nter rupt s ar e enabl ed. Th e ov erall ef fec t is to r estor e t he prog ram c ounter and flags
from the program stack, decrement the PSP by two, and re-enable interrupts.
The Call Subroutine (CALL) instruction stores the program counter and flags on the program stack and increments the PSP by
two.
The Return From Subroutine (RET) instruction restores the program counter but not the flags from the program stack and
decrements the PSP by two.
5.4.1Data Memory Organization
The CY7C66x13C microcontrollers provide 256 bytes of data RAM. Normally, the SRAM is partitioned into four areas: program
stack, us er varia bles, data st ack, an d USB endpoi nt FI FOs. The f ol lowing is o ne e xample o f where t he program st ack, dat a st a ck,
and user variable s areas could be located.
After resetAddress
8-bit DSP8-bit PSP0x00
(Move DSP
8-bit DSP
[1]
)
user selected
0xFF
User variables
USB FIFO sp ace for up to two Addresses and five endpoints
Program Stack Growth
Data Stack Growth
[2]
5.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 pre-decrements the DSP, then writes data to the memory location addressed by the DSP. A POP instruction reads
data from the memory lo cation addressed by the DSP, then post-increment s the DSP.
During a reset, the DSP is reset to 0x00. A PUSH instruction when DSP equals 0x00 writes data at the top of the data RAM
(address 0xFF). This writes data to the memory area reserved for USB endpoint FIFOs. Therefore, the DSP should be indexed
at an appropriate memory location that does not compromise the Program Stack, user-defined memory (variables), or the USB
endpoint FIFOs.
Notes:
1. Refer to Section 5.5 for a description of DSP.
2. Endpoint sizes are fixed by the Endpoint Size Bit (I/O register 0x1F, Bit 7), see
Table 19-1.
Document #: 38-08024 Rev. *BPage 19 of 61
Loading...
+ 42 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.