![]() |
|
To Download CYPRESSSEMICONDUCTORCORP-CY7C63231A-PXC Datasheet File |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
cy7c63221/31a encore? usb low-speed usb peripheral controller cypress semiconductor corporation ? 198 champion court ? san jose , ca 95134-1709 ? 408-943-2600 document #: 38-08028 rev. *d revised october 20, 2010 1 features encore? usb - enhanced component reduction ? internal oscillator eliminates the need for an external crystal or resonator ? interface can auto-configure to operate as ps/2 or usb with- out the need for external components to switch between modes (no gpio pins needed to manage dual mode capa- bility) ? 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 compliance ? conforms to usb specification, version 2.0 ? conforms to usb hid spec ification, version 1.1 ? supports 1 low-speed usb device address ? supports 1 control endpoint and 1 data endpoint ? integrated usb transceiver ? 3.3v regulated output for usb pull-up resistor 8-bit risc microcontroller ? harvard architecture ? 6-mhz external ceramic resonator or internal clock mode ? 12-mhz internal cpu clock ? internal memory ? 96 bytes of ram ? 3 kbytes of eprom ? interface can auto-configure to operate as ps/2 or usb ? no external components for switching between ps/2 and usb modes i/o ports ? up to 10 versatile general pu rpose i/o (gpio) pins, individ- ually configurable ? high current drive on any gpio pin: 50 ma/pin current sink ? each gpio pin supports high-impedance inputs, internal pull-ups, open drain outputs, or traditional cmos outputs ? maskable interrupts on all i/o pins ? xtalin, xtalout and vreg can be configured as addi- tional input pins internal low-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 watchdog timer (wdt) low-voltage reset at 3.75v internal brown-out reset for suspend mode improved output drivers to reduce emi operating voltage from 4.0v to 5.5vdc operating temperature from 0 to 70 degrees celsius available in die form or 16-pin pdip available in 18-pin soic, 18-pin pdip industry-standard programmer support [+] feedback not recommended for new designs
cy7c63221/31a document #: 38-08028 rev. *d page 2 of 47 functional overview encore usb - the new usb standard cypress has reinvented its leadership position in the low-speed usb market with a new family of innovative microcontrollers. introducing... encore? usb??enhanced component reduction.? cypress has leveraged its design expertise in usb solutions to create a new family of low-speed usb microcon- trollers that enables peripheral developers to design new products with a minimum number of components. at the heart of the cypress encore usb technology is the breakthrough design of a crystal-less oscillator. by integrating the oscillator into the chip, an external crystal or resonator is no longer needed. we have 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 family is comprised of 8-bit risc one time programmable (otp) microcontrollers. the instruction set has been optimized specifically for usb and ps/2 operations, although the microcon- trollers can be used for a variety of other embedded applications. the features up to 10 general-purpose i/o (gpio) pins to support usb, ps/2 and other app lications. the i/o pins are grouped into two ports (port 0 to 1) where each pin can be individually configured as inputs with internal pull-ups, open drain outputs, or traditional cmos outputs with programmable drive strength of up to 50 ma output drive. additionally, each i/o pin can be used to generate a gpio interrupt to the microcon- troller. the microcontrollers feature an internal oscillator. with the presence of usb traffic, the internal oscillator can be set to precisely tune to usb timing requirements (6 mhz 1.5%). this clock generator has been optimized to reduce clock-related noise emissions (emi), and provides the 6-mhz and 12-mhz clocks that remain internal to the microcontroller. when using the internal oscillator, xtalin and xtalout can be configured as additional input pins that can be read on port 2. optionally, an external 6-mhz ceramic resonator can be used to provide a higher precision reference if needed. the is offered with 3 kbytes of eprom to minimize cost, and has 96 bytes of data ram for stack space, user variables, and usb endpoint fifos. the family includes low-voltage reset logic, a watchdog timer, a vectored interrupt controller, and a 12-bit free-running timer. the low-voltage reset (lvr) logic detects when power is applied to the device, resets the logic to a known state, and begins executing instructions at epro m address 0x0000. lvr will also reset the part when v cc drops below the operating voltage range. the watchdog timer can be used to ensure the firmware never gets stalled for more than approximately 8 ms. the microcontroller supports 7 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, two usb endpoints, an internal wake-up timer and the gpio port. the timers bits cause periodic interrupts when enabled. the usb endpoints interrupt after usb transac- tions complete on the bus. the gpio port has 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 cy7c63221/31a includes an integrated usb serial interface engine (sie). the hardware supports one usb device address with two endpoints. the sie allows the usb host to communicate with the function integrated into the microcon- troller. a 3.3v regulated output pi n provides a pull-up source for the external usb resistor on the d? pin. when using an external voltage regulator vreg can be configured as an input pin that can be read on port 2 (p2.0). 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 inte rnal pull-up resistors on sclk and sdata, the ability to disable the regulator output pin, and an interrupt to signal the start of ps/2 activity. no external compo- nents are necessary for dual usb and ps/2 systems, and no gpio pins need to be dedicated to switching between modes. slow edge rates operate in both modes to reduce emi. [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 3 of 47 logic block diagram internal oscillator wake-up timer ram 96 bytes 12-bit timer 8-bit risc core brown-out reset watch dog timer low voltage reset interrupt controller usb engine port 0 gpio port 1 gpio usb & ps/2 xcvr 3.3v regulator vreg/p2.0 d+ d- p0.0-p0.7 p1.0-p1.1 xtal oscillator eprom 3 kbytes xtalin/p2.1 xtalout xtalin/p2.1 xtalout/p2.2 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 4 of 47 contents pin configurations ........................................................... 5 pin assignments .............................................................. 6 programming model ......................................................... 7 program counter (pc) ................................................ 7 8-bit accumulator (a ) ................................................... 7 8-bit index register (x) ............................................... 7 8-bit program stack pointer (p sp) .............................. 7 8-bit data stack pointer (dsp) .................................... 7 address modes ........................................................... 8 instruction set summary ................................................. 9 memory organization ..................................................... 10 program memory organization ................................. 10 data memory organization ....................................... 11 i/o register summary ............................................... 12 clocking .......................................................................... 13 internal/external oscillator operation ....................... 14 external oscillator . .......................................... .......... 14 reset ................................................................................ 14 low-voltage reset (lvr) .......................................... 15 brown-out reset (bor) ............................................ 15 watchdog reset (wdr) ......... ............................ ....... 15 suspend mode ................................................................ 16 clocking mode on wake-up from suspend ............... 16 wake-up timer .................... ...................................... 16 general purpose i/o ports ............................................. 17 auxiliary input port .......................................... .......... 20 usb serial interface engine (sie) ................................. 20 usb enumeration ...................................................... 21 usb port status and control ..................................... 21 usb device ..................................................................... 23 usb address register .............................................. 23 usb control endpoint ............................................... 23 usb non-control endpoints ...................................... 24 usb endpoint counter regist ers .............................. 24 usb regulator output ................................................... 25 ps/2 operation ................................................................ 25 12-bit free-running timer .............................................. 26 processor status and control register ....................... 27 interrupts ......................................................................... 28 interrupt vectors ........................................................ 29 interrupt latency ....................................................... 29 interrupt sources ....................................................... 29 usb mode tables ........................................................... 33 register summary .......................................................... 38 absolute maximum ratings .......................................... 39 dc characteristics ......................................................... 39 switching characteristics .............................................. 41 ordering information ...................................................... 44 package diagrams .......................................................... 44 .document history page ......... ....................................... 47 sales, solutions, and legal information ...................... 47 worldwide sales and design s upport ......... .............. 47 products .................................................................... 47 psoc solutions ......................................................... 47 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 5 of 47 pin configurations 1 2 3 4 6 7 8 9 10 11 13 14 16 15 p0.0 p0.1 p0.2 p0.3 v ss vreg/p2.0 p0.4 p0.6 p0.7 d+/sclk d?/sdata v cc 16-pin pdip p0.5 v pp xtalin/p2.1 xtalout/p2.2 cy7c63221a 5 12 1 2 3 4 6 7 8 10 11 12 13 15 16 18 17 p0.0 p0.1 p0.2 p0.3 v ss vreg/p2.0 p0.4 p0.6 p0.7 d+/sclk d?/sdata v cc 18-pin soic/pdip p0.5 9 v pp xtalin/p2.1 xtalout/p2.2 cy7c63231a 5 14 p1.0 p1.1 (top view) 4 5 3 p0.2 1 p0.0 2 p0.1 18 p0.4 17 p0.5 16 p0.6 15 14 7 8 9 10 11 12 13 p0.3 p1.0 vss vpp xtalin/p2.1 vreg/p2.0 xtalout/p2.2 vcc d-/sdata d+/sclk p0.7 p1.1 6 cy7c63221a-xc/xwc die [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 6 of 47 pin assignments name i/o 16-pin cy7c63231a/ cy7c63221a-xc description 18-pin/pad d?/sdata, d+/sclk i/o 11 12 12 13 usb differential data lines (d? and d+), or ps/2 clock and data signals (sdata and sclk) p0[7:0] i/o 1, 2, 3, 4, 13, 14, 15, 16 1, 2, 3, 4, 15, 16, 17, 18 gpio port 0 capable of sinking up to 50 ma/pin, or sinking controlled low or high programm able current. can also source 2 ma current, provide a resistive pull-up, or serve as a high-impedance input. p1[1:0] i/o na 5,14 io port 1 capable of sinki ng up to 50 ma/pin, or sinking controlled low or high programmable current. can also source 2 ma current, provide a resistive pull-up, or serve as a high-impedance input. xtalin/p2.1 in 8 9 6-mhz ceramic resonator or external clock input, or p2.1 input xtalout/p2.2 in 9 10 6-mhz ceramic resonator return pin or internal oscillator output, or p2.2 input v pp 6 7 programming voltage supply, ground for normal operation v cc 10 11 voltage supply vreg/p2.0 7 8 voltage supply for 1.3-k usb pull-up resistor (3.3v nominal). also serves as p2.0 input. v ss 5 6 ground [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 7 of 47 programming model refer to the cyasm assembler user?s guide for more details on firmware operation with the microcontrollers. program counter (pc) the 14-bit program counter (pc) allows access for 3 kbytes of eprom using the architecture. the program counter is cleared during reset, such that the first instruction executed after a reset is at address 0x0000. this is typically a jump instruction to a reset handler that initializes the application. the lower 8 bits of the progr am counter are incremented as instructions are loaded and exec uted. the upper 6 bits of the program counter are incremen ted 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 cause the assembler to insert 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 counter of the next in struction to be executed, carry flag, and zero flag are saved as two bytes on the program stack during an interrupt acknowledge or a call instruction. the program counter, carry flag, and zero flag are restored from the program stack only during a reti instruction. please note the program counter cannot be accessed directly by the firmware. the program stack can be examined by reading sram from location 0x00 and up. note that there are restrictions in using the jmp, call, and index instructions across the 4-kb boundary of the program memory. refer to the cyasm assembler user?s guide for a detailed description. 8-bit accumulator (a) the accumulator is the general-purpose, do-everything register in the architecture where results are usually calculated. 8-bit index register (x) the index register ?x? is available to the firmware as an auxiliary accumulator. the x register also allows the processor to perform indexed operations by loading an index value into x. 8-bit program stack pointer (psp) during a reset, the program stack pointer (psp) is set to zero. this means the program ?stack? starts at ram address 0x00 and ?grows? upward from there. note that the program stack pointer is directly addressable under firmware control, using the mov 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 stored in the memory addressed by the program stack pointer, then the psp is incre- mented. the second byte is stored in memory addressed by the program stack pointer and the psp is incremented again. the net effect is to store the pr ogram counter and flags on the program ?stack? and increment t he program stack pointer by two. the return from interrupt (ret i) 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 by te is restored from memory addressed by the psp. after the program counter and flags have been restored from stack, the interrupts are enabled. the effect is to restore the program coun ter and flags from the program stack, decrement the program stack pointer 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 (r et) instruction restores the program counter, but not the flags, from program stack and decrements the psp by two. 8-bit data stack pointer (dsp) the data stack pointer (dsp) supports push and pop instruc- tions that use the data stack for temporary storage. a push instruction will pre-decrement the dsp, then write data to the memory location addressed by the dsp. a pop instruction will read data from the memory location addressed by the dsp, then post-increment the dsp. during a reset, the data stack po inter will be set to zero. a push instruction when dsp equals zero will write data at the top 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 appli- cations, this works fine and is not a problem. for usb applications, the firmware should set the dsp to an appropriate location to avoid a memory conflict with ram dedicated to usb fifos. since there are only 80 bytes of ram available (except endpoint fifos) the dsp should be set between 0x00 and 0x4fh. the memory requirements for the usb endpoints are shown in section . 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 less to avoid usb fifos) swap a,dsp ; swap accumulato r value into dsp register [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 8 of 47 address modes the microcontroller supports three addressing modes for instructions that require dat a operands: data, direct, and indexed. data the ?data? address mode refers to a data operand that is actually a constant encoded in the instru ction. as an example, consider the instruction that loads a with the constant 0x30: mov a, 30h this instruction will require two by tes of code where the first byte identifies the ?mov a? instruction with a data operand as the second byte. the second byte 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 direct ?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 th e 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 names are assigned to variable addresses using ?equ? statements to improve the readability of the assembler source code. as an example, the following code is equivalent to the example shown above: buttons: equ 10h mov a,[buttons] indexed ?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 address 0x13h. [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 9 of 47 instruction set summary refer to the cyasm assembler user?s guide for detailed information on these instructions. note that conditional jump instructions (i.e. jc, jnc, jz, jnz) take 5 cycles if jump is taken, 4 cycles if no jump. mnemonic operand opcode cycles mnemonic operand opcode cycles halt 00 7 nop 20 4 add a,expr data 01 4 inc a acc 21 4 add a,[expr] direct 02 6 inc x x 22 4 add a,[x+expr] index 03 7 inc [expr] direct 23 7 adc a,expr data 04 4 inc [x+expr] index 24 8 adc a,[expr] direct 05 6 dec a acc 25 4 adc a,[x+expr] index 06 7 dec x x 26 4 sub a,expr data 07 4 dec [expr] direct 27 7 sub a,[expr] direct 08 6 dec [x+expr] index 28 8 sub a,[x+expr] index 09 7 iord expr address 29 5 sbb a,expr data 0a 4 iowr expr address 2a 5 sbb a,[expr] direct 0b 6 pop a 2b 4 sbb a,[x+expr] index 0c 7 pop x 2c 4 or a,expr data 0d 4 push a 2d 5 or a,[expr] direct 0e 6 push x 2e 5 or a,[x+expr] index 0f 7 swap a,x 2f 5 and a,expr data 10 4 swap a,dsp 30 5 and a,[expr] direct 11 6 mov [expr],a direct 31 5 and a,[x+expr] index 12 7 mov [x+expr],a index 32 6 xor a,expr data 13 4 or [expr],a direct 33 7 xor a,[expr] direct 14 6 or [x+expr],a index 34 8 xor a,[x+expr] index 15 7 and [expr],a direct 35 7 cmp a,expr data 16 5 and [x+expr],a index 36 8 cmp a,[expr] direct 17 7 xor [expr],a direct 37 7 cmp a,[x+expr] index 18 8 xor [x+expr],a index 38 8 mov a,expr data 19 4 iowx [x+expr] index 39 6 mov a,[expr] direct 1a 5 cpl 3a 4 mov a,[x+expr] index 1b 6 asl 3b 4 mov x,expr data 1c 4 asr 3c 4 mov x,[expr] direct 1d 5 rlc 3d 4 reserved 1e rrc 3e 4 xpage 1f 4 ret 3f 8 mov a,x 40 4 di 70 4 mov x,a 41 4 ei 72 4 mov psp,a 60 4 reti 73 8 call addr 50 - 5f 10 jmp addr 80-8f 5 jc addr c0-cf 5 (or 4) call addr 90-9f 10 jnc addr d0-df 5 (or 4) jz addr a0-af 5 (or 4) jacc addr e0-ef 7 jnz addr b0-bf 5 (or 4) index addr f0-ff 14 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 10 of 47 memory organization program memory organization figure 1. program memory spa ce with interrupt vector table after reset address 14-bit pc 0x0000 program execution begins here after a reset. 0x0002 usb bus reset interrupt vector 0x0004 128- s timer interrupt vector 0x0006 1.024-ms timer interrupt vector 0x0008 usb endpoint 0 interrupt vector 0x000a usb endpoint 1 interrupt vector 0x000c reserved 0x000e reserved 0x0010 reserved 0x0012 reserved 0x0014 gpio interrupt vector 0x0016 wake-up interrupt vector 0x0018 program memory begins here 0x0bdf 3 kb prom ends here (3k - 32 bytes). see note 1 below note 1. the upper 32 bytes of the 3k prom are reserved. therefore, user?s program must not over-write this space. [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 11 of 47 data memory organization the microcontroller provides 96 bytes of data ram. in normal us age, the sram is partitioned into four areas: program stack, da ta stack, user variables and usb endpoint fifos as shown below: after reset address 8-bit dsp 8-bit psp 0x00 program stack growth (user?s firmware moves dsp) 8-bit dsp user selected data stack growth user variables 0x4f 0xf0 usb fifo for address a endpoint 1 0xf8 usb fifo for address a endpoint 0 top of ram memory 0xff [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 12 of 47 i/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., iowx 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, except the processor status and control register ( figure 22 ). all registers not listed are reserved, and should never be written by firmware. all bits marked as reserved should always be written as 0 and be treated as undefined by reads. table 1. i/o register summary register name i/o address read/write function fig. port 0 data 0x00 r/w gpio port 0 6 port 1 data 0x01 r/w gpio port 1 port 2 data 0x02 r auxiliary input register for d+, d?, vreg, xtalin, xtalout 12 port 0 interrupt enable 0x04 w interru pt enable for pins in port 0 26 port 1 interrupt enable 0x05 w inter rupt enable for pins in port 1 port 0 interrupt polarity 0x06 w inter rupt polarity for pins in port 0 port 1 interrupt polarity 0x07 w interru pt polarity for pins in port 1 29 port 0 mode0 0x0a w controls output configuration for port 0 8 port 0 mode1 0x0b w 9 port 1 mode0 0x0c w controls output configuration for port 1 10 port 1 mode1 0x0d w 11 usb device address 0x10 r/w u sb device address register 14 ep0 counter register 0x11 r/w usb endpoint 0 counter register 17 ep0 mode register 0x12 r/w usb endpoi nt 0 configuration register 15 ep1 counter register 0x13 r/w usb endpoint 1 counter register 17 ep1 mode register 0x14 r/w usb endpoi nt 1 configuration register 16 usb status & control 0x1f r/w usb status and control register global interrupt enable 0x20 r/w global interrupt enable register 23 endpoint interrupt enable 0x21 r/w usb endpoint interrupt enables 24 timer (lsb) 0x24 r lower 8 bits of free-running timer (1 mhz) 19 timer (msb) 0x25 r upper 4 bits of free-running timer 20 wdr clear 0x26 w watch dog reset clear - clock configuration 0xf8 r/w internal / ex ternal clock configuration register 3 processor status & control 0xff r/w processor status and control 22 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 13 of 47 clocking the chip can be clocked from either the internal on-chip clock, or from an oscillator based on an external resonator/crystal, a s shown in figure 2 . no additional capacitance is included on chip at the xtalin /out pins. operation is contro lled by the clock configuration register, figure 3 . figure 2. clock oscillator on-chip circuit figure 3. clock configurat ion register (address 0xf8) bit 7: ext. clock resume delay external clock resume delay bi t selects the delay time when switching to the external oscillator from the internal oscillator mode, or when waking from suspend mode with the external oscillator enabled. 1 = 4 ms delay. 0 = 128 s delay. the delay gives the oscillator time to start up. the shorter time is adequate for operation with ceramic resonators, while the longer time is preferred for start-up with a crystal. (these times do not include an initial oscillator start-up time which depends on the resonating element. this time is typically 50?100 s for ceramic resonators and 1?10 ms for crystals). note that this bit only selects the delay time for the external clock mode. when waking from suspend mode with the inter- nal oscillator (bit 0 is low), the delay time is only 8 s in addition to a delay of approximately 1 s for the oscillator to start. bit [6:4]: wake-up timer adjust bit [2:0] the wake-up timer adjust bits are used to adjust the wake-up timer period. if the wake-up interrupt is enabled in the global interrupt en- able register, the microcontroller will generate wake-up inter- rupts periodically. the frequency of these periodical wake-up interrupts is adjusted by setting the wake-up timer adjust bit [2:0], as described in section . one common use of the wake-up interrupts is to generate periodical wake-up events during suspend mode to check for changes, such as looking for movement in a mouse, while maintaining a low average power. bit # 76543210 bit name ext. clock resume delay wake-up timer adjust bit [2:0] low-voltage reset disable precision usb clocking enable internal clock output disable external oscillator enable read/write r/w r/w r/w r/w r/w r/w r/w r/w reset 00000000 xtalout xtalin clk2x (12 mhz) clock doubler clk1x (6 mhz) (to microcontroller) (to usb sie) port 2.1 ext osc enable port 2.2 int clk output disable internal osc [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 14 of 47 bit 3: low-voltage reset disable when v cc drops below v lvr (see section for the value of v lvr ) and the low-voltage reset circuit is enabled, the micro- controller enters a partial suspend state for a period of t start (see section for the value of t start ). program execution be- gins from address 0x0000 after this t start delay period. this provides time for v cc to stabilize before the part executes code. see section for more details. 1 = disables the lvr circuit. 0 = enables the lvr circuit. bit 2: precision us b clocking enable the precision usb clocking enable only affects operation in internal oscillator mode. in that mode, this bit must be set to 1 to cause the internal clock to automatically precisely tune to usb timing requ irements (6 mhz 1.5%) . the fre- quency may have a looser initial tolerance at power-up, but all usb transmissions from the chip will meet the usb spec- ification. 1 = enabled. the internal clock accuracy is 6 mhz 1.5% after usb traffic is received . 0 = disabled. the internal clock accuracy is 6 mhz 5%. bit 1: internal clock output disable the internal clock output disable is used to keep the internal clock from driving out to the xtalout pin. this bit has no effect in the external oscillator mode. 1 = disable internal clock output. xtalout pin will drive high. 0 = enable the internal clock output. the internal clock is driv- en out to the xtalout pin. bit 0: external oscillator enable at power-up, the chip operates fr om the internal clock by de- fault. setting the external oscillator enable bit high disables the internal clock, and halts the part while the external reso- nator/crystal oscillator is started. clearing this bit has no im- mediate effect, although the st ate of this bit is used when waking out of suspend mode to select between internal and external clock. in in ternal clock mode, xtalin pin will be con- figured as an input with a weak pull-down and can be used as a gpio input (p2.1). 1 = enable the external oscill ator. the clock is switched to external clock mode, as described in section . 0 = enable the internal oscillator. internal/external oscillator operation the internal oscillator provides 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 clock. in this mode, the internal clock is buffered and driven to the xtalout pin by default, and th e state of the xtalin pin can be read at port 2.1. while the in ternal clock is enabled, its output can be disabled at the xtalout pin by setting the internal clock output disable bit of the clo ck configuration register. setting the external oscillator enable bit of the clock configu- ration register high disables the internal clock, and halts the part while the external resonator/crystal oscillator is started. the steps involved in switching from internal to external clock mode 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 high (external oscillator enable bit). bit 7 cleared gives faster start-up iowr f8h ; write to clock configuration register 3. internal clocking is halted, the internal oscillator is disabled, and the external clock oscillator is enabled. 4. after the external clock becomes stable, chip clocks are re-enabled using the external clock signal. (note that the time for the external clock to become stable depends on the external resonating devi ce; see next section.) 5. after an additional delay the cpu is released to run. this delay depends on the state of the ext. clock resume 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 has been set to external oscillator, it can only return to internal clock when waking from suspend mode. clearing bit 0 of the clock co nfiguration register will not re-enable internal clock mode until suspend mode is entered. see section for more details on suspend mode operation. if the internal clock is enabled, the xtalin pin can serve as a general-purpose input, and its stat e can be read at port 2, bit 1 (p2.1). refer to figure 12 for the port 2 data register. in this mode, there is a weak pull-down at the xtalin pin. this input cannot provide an interrupt source to the cpu. external oscillator the user can connect a low-cost ceramic resonator or an external oscillator to the xtalin/xtalout pins to provide a precise reference frequency for the chip clock, as shown in figure 2 . the external components required are a ceramic resonator or crystal and any associated capacitors. to run from the external resonator, the external oscillator enable bit of the clock configuration 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 crystal-based oscillators take longer, typically 1 to 10 ms. board capacitance should be minimized on the xtalin and xtalout pins by keeping the traces as short as possible. an external 6-mhz clock can be applied to the xtalin pin if the xtalout pin is left open. reset the usb controller supports three types of resets. the effects of the reset are listed below. the reset types are: 1. low-voltage reset (lvr) 2. brown-out reset (bor) 3. watchdog reset (wdr) the occurrence of a reset is re corded in the processor status and control register ( figure 22 ). bits 4 (low-voltage or brown-out reset bit) and 6 (watchdog reset bit) are used to [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 15 of 47 record the occurrence of lvr/bor and wdr respectively. the firmware can interrogate these bits to determine the cause of a reset. the microcontroller begins exec ution from rom address 0x0000 after a lvr, bor, or wdr reset. although this looks like 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 following events take place on reset. more details on the various resets are given in the following sections. 1. all registers are reset to their default states (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-impedance state. 4. interrupts are disabled. 5. usb operation is disabled and must be enabled by firmware if desired, as explained in section . 6. for a bor or lvr, the external oscillator is disabled and internal clock mode is activated, followed by a time-out period t start for v cc to stabilize. a wdr does not change the clock mode, and there is no delay for v cc stabilization on a wdr. note that the external oscillator enable (bit 0, figure 3 ) will be cleared by a wdr, but it does not take effect until suspend mode is entered. 7. the program stack pointer ( psp) and data stack pointer (dsp) reset to address 0x00. firmware should move the dsp for usb applications, as explained in section . 8. program execution begins at address 0x0000 after the appro- priate time-out period. low-voltage reset (lvr) when v cc is first applied to the chip, the internal oscillator is started and the low-voltage reset is initially enabled by default. at the point where v cc has risen above v lvr (see section for the value of v lvr ), an internal counter starts counting for a period of t start (see section for the value of t start ). during this t start time, the microcontroller enters a partial suspend state to wait for v cc to stabilize before it begins executing code from address 0x0000. as long as the lvr circuit is enabled, this reset sequence repeats whenever the v cc pin voltage drops below v lvr . the lvr can be disabled by firmware by setting the low-voltage reset disable bit in the clock configuration register ( figure 3 ). in addition, the lvr is automatically disabled in suspend mode to save power. if the lvr was enabled before entering suspend mode, it becomes active again once the suspend mode ends. when lvr is disabled during normal operation (e.g., by writing ?0? to the low-voltage reset disable bit in the clock configu- ration register), the chip may enter an unknown state if v cc drops below v lvr . therefore, lvr should be enabled at all times during normal operation. if lvr is disabled (e.g., by firmware or during suspend mode), a secondary low-voltage monitor, bor, becomes active, as described in the next section. the lvr/bor reset bit of the processor status and control register ( figure 22 ), is set to ?1? if either a lvr or bor has occurred. brown-out reset (bor) the brown-out reset (bor) circuit is always active and behaves like the por. bor is asserted whenever the v cc voltage to the device is below an internally defined trip voltage of approximately 2.5v. the bor re-enables lvr. that is, once v cc drops and trips bor, the part remains in reset until v cc rises above v lvr . at that point, the t start delay occurs before normal operation resumes, and the microcontroller starts executing code from address 0x00 after the t start delay. in suspend mode, only the bor detection is active, giving a reset if v cc drops below approximately 2.5v. since the device is suspended and code is not executing, this lower reset voltage is safe for retaining the state of all registers and memory. note that in suspend mode, lvr is disabled as discussed in section . watchdog reset (wdr) the watchdog timer reset (wdr) occurs when the internal watchdog timer rolls over. writing any value to the write-only watchdog reset register at address 0x26 will clear the timer. the timer will roll over and wdr will occur if it is not cleared within t watch (see figure 4 ) of the last clear. bit 6 (watchdog reset bit) of the processor status and control register is set to record this event (see section for more details). a watchdog timer reset lasts for ty pically 2?4 ms after which the mi crocontroller begins execution at rom address 0x0000. figure 4. watchdog reset (wdr, address 0x26) at least 10.1 ms wdr goes high execution begins at rom address 0x0000 2?4 ms since last write to wdr for 2?4 ms 14.6 ms (at f osc = 6 mhz) wdr t watch = 10.1 to [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 16 of 47 suspend mode the parts support a versatile low-power suspend mode. in suspend mode, only an enabled interrupt or a low state on the d?/sdata pin will wake the part. two options are available. for lowest power, all internal circuits can be disabled, so only an external event will resume operation. alternatively, a low-power internal wake-up timer can be used to trigger the wake-up interrupt. this timer is described in section , and can be used to periodically poll the system to c heck for changes, such as looking for movement in a mouse, while maintaining a low average power. the is placed into a low-power state by setting the suspend bit of the processor status and control register ( figure 22 ). all logic blocks in the device are tu rned off except the gpio interrupt logic, the d?/sdata pin input receiver, and (optionally) the wake-up timer. the clock oscillators, as well as the free-running and watchdog timers are shut down. only the occurrence of an enabled gpio interrupt, wake-up interrupt, spi slave interrupt, or a low state on the d?/sdata pin will wake the part from suspend (d? low indicates non-idle usb activity). once one of these resuming conditions occurs, clocks will be restarted and the device returns to full operation after the oscillator is stable and the selected delay period expires. this delay period is deter- mined by selection of internal vs. external clock, and by the state of the ext. clock resume delay as explained in section . in suspend mode, any enabled and pending interrupt will wake the part up. the state of the in terrupt enable sense bit (bit 2, figure 22 ) does not have any effect. as a result, any interrupts not intended for waking from suspend should be disabled through the global interrupt enable register and the usb end point interrupt enable register (section ). if a resuming condition exists when the suspend bit is set, the part will still go into suspend and then awake after the appro- priate delay time. the run bit in the processor status and control register must be set fo r the part to resume out of suspend. once the clock is stable and the delay time has expired, the microcontroller will execute the instruction following the i/o write that placed the device into suspend mode before servicing any interrupt requests. to achieve the lowest possible current during suspend mode, all i/o should be held at either v cc or ground . in addition, the gpio bit interrupts ( figure 26 and figure ) should be disabled for any pins that are not being used for a wake-up interrupt. this should be done even if the main gpio interrupt enable ( figure 23 ) is off. typical code for entering suspend is shown below: ... ; all gpio set to low-power state (no floating pins, and bit interrupts disabled unless using for wake-up) ... ; enable gpio and/or wake-up timer inter- rupts if desired for wake-up ... ; select clock mode fo r wake-up (see section ) mov a, 09h ; set suspend and run bits iowr ffh ; write to status and control register - enter suspend, wait for gpio/wake- up interrupt or usb activity nop ; this executes before any isr ... ; remaining code for exiting suspend routine clocking mode on wake-up from suspend when exiting suspend on a wake-up event, the device can be configured to run in either internal or external clock mode. the mode is selected by the state of the external oscillator enable bit in the clock configuration register ( figure 3 ). using the internal clock saves the external oscillator start-up time and keeps that oscillator off for additional power savings. the external oscillator mode can be activated when desired, similar to operation at power-up. the sequence of events for these modes is as follows: wake in internal clock mode: 1. before entering suspend, clear bit 0 of the clock configuration register. this selects internal clock mode after suspend. 2. enter suspend mode by setting the suspend bit of the processor status and control register. 3. after a wake-up event, the internal clock starts immediately (within 2 s). 4. a time-out period of 8 s passes, and then firmware execution begins. 5. at some later point, to activate external clock mode, set bit 0 of the clock configuration register. this halts the internal clocks while the external clo ck becomes stable. after an additional time-out (128 s or 4 ms, see section ), firmware execution resumes. wake in external clock mode: 1. before entering suspend, the external clock must be selected by setting bit 0 of the clock configuration register. make sure this bit is still set when suspend mode is entered. this selects external clock mode after suspend. 2. enter suspend mode by setting the suspend bit of the processor status and control register. 3. after a wake-up event, the exter nal oscillator is started. the clock is monitored for stabilit y (this takes approximately 50?100 s with a ceramic resonator). 4. after an additional time-out period (128 s or 4 ms, see section ), firmware execution resumes. wake-up timer the wake-up timer runs whenever the wake-up interrupt is enabled, and is turned off whenev er that interrupt is disabled. operation is independent of w hether the device is in suspend mode or if the global interrupt bit is enabled. only the wake-up timer interrupt enable bit ( figure 23 ) controls the wake-up timer. once this timer is activated, it will give interrupts after its time-out period (see below). these interrupts continue periodically until the interrupt is disabled. whenever the interrupt is disabled, the wake-up timer is reset, so that a subsequent enable always results in a full wake-up time. the wake-up timer can be adjusted by the user through the wake-up timer adjust bits in the clock configuration register ( figure 3 ). these bits clear on reset. in addition to allowing the user to select a range for the wake-up time, a firmware algorithm can be used to tune out initial process and operating condition variations in this wake-up time. this can be done by timing the wake-up interrupt time with the accurate 1.024-ms timer interrupt, and adjusting the timer adjust bits accordingly to approximate the desired wake-up time. [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 17 of 47 general purpose i/o ports ports 0 and 1 provide up to 10 versatile gpio pins that can be read or written (the number of pins depends on package type). figure 5. block diagram of gpio port (one pin shown) port 0 is an 8-bit port; port 1 co ntains 2 bits, p1.1?p1.0 in the and cy7c63221a-xc parts. each bit can also be selected as an interrupt source for the microcontroller. the data for each gpio pin is accessible through the port data register. writes to the port data register store outgoing data state for the port pins, while reads from the port data register return the actual logic value on the port pins, not the port data register contents. each gpio pin is configured in dependently. the driving state of each gpio pin is determined by the value written to the pin?s data register and by two associated pin?s mode0 and mode1 bits. the port 0 data register is shown in figure 6 , and the port 1 data register is shown in figure . the mode0 and mode1 bits for the two gpio ports are given in figure 8 through figure 11 . table 2. wake-up ti mer adjust settings adjust bits [2:0] (bits [6:4] in figure 3 ) wake-up time 000 (reset state) 1 * t wake 001 2 * t wake 010 4 * t wake 011 8 * t wake 100 16 * t wake 101 32 * t wake 110 64 * t wake 111 128 * t wake see section for the value of t wake gpio pin v cc 14 k gpio mode data out register internal data bus port read port write interrupt enable interrupt control to interrupt controller q1 q2 q3 logic interrupt polarity 2 threshold select [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 18 of 47 figure 6. port 0 data (address 0x00) bit [7:0]: p0[7:0] 1 = port pin is logic high 0 = port pin is logic low figure 7. port 1 data (address 0x01) bit [7:2]: reserved bit [1:0]: p1[1:0] 1 = port pin is logic high 0 = port pin is logic low figure 8. gpio port 0 mode0 register (address 0x0a) bit [7:0]: p0[7:0] mode 0 1 = port pin mode 0 is logic high 0 = port pin mode 0 is logic low figure 9. gpio port 0 mode1 register (address 0x0b) bit [7:0]: p0[7:0] mode 1 1 = port pin mode 1 is logic high 0 = port pin mode 1 is logic low bit # 76543210 bit name p0 read/write r/w r/w r/w r/w r/w r/w r/w r/w reset 00000000 bit # 76543210 bit name reserved p1[1:0] notes pins 1:0 in all parts read/write ------r / wr / w reset 00000000 bit # 76543210 bit name p0[7:0] mode0 read/write wwwwwwww reset 00000000 bit # 76543210 bit name p0[7:0] mode1 read/write wwwwwwww reset 00000000 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 19 of 47 figure 10. gpio port 1 mode0 register (address 0x0c) bit [7:2]: reserved bit [1:0]: p1[1:0] mode 0 1 = port pin mode 0 is logic high 0 = port pin mode 0 is logic low figure 11. gpio port 1 mode1 register (address 0x0d) bit [7:2]: reserved bit [1:0]: p1[1:0] mode 1 1 = port pin mode 1 is logic high 0 = port pin mode 1 is logic low each pin can be independently configured as high-impedance inputs, inputs with internal pull-ups, open drain outputs, or tradi- tional cmos outputs with se lectable drive strengths. the driving state of each gpio pin is determined by the value written to the pin?s data regist er and by its associated mode0 and mode1 bits. table 3 lists the configuration states based on these bits. the gpio ports default on reset to all data and mode registers cleared, so the pins ar e all in a high-impedance state. the available gpio output drive strength are: hi-z mode (mode1 = 0 and mode0 = 0) q1, q2, and q3 ( figure 5 ) are off. the gpio pin is not driv- en internally. performing a read from the port data register return the actual logic value on the port pins. low sink mode (mode1 = 1, mode0 = 0, and the pin?s data register = 0) q1 and q3 are off. q2 is on. the gpio pin is capable of sinking 2 ma of current. medium sink mode (mode1 = 0, mode0 = 1, and the pin?s data register = 0) q1 and q3 are off. q2 is on. the gpio pin is capable of sinking 8 ma of current. high sink mode (mode1 = 1, mode0 = 1, and the pin?s data register = 0) q1 and q3 are off. q2 is on. the gpio pin is capable of sinking 50 ma of current. high drive mode (mode1 = 0 or 1, mode0 = 1, and the pin?s data register = 1) q1 and q2 are off. q3 is on. the gpio pin is capable of sourcing 2 ma of current. resistive mode (mode1 = 1, mode0 = 0, and the pin?s data register = 1) q2 and q3 are off. q1 is on. the gpio pin is pulled up with an internal 14-k resistor. note that open drain mode can be achieved by fixing the data and mode1 registers low, and switching the mode0 register. input thresholds are cmos, or ttl as shown in the table (see section for the input threshold voltage in ttl or cmos modes). both input modes include hysteresis to minimize noise sensi- tivity. in suspend mode, if a pin is used for a wake-up interrupt using an external r-c circuit, cmos mode is preferred for lowest power. bit #76543210 bit name reserved p1[1:0] mode0 read/write ------ww reset 00000000 b i t #76543210 bit name reserved p1[1:0] mode1 read/write ------ww reset 00000000 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 20 of 47 auxiliary input port port 2 serves as an auxiliary input port as shown in figure 12 . the port 2 inputs all have ttl input thresholds. figure 12. port 2 data register (address 0x02) bit [7:6]: reserved bit [5:4]: d+ (sclk) and d- (sdata) states the state of the d+ and d? pins can be read at port 2 data register. performing a read from the port pins returns their logic values. 1 = port pin is logic high 0 = port pin is logic low bit 3: reserved bit 2: p2.2 (internal clock mode only) in the internal clock mode, the xtalout pin can serve as a general purpose input, and its state can be read at port 2, bit 2 (p2.2). see section for more details. 1 = port pin is logic high 0 = port pin is logic low bit 1: p2.1 (internal clock mode only) in the internal clock mode, the xtalin pin can serve as a general purpose input, and its state can be read at port 2, bit 1 (p2.1). see section for more details. 1 = port pin is logic high 0 = port pin is logic low bit 0: p2.0/ vreg pin state in ps/2 mode, the vreg pin can be used as an input and its state can be read at port p2.0. section for more details. 1 = port pin is logic high 0 = port pin is logic low usb serial interf ace engine (sie) the sie allows the microcontroller to communicate with the usb host. the sie simplifies the interface between the microcon- troller and usb by incorporating hardware that handles the following usb bus activity independently of the microcontroller: translate the encoded received data and 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 appro- priate token bit once a valid token is received. place valid received data in the appropriate endpoint fifos. table 3. ports 0 and 1 output control truth table data register mode1 mode0 output drive strength input threshold 0 00 hi-z cmos 1h i - z t t l 0 01 medium (8 ma) sink cmos 1 high drive cmos 0 10 low (2 ma) sink cmos 1 resistive cmos 0 11 high (50 ma) sink cmos 1 high drive cmos bit # 7 6 5 4 3 2 1 0 bit name reserved d+ (sclk) state d? (sdata) state reserved p2.2 (internal clock mode only) p2.1 (internal clock mode only) p2.0 vreg pin state read/write - - rr - rrr reset 00000000 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 21 of 47 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 enumeration by decoding usb device requests. fill and empty the fifos. suspend/resume coordination. verify and select data toggle values. usb enumeration a typical usb enumeration sequence is shown below. in this description, ?firmware? refers to embedded firmware in the controller. 1. the host computer sends a setup packet followed by a data packet to usb address 0 requesting the device de- scriptor. 2. firmware decodes the request and retrieves its device descriptor from the program memory tables. 3. the host computer performs a control read sequence and firmware responds by sending the device descriptor over the usb bus, via the on-chip fifo. 4. after receiving the descriptor, the host sends a setup packet followed by a data packet to address 0 assigning a new usb address to the device. 5. firmware stores the new address in its usb device address register after the no-data control sequence completes. 6. the host sends a request for the device descriptor using the new usb address. 7. firmware decodes the request and retrieves the device descriptor from program memory tables. 8. the host performs a control read sequence and firmware responds by sending its device descriptor over the usb bus. 9. the host generates control reads from the device to request the configuration and report descriptors. 10.once the device receives a set configuration request, its functions may now be used. 11.firmware should take appropriate action for endpoint 1 trans- actions, which may occur from this point. usb port status and control usb status and control is regulated by the usb status and control register as shown in figure . figure 13. usb status and control register (address 0x1f) bit 7: ps/2 pull-up enable this bit is used to enable the internal ps/2 pull-up resistors on the sdata and sclk pins. normally the output high level on these pins is v cc , but note that the output will be clamped to approximately 1 volt above v reg if the vreg enable bit is set, or if the device address is enabled (bit 7 of the usb device address register, figure 14 ). 1 = enable ps/2 pull-up resistors. the sdata and sclk pins are pulled up internally to v cc with two resistors of approxi- mately 5 k (see section for the value of r ps2 ). 0 = disable ps/2 pull-up resistors. bit 6: vreg enable a 3.3v voltage regulator is integrated on chip to provide a voltage source for a 1.5-k pull-up resistor connected to the d? pin as required by the usb specification. note that the vreg output has an internal series resistance of approxi- mately 200 , the external pull-up resistor required is approx- imately 1.3-k (see figure 18 ). 1 = enable the 3.3v output voltage on the vreg pin. 0 = disable. the vreg pin c an be configured as an input. bit 5: usb-ps/2 interrupt select this bit allows the user to select whether an usb bus reset interrupt or a ps/2 activity interrupt will be generated when the interrupt conditions are detected. 1 = ps/2 interrupt mode. a ps/2 activity interrupt will occur if the sdata pin is continuously low for 128 to 256 s. 0 = usb interrupt mode (default state). in this mode, a usb bus reset interrupt will occur if the single ended zero (se0, d? and d+ are low) exists for 128 to 256 s. see section for more details. bit 4: reserved. must be written as a ?0?. bit 3: usb bus activity the bus activity bit is a ?sticky? bit that detects any non-idle usb event has occurred on the usb bus. once set to high by the sie to indicate the bus activity, this bit retains its logical high value until firmware clears it. writing a ?0? to this bit clears it; writing a ?1? preserves its value. the user firmware bit # 76543210 bit name ps/2 pull-up enable vreg enable usb reset- ps/2 activity interrupt mode reserved usb bus activity d+/d- forcing bit read/write r/w r/w r/w - r/w r/w r/w r/w reset 00000000 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 22 of 47 should check and clear this bit periodically to detect any loss of bus activity. firmware can clear the bus activity bit, but only the sie can set it. the 1.024-ms timer interrupt service routine is normally used to check and clear the bus activity bit. 1 = there has been bus activity since the last time this bit was cleared. this bit is set by the sie. 0 = no bus activity since last time this bit was cleared (by firmware). bit [2:0]: d+/d? forcing bit [2:0] forcing bits allow firmware to directly drive the d+ and d? pins, as shown in table 4 . outputs are driven with controlled edge rates in these modes for low emi. for forcing the d+ and d? pins in usb mode, d+/d? forcing bit 2 should be 0. set- ting d+/d? forcing bit 2 to ?1? puts both pins in an open-drain mode, preferred for applications such as ps/2 or led driving. table 4. control modes to force d+/d? outputs d+/d? forcing bit [2:0] control action application 000 not forcing (sie controls driver) any mode 001 force k (d+ high, d? low) usb mode 010 force j (d+ low, d? high) 011 force se0 (d? low, d+ low) 100 force d? low, d+ low ps/2 mode [2] 101 force d? low, d+ hiz 110 force d? hiz, d+ low 111 force d? hiz, d+ hiz note 2. for ps/2 operation, the d+/d- forcing bit [2:0] = 111b mode must be set initially (one time only) before using the other ps/2 force modes. [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 23 of 47 usb device the supports one usb device address with two endpoints: ep0 and ep1. usb address register the usb device address register contains a 7-bit usb address and one bit to enable usb communication. this register is cleared during a reset, setting the usb device address to zero and marking this address as disabled. figure 14 shows the format of the usb address register. figure 14. usb device address register (address 0x10) in either usb or ps/2 mode, this register is cleared by both hard- ware resets and the usb bus reset. see section for more infor- mation on the usb bus reset - ps/2 interrupt. bit 7: device address enable this bit must be enabled by firmware before the serial inter- face engine (sie) will respond to usb traffic at the address specified in bit [6:0]. 1 = enable usb device address. 0 = disable usb device address. bit [6:0]: device address bit[6:0] these bits must be set by firmware during the usb enumer- ation process (i.e., setaddress) to the non-zero address as- signed by the usb host. usb control endpoint all usb devices are required to have an endpoint number 0 (ep0) that is used to initialize and control the usb device. ep0 provides access to the device configuration information and allows generic usb status and control accesses. ep0 is bidirec- tional, as the device can both receive and transmit data. ep0 uses an 8-byte fifo at sram locations 0xf8-0xff, as shown in section . the ep0 endpoint mode register uses the format shown in figure 15 . figure 15. endpoint 0 mode register (address 0x12) the sie provides a locking feature to prevent firmware from overwriting bits in the usb end point 0 mode register. writes to the register have no effect from the point that bit[6:0] of the register are updated (by the sie) until the firmware reads this register. the cpu can unlock this register by reading it. because of these hardware-locking features, firmware should perform an read after a write to the usb endpoint 0 mode register and usb endpoint 0 count register ( figure 17 ) to verify that the contents have changed as desired, and that the sie has not updated these values. bit [7:4] of this register are cleared by any non-locked write to this register, regardless of the value written. bit 7: setup received 1 = a valid setup packet has been received. this bit is forced high from the start of the data packet phase of the setup transaction until the start of the ack packet returned by the sie. the cpu is prevented from clearing this bit 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. 0 = no setup received. this bit is cleared by any non-locked writes to the register. bit # 76543210 bit name device address enable device address bit read/write r/w r/w r/w r/w r/w r/w r/w r/w reset 00000000 bit # 76543210 bit name setup received in received out received acked transaction mode bit read/write r/w r/w r/w r/w r/w r/w r/w r/w reset 00000000 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 24 of 47 bit 6: in received 1 = a valid in packet has been received. this bit is updated to ?1? after the last received packet in an in transaction. this bit is cleared by any non-locked writes to the register. 0 = no in received. this bit is cleared by any non-locked writes to the register. bit 5: out received 1 = a valid out packet has been received. this bit is updated to ?1? after the last received packet in an out transaction. this bit is cleared by any non-locked writes to the register. 0 = no out received. this bit is cleared by any non-locked writes to the register. bit 4: acked transaction the acked transaction bit is set whenever the sie engages in a transaction to the register's endpoint that completes with an ack packet. 1 = the transaction completes with an ack 0 = the transaction does not complete with an ack bit [3:0]: mode bit[3:0] the endpoint modes determine how the sie responds to usb traffic that the host sends to th e endpoint. for example, if the endpoint mode bits [3:0] are set to 0001 which is nak in/out mode as shown in ta ble 6 , the sie will send nak handshakes in response to any in or out token sent to this endpoint. in this nak in/out mode, the sie will send an ack handshake when the host sends a setup token to this endpoint. the mode encoding is shown in ta ble 6 . additional information on the mode bits can be found in table 7 and table 8 . these modes give the firmware total control on how to respond to different tokens sent to the endpoints from the host. in addition, the mode bits are automatically changed by the sie in response to many usb transactions. for example, if the mode bit [3:0] are set to 1011 which is ack out-nak in mode as shown in table 6 , the sie will change the endpoint mode bit [3:0] to nak in/out (0001) mode after issuing an ack handshake in response to an out token. firmware needs to update the mode for t he sie to respond appropriate- ly. usb non-control endpoints the feature one non-control en dpoint, endpoint 1 (ep1). the ep1 mode register does not hav e the locking mechanism of the ep0 mode register. the ep1 mode register uses the format shown in figure 16 . ep1 uses an 8-byte fifo at sram locations 0xf0?0xf7 as shown in section . figure 16. usb endpoint ep1 mode registers (address 0x14) bit 7: stall 1 = 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. see section for the available modes. 0 = this bit must be set to low for all other modes. bit [6:5]: reserved. must be written to zero during register writes. bit 4: acked transaction the acked transaction bit is set whenever the sie engages in a transaction to the register's endpoint that completes with an ack packet. 1 = the transaction completes with an ack. 0 = the transaction does not complete with an ack. bit [3:0]: mode bit [3:0] the ep1 mode bits operate in the same manner as the ep0 mode bits (see section ). usb endpoint counter registers there are two endpoint counter re gisters, with identical formats for both control and non-control endpoints. these registers contain byte count information for usb transactions, as well as bits for data packet status. the format of these registers is shown in figure 17 . figure 17. endpoint 0 and 1 counter registers (addresses 0x11 and 0x13) bit # 76543210 bit name stall reserved acked transaction mode bit read/write r/w - - r/c r/w r/w r/w r/w reset 00000000 bit # 76543210 bit name data toggle data valid reserved byte count read/write r/w r/w - - r/w r/w r/w r/w reset 00000000 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 25 of 47 bit 7: data toggle this bit selects the data packet's toggle state. for in trans- actions, firmware must set this bi t to the select the transmitted data toggle. for out or setup transactions, the hardware sets this bit to the state of the received data toggle bit. 1 = data1 0 = data0 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 endpoint mode settings. refer to table 8 for more details. 1 = data is valid. 0 = data is invalid. if enabled, the endpoint interrupt will occur even if invalid data is received. bit [5:4]: reserved bit [3:0]: byte count bit [3:0] byte count bits indicate the number of data bytes in a trans- action: for in transactions, firmware loads the count with the number of bytes to be transmitted to the host from the end- point fifo. valid values are 0 to 8 inclusive. for out or set- up transactions, the count is updated by hardware to the number of data bytes received, plus 2 for the crc bytes. valid values are 2 to 10 inclusive. 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 un- locks it. this prevents firmware from overwriting a status up- date on incoming setup or out transactions before firm- ware has a chance to read the data. usb regulator output the vreg pin provides a regula ted output for connecting the pull-up resistor required for usb operation. for usb, a 1.5-k resistor is connected between the d? pin and the vreg voltage, to indicate low-speed usb operation. since the vreg output has an internal series resistance of approximately 200 , the external pull-up resistor required is r pu (see section ). the regulator output is placed in a high-impedance state at reset, and must be enabled by firmware by setting the vreg enable bit in the usb status and control register ( figure ). this simplifies the design of a comb ination ps/2-usb device, since the usb pull-up resistor can be left in place during ps/2 operation without loading the ps/2 line. in this mode, the vreg pin can be used as an input and its state can be read at port p2.0. refer to figure 12 for the port 2 data register. this input has a ttl threshold. in suspend mode, the regulator is automatically disabled. if vreg enable bit is set ( figure ), the vreg pin is pulled up to v cc with an internal 6.2-k resistor. this holds the proper v oh state in suspend mode. note that enabling the device for usb (by setting the device address enable bit, figure 14 ) activates the internal regulator, even if the vreg enable bit is cleared to 0. this insures proper usb signaling in the case where the vreg pin is used as an input, and an external regulator is provided for the usb pull-up resistor. this also limits the swing on the d? and d+ pins to about 1v above the internal regulator voltage, so the device address enable bit normally should only be set for usb operating modes. the regulator output is only designed to provide current for the usb pull-up resistor. in addition, the output voltage at the vreg pin is effectively disconnected when the device transmits usb from the internal sie. this m eans that the vreg pin does not provide a stable voltage during transmits, although this does not affect usb signaling. ps/2 operation the parts are optimized for combination usb or ps/2 devices, through the following features: 1. usb d+ and d? lines can also be used for ps/2 sclk and sdata pins, respectively. with usb disabled, these lines can be placed in a high-impedance state that will pull up to v cc . (disable usb by clearing the address enable bit of the usb device address register, figure 14 .) 2. an interrupt is provided to indicate a long low state on the sdata pin. this eliminates the need to poll this pin to check for ps/2 activity. refer to section for more details. 3. internal ps/2 pull-up resistors can be enabled on the sclk and sdata lines, so no gpio pins are required for this task (bit 7, usb status and control register, figure ). 4. the controlled slew rate outputs from these pins apply to both usb and ps/2 modes to minimize emi. 5. the state of the sclk and sdata pins can be read, and can be individually driven low in an open drain mode. the pins are read at bits [5:4] of port 2, and are driven with the control bits [2:0] of the usb status and control register. 6. the vreg pin can be placed into a high-impedance state, so that a usb pull-up resistor on the d?/sdata pin will not interfere with ps/2 operation (bit 6, usb status and control register). the ps/2 on-chip support circuitry is illustrated in figure 18 . [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 26 of 47 figure 18. diagram of usb - ps/2 system connections 12-bit free-running timer the 12-bit timer operates with a 1- s tick, provides two interrupts (128 s and 1.024ms) and allows the firmware to directly time events that are up to 4 ms in duration. the lower 8 bits of the timer can be read directly by the firmware. reading the lower 8 bits latches the upper 4 bits into a temporary register. when the firmware reads the upper 4 bits of t he timer, it is actually reading the count stored in the temporary r egister. the effect of this is to ensure a stable 12-bit timer value can be read, even when the two reads are separated in time. figure 19. timer lsb register (address 0x24) bit [7:0]: timer lower 8 bits figure 20. timer msb register (address 0x25) d?/sdata d+/sclk 5 k 3.3v regulator 5 k v cc usb - ps/2 driver 1.3 k vreg vreg enable ps/2 pull-up enable port 2.0 on-chip off-chip port 2.5 port 2.4 200 bit # 76543210 bit name timer [7:0] read/write rrrrrrrr reset 00000000 bit # 76543210 bit name reserved timer [11:8] read/write ----rrrr reset 00000000 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 27 of 47 bit [7:4]: reserved bit [3:0]: timer upper 4 bits figure 21. timer block diagram processor status and control register figure 22. processor status and control register (address 0xff) bit 7: irq pending when an interrupt is generated, it is registered as a pending interrupt. the interrupt will remain pending until its interrupt enable bit is set ( figure 23 and figure 24 ) and interrupts are globally enabled (bit 2, processor status and control regis- ter). at that point the intern al interrupt handling sequence will clear the irq pending bit until an other interrupt is detected as pending. this bit is only valid if the global interrupt enable bit is disabled. 1 = there are pending interrupts. 0 = no pending interrupts. bit 6: watchdog reset the watchdog timer reset (wdr) occurs when the internal watchdog timer rolls over. the timer will roll over and wdr will occur if it is not cleared within t watch (see section for the value of t watch ). this bit is cleared by an lvr/bor. note that a watchdog reset can occur with a por/lvr/bor event, as discussed at the end of this section. 1 = a watchdog reset occurs. 0 = no watchdog reset. bit 5: bus interrupt event the bus reset status is set whenever the event for the usb bus reset or ps/2 activity in terrupt occurs. the event type (usb or ps/2) is selected by the state of the usb-ps/2 inter- rupt mode bit in the usb status and control register (see figure ). the details on the event conditions that set this bit are given in section . in either mode, this bit is set as soon as the event has lasted for 128?256 s, and the bit will be set even if the interrupt is not enabled. the bit is only cleared by firmware or lvr/wdr. 1 = a usb reset occurred or ps/2 activity is detected, de- pending on usb-ps/2 interrupt select bit. bit # 76543210 bit name irq pending watchdog reset bus interrupt event lvr/bor reset suspend interrupt enable sense reserved run read/write r r/w r/w r/w r/w r - r/w reset 01010001 10 9 7 8 5 6432 1 mhz clock 1.024-ms interrupt 128- s interrupt to timer registers 8 1 0 11 l1 l0 l2l3 d3 d2 d1 d0 d7 d6 d5 d4 d3 d2 d1 d0 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 28 of 47 0 = no event detected since last cleared by firmware or lvr/wdr. bit 4: lvr/bor reset the low-voltage or brown-out reset is set to ?1? during a power-on reset. firmware can check bits 4 and 6 in the reset handler to determine whether a reset was caused by a lvr/bor condition or a watchdog timeout. this bit is not af- fected by wdr. note that a lvr/bor event may be followed by a watchdog reset before firmware begins executing, as explained at the end of this section. 1 = a por or lvr has occurred. 0 = no por nor lvr since this pit last cleared. bit 3: suspend writing a '1' to the suspend bit will halt the processor and cause the microcontroller to enter the suspend mode that sig- nificantly reduces power consumption. an interrupt or usb bus activity will cause the device to come out of suspend. after coming out of suspend, the device will resume firmware execution at the instruction fo llowing the iowr that put the part into suspend. when writing the suspend bit with a resume condition present (such as non-idle usb activity), the sus- pend state will still be entered, followed immediately by the wake-up process (with appropriate delays for the clock start-up). see section for more details on suspend mode operation. 1 = suspend the processor. 0 = not in suspend mode. cleared by the hardware when resuming from suspend. bit 2: interrupt enable sense this bit shows whether interrupts are enabled or disabled. firmware has no direct control over this bit as writing a zero or one to this bit position will have no effect on interrupts. this bit is further gated with the bit settings of the global interrupt enable register ( figure 23 ) and usb endpoint interrupt en- able register ( figure 24 ). instructions di, ei, and reti ma- nipulate the state of this bit. 1 = interrupts are enabled. 0 = interrupts are masked off. bit 1: reserved. must be written as a 0. bit 0: run this bit is manipulated by the halt instruction. when halt is executed, the processor clears th e run bit and halts at the end of the current instruction. the processor remains halted until a reset occurs (low-voltage, brown-out, or watchdog). this bit should normally be written as a ?1?. during power-up, or during a low-voltage reset, the processor status and control register is set to 00010001, which indicates a lvr/bor (bit 4 set) has occurred and no interrupts are pending (bit 7 clear). note that during the t start ms partial suspend at start-up (explained in section ), a watchdog reset will also occur. when a wdr occurs during the power-up suspend interval, firmware would read 01010001 from the status and control register after power-up. normally the lvr/bor bit should be cleared so that a subsequent wdr can be clearly identified. note that if a usb bus reset (long se0) is received before firmware examines this register, the bus interrupt event bit would also be set. during a watch dog reset, the processor status and control register is set to 01xx0001, which indicates a watch dog reset (bit 4 set) has occurred and no interrupts are pending (bit 7 clear). interrupts interrupts can be generated by the gpio lines, the internal free-running timer, on various usb events, ps/2 activity, or by the wake-up timer. all interrupts are maskable by the global interrupt enable register a nd the usb end point interrupt enable register. writing a ?1? to a bit position enables the interrupt associated with that bit position. during a reset, the contents of the interrupt enable re gisters are cleared, along with the global interrupt enable bit of the cpu, effectively disabling all interrupts. the interrupt controller contains a separate flip-flop for each interrupt. see figure 25 for the logic block diagram of the interrupt controller. when an interrupt is generated it is first regis- tered as a pending interrupt. it will stay pending until it is serviced or a reset occurs. a pending interrupt will only generate an interrupt request if it is enabled by the corresponding bit in the interrupt enable registers. the highest priority interrupt request will be serviced following the completion of the currently executing instruction. when servicing an interrupt, the hardware will first disable all interrupts by clearing the global interrupt enable bit in the cpu (the state of this bit can be read at bit 2 of the processor status and control register). next, the flip-flop of the current interrupt is cleared. this is followed by an automatic call instruction to the rom address associated with the interrupt being serviced (i.e., the interrupt vector, see section ). the instruction in the interrupt table is typically a jmp instruction to the address of the interrupt service routine (isr). the user can re-enable inter- rupts in the interrupt service routine by executing an ei instruction. interrupts can be nested to a level limited only by the available stack space. the program counter value and the carry and zero flags (cf, zf) are stored onto the program stack by the automatic call instruction generated as part of the interrupt acknowledge process. the user firmware is responsible for ensuring that the processor state is preserved and restored during an interrupt. the push a instruction should typically be used as the first command in the isr to save the accumulator value and the pop a instruction should be used just before the reti instruction to restore the accumulator value. the program counter, cf and zf are restored and interrupts are enabled when the reti instruction is executed. the di and ei instructions can be used to disable and enable interrupts, respectively. these instructions affect only the global interrupt enable bit of the cpu. if desired, ei can be used to re-enable interrupts while inside an isr, instead of waiting for the reti that exits the isr. while the global interrupt enable bit is cleared, the presence of a pending interrupt can be detected by examining the irq sense bit (bit 7 in the processor status and control register). [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 29 of 47 interrupt vectors the interrupt vectors supported by the device are listed in ta b l e 5 . the highest priority interrupt is #1 (usb bus reset / ps/2 activity), and the lowest prio rity interrupt is #11 (wake-up timer). although reset is not an interrupt, the first instruction executed after a reset is at ro m address 0x0000, which corre- sponds to the first entry in the in terrupt vector table. interrupt vectors occupy 2 bytes to allow for a 2-byte jmp instruction to the appropriate interrupt service routine (isr). interrupt latency interrupt latency can be calculated from the following equation: interrupt latency = (number of clock cycles remaining in the current instruction) + (10 clock cycles for the call instruction) + (5 clock cycles for the jmp instruction) for example, if a 5-clock-cycle in struction such as jc is being executed when an interrupt occurs , the first instruction of the interrupt service routine will ex ecute a minimum of 16 clocks (1+10+5) or a maximum of 20 clo cks (5+10+5) after the interrupt is issued. with a 6 mhz external resonator, internal cpu clock speed is 12 mhz, so 20 clocks take 20/12 mhz = 1.67 s. interrupt sources the following sections provide details on the different types of interrupt sources. figure 23. global interrupt en able register (address 0x20) bit 7: wake-up interrupt enable the internal wake-up timer is normally used to wake the part from suspend mode, but it can also provide an interrupt when the part is awake. the wake-up timer is cleared whenever the wake-up interrupt enable bit is written to a 0, and runs when- ever that bit is written to a 1. when the interrupt is enabled, the wake-up timer provides periodic interrupts at multiples of period, as described in section . 1 = enable wake-up timer for periodic wake-up. 0 = disable and power-off wake-up timer. bit 6: gpio interrupt enable each gpio pin can serve as an interrupt input. during a reset, gpio interrupts are disabled by clearing all gpio interrupt enable registers. writing a ?1? to a gpio interrupt enable bit enables gpio interrupts from the corresponding input pin. these registers are shown in figure 26 for port 0 and figure for port 1. in addition to enabling the desired individual pins for interrupt, the main gpio interrupt must be enabled, as explained in section . the polarity that triggers an interrupt is controlled indepen- dently for each gpio pin by the gpio interrupt polarity reg- isters. setting a polarity bit to ?0? allows an interrupt on a falling table 5. interrupt vector assignments interrupt vector number rom address function not applicable 0x0000 execution after reset begins here. 1 0x0002 usb bus reset or ps/2 activity interrupt 2 0x0004 128- s timer interrupt 3 0x0006 1.024-ms timer interrupt 4 0x0008 usb endpoint 0 interrupt 5 0x000a usb endpoint 1 interrupt 6 0x000c reserved 7 0x000e reserved 8 0x0010 reserved 9 0x0012 reserved 10 0x0014 gpio interrupt 11 0x0016 wake-up timer interrupt bit # 76543210 bit name wake-up interrupt enable gpio interrupt enable reserved 1.024-ms interrupt enable 128- s interrupt enable usb bus reset / ps/2 activity intr. enable read/write r/w r/w - - - r/w r/w r/w reset 00000000 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 30 of 47 gpio edge, while setting a polarity bit to ?1? allows an interrupt on a rising gpio edge. the polarity registers reset to 0 and are shown in figure for port 0 and figure 29 for port 1. all of the gpio pins share a single interrupt vector, which means the firmware will need to read the gpio ports with enabled interrupts to determine which pin or pins caused an interrupt.the gpio interrupt st ructure is illustrated in figure . note that if one port pin triggered an interrupt, no other port pins can cause a gpio interrupt until that port pin has re- turned to its inactive (non-trigger) state or its corresponding port interrupt enable bit is cleared. the cy7c63221/31a does not assign interrupt priority to different port pins and the port interrupt enable registers are not affected by the interrupt acknowledge process. 1 = enable 0 = disable bit [5:3]: reserved bit 2: 1.024-ms interrupt enable the 1.024-ms interrupts are periodic timer interrupts from the free-running timer (based on the 6-mhz clock). the user should disable this interrupt before going into the suspend mode to avoid possible conflicts between servicing the timer interrupts (128- s interrupt and 1.024-ms interrupt) first or the suspend request first when waking up. 1 = enable. periodic interrupts will be generated approximate- ly every 1.024 ms. 0 = disable. bit 1: 128- s interrupt enable the 128- s interrupt is another sour ce of timer interrupt from the free-running timer. the user should disable both timer in- terrupts (128- s and 1.024-ms) before going into the suspend mode to avoid possible conflicts between servicing the timer interrupts first or the suspend request first when waking up. 1 = enable. periodic interrupts will be generated approximate- ly every 128 s. 0 = disable. bit 0: usb bus reset - ps/2 interrupt enable the function of this interrupt is selectable between detection of either a usb bus reset condition, or ps/2 activity. the se- lection is made with the usb-ps/2 interrupt mode bit in the usb status and control register ( figure ). in either case, the interrupt will occur if the selected condition exists for 256 s, and may occur as early as 128 s. a usb bus reset is indicated by a single-ended zero (se0) on the usb d+ and d? pins. the usb bus reset interrupt occurs when the se0 condition ends. ps/2 activity is indicated by a continuous low on the sdata pin. the ps/2 interrupt occurs as soon as the long low state is detected. during the entire interval of a usb bus reset or ps/2 interrupt event, the usb device addr ess register is cleared. the bus reset/ps/2 inte rrupt may occur 128 s after the bus condition is removed. 1 = enable 0 = disable figure 24. endpoint interrupt enable register (address 0x21) bit [7:3]: reserved. bit [2:1]: ep1 interrupt enable the non-control endpoint interrupt (ep1) is generated when: ? the usb host writes valid data to an endpoint fifo. howev- er, if the endpoint is in ack out modes, an interrupt is gen- erated regardless of data packet validity (i.e., good crc). firmware must che ck for data validity. ? the device sie sends a nak or stall handshake packet to the usb host during the host attempts to read data from the endpoint (ins). ? the device receives an ack handshake after a successful read transaction (in) from the host. ? the device sie sends a nak or stall handshake packet to the usb host during the host attempts to write data (outs) to the endpoint fifo. 1 = enable 0 = disable refer to table 6 for more information. bit 0: ep0 interrupt enable if enabled, the control endpoint interrupt is generated when: ? the endpoint 0 mode is set to accept a setup token. ? after the sie sends a 0 byte packet in the status stage of a control transfer. ? the usb host writes valid data to an endpoint fifo. howev- er, if the endpoint is in ack out modes, an interrupt is gen- erated regardless of what data is received. firmware must check for data validity. ? the device sie sends a nak or stall handshake packet to the usb host during the host attempts to read data from the endpoint (ins). ? the device sie sends a nak or stall handshake packet to the usb host during the host attempts to write data (outs) to the endpoint fifo. 1 = enable ep0 interrupt 0 = disable ep0 interrupt bit # 76543210 bit name reserved ep1 interrupt enable ep0 interrupt enable read/write ------r / wr / w reset 00000000 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 31 of 47 figure 25. interrupt controller logic block diagram figure 26. port 0 interrupt enable register (address 0x04) bit [7:0]: p0 [7:0] interrupt enable 1 = enables gpio interrupts from the corresponding input pin. 0 = disables gpio interrupts from the corresponding input pin. figure 27. port 1 interrupt enable register (address 0x05) bit # 76543210 bit name p0 interrupt enable read/write wwwwwwww reset 00000000 clr global interrupt interrupt acknowledge irqout usb-ps/2 clear interrupt interrupt priority encoder enable [0] d q 1 enable bit clr usb-ps/2 irq 128- s clr 128- s irq 1-ms clr 1-ms irq ep0 irq ep0 clr wake-up irq vector enable [7] clk clr d q clk 1 wake-up clr int wake-up int usb- irq pending irq controlled by di, ei, and reti instructions to cpu cpu ps/2 gpio irq gpio clr ep1 irq ep1 clr (reg 0x20) (reg 0x20) clr enable [1] d q 1 clk int ep1 (reg 0x21) int enable sense (bit 7, reg 0xff) (bit 2, reg 0xff) bit # 76543210 bit name reserved p1[1:0] interrupt enable read/write ------ww reset 00000000 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 32 of 47 bit [7:0]: p1 [7:0] interrupt enable 1 = enables gpio interrupts from the corresponding input pin. 0 = disables gpio interrupts from the corresponding input pin. the polarity that triggers an interrupt is controlled independently for each gpio pin by the gpio interrupt polarity registers. figure and figure 29 control the interrupt polarity of each gpio pin. figure 28. port 0 interrupt po larity register (address 0x06) bit [7:0]: p0[7:0] interrupt polarity 1 = rising gpio edge 0 = falling gpio edge figure 29. port 1 interrupt po larity register (address 0x07) bit [7:0]: p1[7:0] interrupt polarity 1 = rising gpio edge 0 = falling gpio edge figure 30. gpio interrupt diagram bit # 76543210 bit name p0 interrupt polarity read/write wwwwwwww reset 00000000 bit # 76543210 bit name reserved p1[1:0] interrupt polarity read/write ------ww reset 00000000 port bit interrupt or gate gpio interrupt flip flop clr gpio pin 1 = enable 0 = disable port bit interrupt enable register 1 = enable 0 = disable interrupt priority encoder irqout interrupt vector d q m u x 1 (1 input per gpio pin) global gpio interrupt enable (bit 6, register 0x20) ira polarity register [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 33 of 47 usb mode tables the following tables give details on mode setting for the usb serial interface engine (sie) fo r both the control endpoint (ep0) and non-control endpoint (ep1). note 3. stall bit is the bit 7 of the usb non-control device endpoint mode registers. refer to section for more explanation. mode column: the 'mode' column contains the mnemonic names given to the modes of the endpoint. the mode of the endpoint is determined by the 4 bit binaries in the 'encoding' column as discussed below. the status in and status out mo des 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 ( figure 15 and figure 16 ). 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 ( figure 15 ) are set to '0001', which is nak in/out mode as shown in table 6 above, the sie of the part will send an ack handshake in response to setup tokens and nak any in or out tokens. for more information on the functionality of the serial interface engine (sie), see section . setup, in, and out columns: depending on the mode specified in the 'encoding' column, the 'setup', 'in', and 'out' columns contain the device 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 whethe r 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 conditions is not met, the sie will respond with either a stall or ignore. table 8 gives detailed analysis of all possible cases. 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 ( figure 17 ) in response to any in token. a 'tx 0 byte' entry in the in column means that the sie will transmit a zero byte packet in response to any in sent to the endpoint. sending a 0 byte packet is to complete the status stage of a control transfer. table 6. usb register mode encoding for control and non-control endpoint mode encoding setup in out comments disable 0000 ignore ignore ignore ignore all usb traffic to this endpoint nak in/out 0001 accept nak nak on control endpoint, after successfully sending an ack handshake to a setup packet, the sie forces the endpoint mode (from modes other than 0000) to 0001. the mode is also changed by the sie to 0001 from mode 1011 on issuance of ack handshake to an out. status out only 0010 accept stall check for control endpoints stall in/out 0011 accept stall stall for control endpoints ignore in/out 0100 accept ignore ignore for control endpoints reserved 0101 ignore ignore always reserved status in only 0110 accept tx 0 byte stall for control endpoints reserved 0111 ignore tx count ignore reserved nak out 1000 ignore ignore nak in mode 1001, after sending an ack handshake to an out, the sie changes the mode to 1000 ack out( stall [3] = 0) ack out (stall [3] = 1) 1001 1001 ignore ignore ignore ignore ack stall this mode is changed by the sie to mode 1000 on issuance of ack handshake to an out nak out - status in 1010 accept tx 0 byte nak ack out - nak in 1011 accept nak ack this mode is changed by the sie to mode 0001 on issuance of ack handshake to an out nak in 1100 ignore nak ignore an ack from mode 1101 changes the mode to 1100 ack in (stall [3] =0) ack in( stall [3] =1) 1101 1101 ignore ignore tx count stall ignore ignore this mode is changed by the sie to mode 1100 on issuance of ack handshake to an in nak in - status out 1110 accept nak check an ack from mode 1111 ch anges the mode to 1110 ack in - status out 1111 accept tx count check this mode is changed by the sie to mode 1110 on issuance of ack handshake to an in [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 34 of 47 an 'ignore' means that the device sends no handshake tokens. an 'accept' means that the sie will respond with an ack to a valid setup transaction. comments column: some mode bits are automatic ally changed by the sie in response to many usb transaction s. for example, if the mode bits [3:0] are set to '1111' which is ack in-status out mode as shown in table 6 , the sie will change the endpoint mode bits [3:0] to nak in-statu s out mode (1110) after acking a valid status stage out token. the firmware needs to update the mode for the sie to respond appropriately. see ta b l e 6 for more details on what modes will be changed by the sie. any setup packet to an enabled endpoint with mode set to accept setups will be changed by the sie to 0001 (naking). any mode set to accept a setup will send an ack handshake to a valid setup token. a disabled endpoint will remain disabled until changed by firmware, and all endpoints reset to the disabled mode (0000). firmware normally enables the endpoint mode after a setcon- figuration request. the control endpoint has three status bits for identifying the token type received (setup, in, or out), but the endpoint must be placed in the correct mode to function as such. non-control endpoint should not be placed into modes that accept setups. the response of the sie can be summarized as follows: 1. the sie will only respond to valid transactions, and will ignore non-valid ones. 2. the sie will generate an interrupt when a valid transaction is completed or when the fifo is corrupted. fifo corruption occurs during an out or setup transaction to a valid internal address, that ends with a non-valid crc. 3. an incoming data packet is valid if the count is < endpoint size + 2 (includes crc) and passes all error checking; 4. an in will be ignored by an out configured endpoint and visa versa. 5. the in and out pid status is updated at the end of a trans- action. 6. the setup pid status is updated at the beginning of the data packet phase. 7. the entire endpoint 0 mode register and the count register are locked to cpu writes at the end of any transaction to that endpoint in which an ack is transferred. these registers are only unlocked by a cpu read of these registers, and only if that read happens after the transaction completes. this repre- sents about a 1- s window in which the cpu is locked from register writes to these usb r egisters. normally the firmware should perform a register read at the beginning of the endpoint isrs to unlock and get the mode register infor- mation. the interlock on the mode and count registers ensures that the firmware reco gnizes the changes that the sie might have made during the previous transaction. table 7. decode table for table 8 : ?details of modes for differing traffi c conditions? endpoint mode encoding properties of incoming packet changes to the internal register made by the sie as a result of the incoming token interrupt? end point mode 3 210 to - ken count buffer dval dtog dval count setup in out ack 3 2 1 0 re- sponse int bit[3:0], figure 17 sie?s re- sponse data valid (bit 6, figure 17 ) endpoint mode changed by the sie. data 0/1 (bit 7, figure 17 ) received token (setup, in,out) the validity of the received data acknowledge transaction completed (bit4, figure 15 /3) the quality status of the dma buffer pid status bits (bit[7:5], figure 15 ) the number of received bytes legend: uc: unchanged tx: transmit tx0: transmit 0-length packet x: don?t care rx: receive available for control endpoint only [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 35 of 47 table 8. details of modes for differing traffic conditions end point mode pid set end point mode 3210 rcved token cou nt buffer dval dtog dval coun t set- up in ou t ack 3 2 1 0 response int setup packet (if accepting) see6 setup <= 10 data valid up- dates 1 up- dates 1 u c uc 1 0 001ack ye s see6 setup > 10 junk x up- dates up- dates up- dates 1 u cucuc nochang e ignore ye s see 6 setup x junk invalid up- dates 0 up- dates 1 u cucuc nochang e ignore ye s disabled 0000xxucxucucucuc u cucuc nochang e ignore no nak in/out 0001out x uc x uc uc uc uc u c1 uc nochang enak ye s 0 0 0 1 out > 10 uc x uc uc uc uc u cucuc nochang e ignore no 0 0 0 1 out x uc invalid uc uc uc uc u cucuc nochang e ignore no 0 0 0 1 in x uc x uc uc uc uc 1 uc uc nochang en a k ye s ignore in/out 0100out x uc x uc uc uc uc u cucuc nochang e ignore no 0 1 0 0 in x uc x uc uc uc uc u cucuc nochang e ignore no stall in/out 0011out x uc x uc uc uc uc u c1 uc nochang estall ye s 0 0 1 1 out > 10 uc x uc uc uc uc u cucuc nochang e ignore no 0 0 1 1 out x uc invalid uc uc uc uc u cucuc nochang e ignore no 0 0 1 1 in x uc x uc uc uc uc 1 uc uc nochang es t a l l ye s control write ack out/nak in 1011out <= 10 data valid up- dates 1 up- dates uc u c 1 1 0 001ack ye s 1 0 1 1 out > 10 junk x up- dates up- dates up- dates uc u c1 uc nochang e ignore ye s 1 0 1 1 out x junk invalid up- dates 0 up- dates uc u c1 uc nochang e ignore ye s 1 0 1 1 in x uc x uc uc uc uc 1 uc uc nochang en a k ye s nak out/status in 1010out <= 10 uc valid uc uc uc uc u c1 uc nochang enak ye s 1 0 1 0 out > 10 uc x uc uc uc uc u cucuc nochang e ignore no 1 0 1 0 out x uc invalid uc uc uc uc u cucuc nochang e ignore no 1 0 1 0 in x uc x uc uc uc uc 1 uc 1 nochang et x 0 b y t e ye s status in only 0110out <= 10 uc valid uc uc uc uc u c 1 uc 0 011stall ye s [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 36 of 47 0 1 1 0 out > 10 uc x uc uc uc uc u cucuc nochang e ignore no 0 1 1 0 out x uc invalid uc uc uc uc u cucuc nochang e ignore no 0 1 1 0 in x uc x uc uc uc uc 1 uc 1 nochang et x 0 b y t e ye s control read ack in/status out 1 1 1 1 out 2 uc valid 1 1 up- dates uc u c1 1 nochang ea c k ye s 1 1 1 1 out 2 uc valid 0 1 up- dates uc u c 1 uc 0 011stall ye s 1 1 1 1 out !=2 uc valid up- dates 1 up- dates uc u c 1 uc 0 011stall ye s 1 1 1 1 out > 10 uc x uc uc uc uc u cucuc nochang e ignore no 1 1 1 1 out x uc invalid uc uc uc uc u cucuc nochang e ignore no 1 1 1 1 in x uc x uc uc uc uc 1 uc 1 1 1 1 0 ack (back) ye s nak in/status out 1 1 1 0 out 2 uc valid 1 1 up- dates uc u c1 1 nochang ea c k ye s 1 1 1 0 out 2 uc valid 0 1 up- dates uc u c 1 uc 0 011stall ye s 1 1 1 0 out !=2 uc valid up- dates 1 up- dates uc u c 1 uc 0 011stall ye s 1 1 1 0 out > 10 uc x uc uc uc uc u cucuc nochang e ignore no 3 2 1 0 token coun t buffer dval dtog dval coun t set- up in ou t ack 3 2 1 0 response int 1 1 1 0 out x uc invalid uc uc uc uc u cucuc nochang e ignore no 1 1 1 0 in x uc x uc uc uc uc 1 uc uc nochang en a k ye s status out only 0 0 1 0 out 2 uc valid 1 1 up- dates uc u c1 1 nochang ea c k ye s 0 0 1 0 out 2 uc valid 0 1 up- dates uc u c 1 uc 0 011stall ye s 0 0 1 0 out !=2 uc valid up- dates 1 up- dates uc u c 1 uc 0 011stall ye s 0 0 1 0 out > 10 uc x uc uc uc uc u cucuc nochang e ignore no 0 0 1 0 out x uc invalid uc uc uc uc u cucuc nochang e ignore no 0 0 1 0 in x uc x uc uc uc uc 1 uc uc 0 0 1 1 stall ye s out endpoint ack out, stall bit = 0 ( figure 16 ) 1001out <= 10 data valid up- dates 1 up- dates uc u c 1 1 1 000ack ye s 1 0 0 1 out > 10 junk x up- dates up- dates up- dates uc u c1 uc nochang e ignore ye s 1 0 0 1 out x junk invalid up- dates 0 up- dates uc u c1 uc nochang e ignore ye s 1 0 0 1 in x uc x uc uc uc uc u cucuc nochang e ignore no ack out, stall bit = 1 ( figure 16 ) table 8. details of modes for differing traffic conditions (continued) end point mode pid set end point mode [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 37 of 47 1001out <= 10 uc valid uc uc uc uc u c1 uc nochang estall ye s 1 0 0 1 out > 10 uc x uc uc uc uc u cucuc nochang e ignore no 1 0 0 1 out x uc invalid uc uc uc uc u cucuc nochang e ignore no 1 0 0 1 in x uc x uc uc uc uc u cucuc nochang e ignore no nak out 1000out <= 10 uc valid uc uc uc uc u c1 uc nochang enak ye s 1 0 0 0 out > 10 uc x uc uc uc uc u cucuc nochang e ignore no 1 0 0 0 out x uc invalid uc uc uc uc u cucuc nochang e ignore no 1 0 0 0 in x uc x uc uc uc uc u cucuc nochang e ignore no reserved 0101out x up- dates up- dates up- dates up- dates up- dates uc u c1 1 nochang er x ye s 0 1 0 1 in x uc x uc uc uc uc u cucuc nochang e ignore no in endpoint ack in, stall bit = 0 ( figure 16 ) 1101out x uc x uc uc uc uc u cucuc nochang e ignore no 1 1 0 1 in x uc x uc uc uc uc 1 uc 1 1 1 0 0 ack (back) ye s ack in, stall bit = 1 ( figure 16 ) 1101out x uc x uc uc uc uc u cucuc nochang e ignore no 1 1 0 1 in x uc x uc uc uc uc 1 uc uc nochang es t a l l ye s nak in 1100out x uc x uc uc uc uc u cucuc nochang e ignore no 1 1 0 0 in x uc x uc uc uc uc 1 uc uc nochang en a k ye s reserved 0111out x uc x uc uc uc uc u cucuc nochang e ignore no 0 1 1 1 in x uc x uc uc uc uc 1 uc uc nochang et x ye s table 8. details of modes for differing traffic conditions (continued) end point mode pid set end point mode [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 38 of 47 register summary address register name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 read/write)/ both(b) default/ reset gpio configuration ports 0, 1, and 2 0x00 port 0 data p0 bbbbbbbb 00000000 0x01 port 1 data reserved p1[1:0] ------ bb 00000000 0x02 port 2 data reserved d+(sclk) state d- (sdata) state reserved p2.2(int clk mode only) p2.1 (int clk mode only) p2.0 vreg pin state -- rr - rrr 00000000 0x0a gpio port 0 mode 0 p0[7:0] mode0 wwwwwwww 00000000 0x0b gpio port 0 mode 1 p0[7:0] mode1 wwwwwwww 00000000 0x0c gpio port 1 mode 0 reserved p1[1:0] mode0 ------ ww 00000000 0x0d gpio port 1 mode 1 reserved p1[1:0] mode1 ------ ww 00000000 0x04 port 0 interrupt enable p0[7:0] interrupt enable wwwwwwww 00000000 0x05 port 1 interrupt enable reserved p1[1:0] interrupt enable ------ ww 00000000 0x06 port 0 interrupt polarity p0[7:0] interrupt polarity wwwwwwww 00000000 0x07 port 1 interrupt polarity reserved p1[1:0] interrupt polarity ------ ww 00000000 clock config. 0xf8 clock configuration ext. clock resume delay wake-up timer adjust bit [2:0] low voltage reset disable precision usb clocking enable internal clock output disable external oscillator enable bbbbbbbb 00000000 endpoint 0, i and 2 configuration 0x10 usb device address device address enable device address bbbbbbbb 00000000 0x12 ep0 mode setup received in received out received acked transaction mode bit bbbbbbbb 00000000 0x14 ep1 mode register stall reserved acked transaction mode bit b -- bbbbb 00000000 0x11, 0x13 ep0 and 1counter data 0/1 to g g l e data valid reserved byte count bb -- bbbb 00000000 usb- sc 0x1f usb status and control ps/2 pull-up enable vreg enable usb reset-ps/2 activity interrupt mode reserved usb bus activity d+/d- forcing bit bbb - bbbb 00000000 interrupt 0x20 global interrupt enable wake-up interrupt enable gpio interrupt enable reserved 1.024 ms interrupt enable 128 s interrupt enable usb bus reset-ps/2 activity intr. enable bb --- bbb 00000000 0x21 endpoint interrupt enable reserved ep1 interrupt enable ep0 interrupt enable ------ bb 00000000 timer 0x24 timer lsb timer bit [7:0] rrrrrrrr 00000000 0x25 timer (msb) reserved timer bit [11:8] ---- rrrr 00000000 proc sc. 0xff process status & control irq pending watch dog reset bus interrupt event lvr/bor reset suspend interrupt enable sense reserved run rbbbbr - b see section [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 39 of 47 absolute maximum ratings storage temperature ................ .............. ... ?65c to +150c ambient temperature with power applied...... ?0c to +70c supply voltage on v cc relative to v ss ............?0.5v to +7.0v dc input voltage .................................. ?0.5v to +v cc +0.5v dc voltage applied to outputs in high z state .... ?0.5v to + v cc +0.5v maximum total sink output current into port 0 and 1 and pins 70 ma maximum total source output current into port 0 and 1 and pins 30 ma maximum on-chip power dissipation on any gpio pin50 mw power dissipation..................................................... 300 mw static discharge voltage ...... ........... ............ .............. >2000v latch-up current ..................................................... >200 ma dc characteristics f osc = 6 mhz; operating te mperature = 0 to 70c parameter min max units conditions general v cc1 operating voltage v lvr 5.5 v note 4 v cc2 operating voltage 4.35 5.25 v note 4 i cc1 v cc operating supply current - internal oscillator mode. typical i cc1 = 16 ma [5] 20 ma v cc = 5.5v, no gpio loading v cc = 5.0v. t = room temperature i cc2 v cc operating supply current - external oscillator mode. typical i cc2 = 13 ma [5] 17 ma v cc = 5.5v, no gpio loading v cc = 5.0v. t = room temperature i sb1 standby current - no wake-up osc 25 a oscillator off, d? > 2.7v i sb2 standby current - with wake-up osc 75 a oscillator off, d? > 2.7v v pp programming voltage (disabled) ?0.4 0.4 v t rsntr resonator start-up interval 256 sv cc = 5.0v, ceramic resonator i il input leakage current 1 a any i/o pin i snk max i ss gpio sink current 70 ma cumulative across all ports [6] i src max i cc gpio source current 30 ma cu mulative across all ports [6] low-voltage and power-on reset v lvr low-voltage reset trip voltage 3.5 4.0 v v cc below v lvr for >100 ns [7] t vccs v cc power-on slew time 100 ms linear ramp: 0 to 4v [8] usb interface v reg vreg regulator output voltage 3.0 3.6 v load = r pu +r pd [9, 10] c reg capacitance on vreg pin 300 pf external cap not required v ohu static output high, driven 2.8 3.6 v r pd to gnd [4] v olu static output low 0.3 v with r pu to vreg pin v ohz static output high, idle or suspend 2.7 3.6 v r pd connected d? to gnd, r pu connected d? to vreg pin [4] notes 4. full functionality is guaranteed in v cc1 range, except usb transmitter specifications and gpio output currents are guaranteed for v cc2 range. 5. bench measurements taken under nominal operating conditions. spec cannot be guaranteed at final test. 6. total current cumulative across all port pins, limited to minimize power and ground-drop noise effects. 7. lvr is automatically disabled during suspend mode. 8. lvr will re-occur whenever v cc drops below v lvr . in suspend or with lvr disabled, bor occurs whenever v cc drops below approximately 2.5v. 9. v rg specified for regulator enabled, idle conditions (i.e., no usb traffic), with load resistors listed. during usb transmits from the internal sie, the vreg output is not regulated, and should not be used as a general source of regulated voltage in that case. during receive of usb data, the vreg output drops when d? is low due to internal series resistance of approximately 200 at the vreg pin. 10. in suspend mode, v rg is only valid if r pu is connected from d? to vreg pin, and r pd is connected from d? to ground [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 40 of 47 note 11. the 200 internal resistance at the vreg pin gives a standard usb pull-up using this value. alternately, a 1.5 k , 5% pull-up from d? to an external 3.3v supply can be used. v di differential input sensit ivity 0.2 v |(d+)?(d?)| v cm differential input common mode range 0.8 2.5 v v se single ended receiver threshold 0.8 2.0 v c in transceiver capacitance 20 pf i lo hi-z state data line leakage ?10 10 a0 v < v in <3.3 v (d+ or d? pins) r pu external bus pull-up resistance (d?) 1.274 1.326 k 1.3 k 2% to vreg [11] r pd external bus pull-down resistance 14.25 15.75 k 15 k 5% to gnd ps/2 interface v olp static output low 0.4 v isink = 5 ma, sdata or sclk pins r ps2 internal ps/2 pull-up resistance 3 7 k sdata, sclk pins, ps/2 enabled general purpose i/o interface r up pull-up resistance 8 24 k v icr input threshold voltage, cmos mode 40% 60% v cc low to high edge, port 0 or 1 v icf input threshold voltage, cmos mode 35% 55% v cc high to low edge, port 0 or 1 v hc input hysteresis voltage, cmos mode 3% 10% v cc high to low edge, port 0 or 1 v ittl input threshold voltage, ttl mode 0.8 2.0 v ports 0, 1, and 2 v ol1a v ol1b output low voltage, high drive mode 0.8 0.4 v v i ol1 = 50 ma, ports 0 or 1 [4] i ol1 = 25 ma, ports 0 or 1 [4] v ol2 output low voltage, medium drive mode 0.4 v i ol2 = 8 ma, ports 0 or 1 [4] v ol3 output low voltage, low drive mode 0.4 v i ol3 = 2 ma, ports 0 or 1 [4] v oh output high voltage, strong drive mode v cc ?2 v port 0 or 1, i oh = 2 ma [4] r xin pull-down resistance, xtalin pin 50 k internal clock mode only parameter min max units conditions [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 41 of 47 switching characteristics notes 12. initially f iclk2 =f iclk until a usb packet is received. 13. wake-up time for wake-up adjust bits cleared to 000b (minimum setting) 14. tested at 200 pf. 15. measured at cross-over point of differential data signals. 16. non-usb mode refers to driving the d?/sdata and/or d+/sclk pi ns with the control bits of the usb status and control register , with control bit 2 high. 17. per the usb 2.0 specification, table 7.7, note 10, the first transition from the idle state is excluded. parameter description min. max. unit conditions internal clock mode f iclk internal clock frequency 5.7 6.3 mhz internal clock mode enabled f iclk2 internal clock frequency, usb mode 5.91 6.09 mhz internal clock mode enabled, bit 2 of register 0xf8h is set (precision usb clocking) [12] external os cillator mode t cyc input clock cycle time 164.2 169.2 ns usb operation, with external 1.5% ceramic resonator or crystal t ch clock high time 0.45 t cyc ns t cl clock low time 0.45 t cyc ns reset timing t start time-out delay after lvr/bor 24 60 ms t wake internal wake-up period 1 5 ms enabled wake-up interrupt [13] t watch watchdog timer period 10.1 14.6 ms f osc = 6 mhz usb driver characteristics t r transition rise time 75 ns cload = 200 pf (10% to 90% [4] ) t r transition rise time 300 ns cload = 600 pf (10% to 90% [4] ) t f transition fall time 75 ns cload = 200 pf (10% to 90% [4] ) t f transition fall time 300 ns cload = 600 pf (10% to 90% [4] ) t rfm rise/fall time matching 80 125 % t r /t f [4, 14] v crs output signal crossover voltage [17] 1.3 2.0 v cload = 200 to 600 pf [4] usb data timing t drate low speed data rate 1.4775 1.5225 mb/s ave. bit rate (1.5 mb/s 1.5%) t djr1 receiver data jitter tolerance ?75 75 ns to next transition [15] t djr2 receiver data jitter tolerance ?45 45 ns for paired transitions [15] t deop differential to eop transition skew ?40 100 ns note 15 t eopr2 eop width at receiver 670 ns accepts as eop [15] t eopt source eop width 1.25 1.50 s t udj1 differential driver jitter ?95 95 ns to next transition, figure 35 t udj2 differential driver jitter ?150 150 ns to paired transition, figure 35 t lst width of se0 during diff. transition 210 ns non-usb mode driver characteristics note 16 t fps2 sdata / sck transition fall time 50 300 ns cload = 150 pf to 600 pf [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 42 of 47 . figure 31. clock timing figure 32. usb data signal timing clock t cyc t cl t ch figure 33. receiver jitter tolerance 90% 10% 90% 10% d? d+ t r t f v crs v oh v ol differential data lines paired transitions n * t period + t jr2 t period consecutive transitions n * t period + t jr1 t jr t jr1 t jr2 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 43 of 47 figure 34. differential to eop transition skew and eop width figure 35. differential data jitter t period differential data lines crossover point crossover point extended source eop width: t eopt receiver eop width: t eopr1 , t eopr2 diff. data to se0 skew n * t period + t deop t period differential data lines crossover points paired transitions n * t period + t xjr2 consecutive transitions n * t period + t xjr1 [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 44 of 47 package diagrams figure 36. 16-pin ( 300-mil) molded dip p1 ordering information ordering code eprom size package name package type operating range cy7c63231a-sxc 3 kb s1 18-pin small outline package pb-free commercial cy7c63231a-pxc 3 kb p3 18-pin (300-mil) pdip pb-free commercial cy7c63221a-xc 3 kb - 18-pad die form commercial 51-85009-*b [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 45 of 47 figure 37. 18-pin (300-mil) molded soic s1 figure 38. 18-pin ( 300-mil) molded dip p3 51-85023 *c 51-85010-c [+] feedback not recommended for new designs cy7c63221/31a document #: 38-08028 rev. *d page 46 of 47 figure 39. die form ta b l e 9 below shows the die pad coordinates for the cy7c63221a-xc. the ce nter location of each bond pad is relative to the center of the die which has coordinate (0,0) as shown above. die form 4 5 3 1 2 17 16 15 14 7 8 9 10 11 12 13 6 18 (0,0) cypress logo x y die step: 2031.0 x 2279.0 microns pad size: 80 x 80 microns table 9. cy7c63221a-xc probe pad coordinates in microns ((0,0) to bond pad centers) pad number pin name x (microns) y (microns) 1 p0.0 ?351.75 995.00 2 p0.1 ?543.20 995.00 3 p0.2 ?734.65 995.00 4 p0.3 ?861.05 779.25 5 p1.0 ?861.05 587.80 6 vss ?861.05 ?949.65 7 vpp ?468.20 ?968.10 8 vreg ?300.40 ?968.10 9 xtalin 63.30 ?968.10 10 xtalout 207.50 ?968.10 11 vcc 594.60 ?968.10 12 d? 771.35 ?968.10 13 d+ 844.05 ?863.10 14 p1.1 861.05 581.95 15 p0.7 861.05 773.95 16 p0.6 720.15 995.00 17 p0.5 528.70 995.00 18 p0.4 337.25 995.00 [+] feedback not recommended for new designs document #: 38-08028 rev. *d revised october 20, 2010 page 47 of 47 encore is a trademark of cypress semiconductor corporation. all products and company names mentioned in this document may be th e trademarks of their respective holders. cy7c63221/31a ? cypress semiconductor corporation, 2002-2010. the information contained herein is subject to change without notice. cypress s emiconductor corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a cypress product. nor does it convey or imply any license under patent or other rights. cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or safety applications, unless pursuant to an express written agreement wi th cypress. furthermore, cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. the inclusion of cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies cypress against all charges. any source code (software and/or firmware) is owned by cypress semiconductor corporation (cypress) and is protected by and subj ect to worldwide patent protection (united states and foreign), united states copyright laws and internatio nal treaty provisions. cypress hereby grants to licensee a personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the cypress source code and derivative works for the sole purpose of creating custom software and or firmware in su pport of licensee product to be used only in conjunction with a cypress integrated circuit as specified in the applicable agreement. any reproduction, modification, translation, compilation, or repre sentation of this source code except as specified above is prohibited without the express written permission of cypress. disclaimer: cypress makes no warranty of any kind, express or implied, with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. cypress reserves the right to make changes without further notice to t he materials described herein. cypress does not assume any liability arising out of the application or use of any product or circuit described herein. cypress does not authori ze its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. the inclusion of cypress? prod uct in a life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies cypress against all charges. use may be limited by and subject to the applicable cypress software license agreement. .document history page sales, solutions, and legal information worldwide sales and design support cypress maintains a worldwide network of offices, solution center s, manufacturer?s representatives, and distributors. to find t he office closest to you, visit us at cypress locations . products automotive cypress.co m/go/automotive clocks & buffers cypress.com/go/clocks interface cypress. com/go/interface lighting & power control cypress.com/go/powerpsoc cypress.com/go/plc memory cypress.com/go/memory optical & image sensing cypress.com/go/image psoc cypress.com/go/psoc touch sensing cyp ress.com/go/touch usb controllers cypress.com/go/usb wireless/rf cypress.com/go/wireless psoc solutions psoc.cypress.com/solutions psoc 1 | psoc 3 | psoc 5 document title: cy7c63221/31a encore? usb low-speed usb peripheral controller document number: 38-08028 rev. ecn no. issue date orig. of change description of change ** 116226 06/17/02 dsg change from spec number: 38-01049 to 38-08028 *a 116976 10/23/02 bon reformat. add note 5 to 24.0. add die sale, section 21.0. change figure 2 *b 270731 see ecn bon replaced the 16-lead (300-mil) molded soic s1 graphic with the correct 18-lead (300-mil) molded soic s1 one in the package diagram section and corrected part numbers for lead-free packages. *c 2899862 xut 03/26/10 removed obsolete parts from the ordering information table updated package diagrams *d 3057657 ajha 10/13/10 added ?not recommended for new designs? watermark in the pdf. updated template. [+] feedback not recommended for new designs |
Price & Availability of CYPRESSSEMICONDUCTORCORP-CY7C63231A-PXC
![]() |
|
|
All Rights Reserved © IC-ON-LINE 2003 - 2022 |
[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy] |
Mirror Sites : [www.datasheet.hk]
[www.maxim4u.com] [www.ic-on-line.cn]
[www.ic-on-line.com] [www.ic-on-line.net]
[www.alldatasheet.com.cn]
[www.gdcy.com]
[www.gdcy.net] |