—256 bytes of RAM
—8 KB of PROM (CY7C64013, CY7C64113)
• Integrated Master/Slave I
• Hardware Assisted Parallel Interface (HAPI) for data transfer to external devices
• I/O ports
—Three GPIO ports (Port 0 to 2) capable of sinking 7 mA per pin (typical)
—An additional GPIO port (Port 3) capable of sinking 12 mA per pin (typical) for high current requir e ments: LEDs
—Higher current drive achievable by connecting multiple GPIO pins together to drive a common output
—Each GPIO port can be configured as inputs with internal pull-ups or open drain outputs or traditional CMOS outputs
—A Digital to Analog Conversion (DAC) port with programmable current sink outputs is available on the CY7C64113 devices
—Maskable interrupts on all I/O pins
• 12-bit free-running timer with one microsecond clock ticks
• Watchdog Timer (WDT)
• Internal Power-On Reset (POR)
• USB Specification Compliance
—Conforms to USB Specification, Version 1.1
—Conforms to USB HID Specification, Versi o n 1. 1
—Supports up to five user configured endpoints
Up to four 8-byte data endpoints
Up to two 32-byte data endpoints
—Integrated USB transceivers
• Improved output drivers to reduce EMI
• Operating voltage from 4.0V to 5.5V DC
• Operating temperature from 0 to 70 degrees Celsius
—CY7C64013 available in 28-pin SOIC and 28-pin PDIP packages
—CY7C64113 available in 48-pin SSOP packages
• Industry-standard programmer support
2
C-compatible Controller (100 kHz) enabled through General-Purpose I/O (GPIO) pins
CY7C64113
Document #: 38-08001 Rev. *APage 6 of 51
CY7C64013
2.0 Functional Overview
The CY7C64013 and CY7C64113 are 8-bit One Time Programmable microcontrollers that are designed for full-speed USB
applications. The instruction set has been optimized specifically for USB operations, although the microcontroll ers can be u sed
for a variety of non-USB embedded applications.
GPIO
The CY7C64013 features 19 GPIO pins to support USB and other applications. The I/O pins are grouped into three ports (P0[7:0],
P1[2:0], P2[6:2], P3[2:0]) where each port can be configured as inputs with internal pull-ups, open drain outputs, or traditional
CMOS outputs. There are 16 GPIO pins (Ports 0 and 1) which are rated at 7 mA typical sink current. Port 3 pins are rated at 12
mA typical sink current, a current sufficient to drive LEDs. Multiple GPIO pins can be connected together to drive a single output
for more drive current capacity. Additionally, each GPIO can be used to generate a GPIO interrupt to the microcontroller. All of
the GPIO interrupts share the same “GPIO” interrupt vector.
The CY7C64113 has 32 GPIO pins (P0[7:0], P1[7:0], P2[7:0], P3[7:0])
DAC
The 64113 has four programmable sink current I/O pins (DAC) pins (P4[7,2:0]). Ev ery DAC pin incl udes an integrat ed 14-kΩ pullup resistor. When a ‘1’ is written to a DAC I/O pin, the output current sink is disabled and the output pin is driven HIGH by the
internal pull-up resistor. When a ‘0’ is written to a DAC I/O pin, the internal pull-up resistor is disabled and the output pin provides
the programmed amount of sink current. A DAC I/O pin can be used as an input with an internal pull-up by writing a ‘1’ to the pin.
The sink current for each DAC I/O pin can be individually programmed to one of 16 values using dedicated Isink registers. DAC
bits P4[1:0] can be used as high-current outputs with a programmable sink cu rrent range of 3.2 to 16 mA (typical). DAC bits
P4[7,2] have a programmable current sink range of 0.2 to 1.0 mA (typical). Multiple DAC pins can be connected together to drive
a single output that requires more sink current capacity. Each I/O pin can be used to generate a DAC interrupt to the microcontroller. Also, the interrupt polarity for each DAC I/O pin is individually programmable.
Clock
The microcontroller uses an external 6-MHz crystal and an internal osci llator to provide a reference to an internal PLL-based
clock generator. This technology allows the customer application to use an inexpensive 6-MHz fundamental crystal that reduces
the clock-related noise emissions (EMI). A PLL clock generator provides the 6-, 12-, and 48-MHz clock signals for distribution
within the microcontroller.
Memory
The CY7C64013 and CY7C64113 have 8 KB of PROM.
Power on Reset, Watchdog and Free running Time
These parts include power-on reset logic, a Watchdog timer, and a 12-bit free-running timer. The power-on reset (POR) logic
detects when power is applied to the device, resets the logic to a known state, and begins executing instructions at PROM address
0x0000. The Watchdog timer is used to ensure the microcontroller recovers after a period of inactiv ity . The firmwar e may become
inactive for a variety of reasons, including errors in the code or a hardware failure such as waiting for an interrupt that never occurs.
I2C and HAPI Interface
The microcontroller can communicate with external electronics through th e GPIO pins. An I
dates a 100-kHz serial link with an external device. There is also a Hardware Assisted Parallel Interface (HAPI) which can be
used to transfer data to an external device.
Timer
The free-running 12-bit timer clocked at 1 MHz provides two interrupt sources, 128-µs a nd 1.0 24-ms. The timer can be used to
measure the duration of an event under firmware control by reading the timer at the start of the event and after the event is
complete. The difference between the two readings indicates the duration of the event i n microseconds. The u pper four bits of
the timer are latched into an internal register when the firmware reads the lower eight bits. A read from the upper four bits actually
reads data from the internal register, instead of the timer . This feature eliminates the need for firmware to try to compensate if the
upper four bits increment immediately after the lower eight bits are read.
Interrupts
The microcontroller supports 11 maskable interrupts in the vectored interrupt controller. Interrupt sources include the USB Bus
Reset interrupt, the 128-µs (bit 6) and 1.024-ms (bit 9) outputs from the free-running timer , five USB endpoints, the DAC port, the
GPIO ports, and the I
from LOW ‘0’ to HIGH ‘1.’ The USB endpoints interrupt after the USB host has written data to the endpoint FIFO or after the USB
controller sends a packet to the USB host. The DAC ports have an additional level of masking that allows the user to select which
DAC inputs can cause a DAC interrupt. The GPIO ports also have a level of masking to select which GPIO inputs can cause a
GPIO interrupt. For additional flexibility, the input transition polarity that causes an interrupt is programmable for each pin of the
DAC port. Input transition polarity can be programmed for each GPIO port as part of the port configuration. The interrupt polarity
can be rising edge (‘0’ to ‘1’) or falling edge (‘1’ to ‘0’).
2
C-compatible master mode interface. The timer bits cause an interrupt (if enabled) when the bit toggles
D+[0], D–[0]I/O6, 77, 87, 8Upstream port, USB differential data.
P0I/OP0[7:0]
10, 14, 11, 15,
12, 16, 13, 17
P1I/OP1[2:0]
25, 27, 26
P2I/OP2[6:2]
19, 9, 20, 8,
21
P3I/OP3[2:0]
23, 5, 24
DACI/ODAC[7,2:0]
XTAL
IN
XTAL
OUT
V
PP
V
CC
GNDIN4, 225, 2211, 16, 34, 40 Ground.
V
REF
NC38No Connect.
IN2226-MHz crystal or external clock input.
OUT1116-MHz crystal out.
IN181930Programming voltage supply, tie to ground during
IN282848Voltage supply.
IN333External 3.3V supply voltage for the differential data
P0[7:0]
11, 15, 12, 16,
13, 17, 14, 18
P1[2:0]
26, 4, 27
P2[6:2]
20, 10, 21,
9, 23
P3[2:0]
24, 6, 25
P0[7:0]
20, 26, 21, 27,
22, 28, 23, 29
P1[7:0]
6, 43, 5, 44,
4, 45, 47, 46
P2[7:0]
18, 32, 17, 33,
15, 35, 14, 36
P3[7:0]
13, 37, 12, 39,
10, 41, 7, 42
19, 25, 24, 31
GPIO Port 0 capable of sinking 7 mA (typical).
GPIO Port 1 capable of sinking 7 mA (typical).
GPIO Port 2 capable of sinking 7 mA (typical). HAPI
is also supported through P2[6:2].
GPIO Port 3, capable of sinking 12 mA (typical).
DAC Port with programmable current sink outputs.
DAC[1:0] offer a programmable range of 3.2 to 16 mA
typical. DAC[7,2] have a programmable sink current
range of 0.2 to 1.0 mA typical.
normal operation.
output buffers and the D+ pull-up.
CY7C64013
CY7C64113
4.2I/O Register Summary
I/O registers are accessed via the I/O Read (IORD) and I/O Write (IOWR, IOWX) instructions. IORD reads data from the selected
port into the accumulator. IOWR performs the reverse; it 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. Specifying address 0 (e.g., IOWX 0h) means the I/O register is selected solely by the contents of X.
All undefined registers are reserved. It is important not to write to reserved registers as this may cause an undefined operati on
or increased current consumption during operation. When writing to registers with reserved bits, the rese rved bits must be written
with ‘0.’
Table 4-2. I/O Register Summary
Register NameI/O AddressRead/WriteFunctionPage
Port 0 Data0x00R/WGPIO Port 0 Data 19
Port 1 Data0x01R/WGPIO Port 1 Data19
Port 2 Data0x02R/WGPIO Port 2 Data19
Port 3 Data0x03R/WGPIO Port 3 Data20
Port 0 Interrupt Enable0x04WInterrupt Enable for Pins in Port 021
Port 1 Interrupt Enable0x05WInterrupt Enable for Pins in Port 121
Port 2 Interrupt Enable0x06WInterrupt Enable for Pins in Port 221
Port 3 Interrupt Enable0x07WInterrupt Enable for Pins in Port 321
Document #: 38-08001 Rev. *APage 10 of 51
CY7C64013
Table 4-2. I/O Register Summary (continued)
Register NameI/O AddressRead/WriteFunctionPage
GPIO Configuration0x08R/WGPIO Port Configurations20
HAPI and I2C Configuration0x09R/WHAPI Width and I2C Position Configuration24
USB Device Address A0x10R/WUSB Device Address A34
EP A0 Counter Register0x11R/WUSB Address A, Endpoint 0 Counter 35
EP A0 Mode Register0x12R/WUSB Address A, Endpoint 0 Configuration 34
EP A1 Counter Register0x13R/WUSB Address A, Endpoint 1 Counter 35
EP A1 Mode Register0x14R/WUSB Address A, Endpoint 1 Configuration 35
EP A2 Counter Register0x15R/WUSB Address A, Endpoint 2 Counter 35
EP A2 Mode Register0x16R/WUSB Address A, Endpoint 2 Configuration 35
USB Status & Control0x1FR/WUSB Upstream Port Traffic Status and Control34
Global Interrupt Enable0x20R/WGlobal Interrupt Enable 29
Endpoint Interrupt Enable0x21R/WUSB Endpoint Interrupt Enables29
Timer (LSB)0x24RLower 8 Bits of Free-running Timer (1 MHz)23
Timer (MSB)0x25RUpper 4 Bits of Free-running Timer 24
WDT Clear0x26WWatchdog Timer Clear18
2
C Control & Status0x28R/WI2C Status and Control25
I
2
C Data0x29R/WI2C Data25
I
DAC Data0x30R/WDAC Data22
DAC Interrupt Enable0x31WInterrupt Enable for each DAC Pin23
DAC Interrupt Polarity0x32WInterrupt Polarity for each DAC Pin23
DAC Isink0x38-0x3FWI nput Sink Current Control for each DAC Pin22
Reserved0x40Reserved
EP A3 Counter Register0x41R/WUSB Address A, Endpoint 3 Counter35
EP A3 Mode Register0x42R/WUSB Address A, Endpoint 3 Configuration34
EP A4 Counter Register0x43R/WUSB Address A, Endpoint 4 Counter35
EP A4 Mode Register0x44R/WUSB Address A, Endpoint 4 Configuration35
Reserved0x48Reserved
Reserved0x49Reserved
Reserved0x4AReserved
Reserved0x4BReserved
Reserved0x4CReserved
Reserved0x4DReserved
Reserved0x4EReserved
Reserved0x4FReserved
Reserved0x50Reserved
Reserved0x51Reserved
Processor Status & Control0xFFR/WMicroprocessor Status and Control Register26
CY7C64113
Document #: 38-08001 Rev. *APage 11 of 51
CY7C64013
4.3Instruction Set Summary
Refer to the CYASM Assembler User’s Guide for more details.
The 14-bit program counter (PC) allows access to up to 8 KB of PROM available wi th the CY7C 64x13 archite ctu re . The to p 32
bytes of the ROM in the 8 Kb part are reserved for testing purposes. The program counter is cleared during reset, such that the
first instruction executed after a reset is at address 0x0000h. Typically, this is a jump instruction to a reset handler that initializes
the application (see Interrupt Vectors on page 30).
The lower eight bits of the program counter are incremented a s instructions are lo ade d and exec uted. The up per six bits of the
program counter are incremented by executi ng 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” causes the assembler to insert
XPAGE instructions automatically. Because instructions can be either one or two bytes long, the assembler may occasionally
need to insert a NOP followed by an XPAGE to execute correctly.
The address of the next instruction to be executed, the carry flag, and the 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 during a RETI instruction. Only the program counter is restored during a RET instruction.
The program counter cannot be accessed directly by the firmware. The program stack can be examined by reading SRAM from
location 0x00 and up.
CY7C64113
Document #: 38-08001 Rev. *APage 13 of 51
5.1.1Program Memory Organization
after resetAddress
14-bit PC0x0000Program execution begins here after a reset
0x0002USB Bus Reset interrupt vector
0x0004128-µs timer interrupt vector
0x00061.024-ms timer interrupt vector
0x0008USB address A endpoint 0 interru pt vector
0x000AUSB address A endpoint 1 interrupt vector
0x000CUSB address A endpoint 2 interrupt vector
0x000EUSB address A endpoint 3 interrupt vector
CY7C64013
CY7C64113
0x0010USB address A endpoint 4 interru pt vector
0x0012Reserved
0x0014DAC interrupt vector
0x0016GPIO interrupt vector
0x0018
0x001A
2
I
C interrupt vector
Program Memory begins here
0x1FDF8 KB (-32) PROM ends here (CY7C64013, CY7C64113)
Document #: 38-08001 Rev. *APage 14 of 51
CY7C64013
5.28-Bit Accumulator (A)
The accumulator is the general-purpose register for the microcontroller.
5.38-Bit Temporary Register (X)
The “X” register is availabl e to the firmware for temporary storage of intermediate results. The microcontroller can perform indexed
operations based on the value in X. Refer to Section 5.6.3 for additional information.
5.48-Bit Program Stack Pointer (PSP)
During a reset, the program stack pointer (PSP) is set to 0x00 and “grows” upward from this address. The PSP may be set by
firmware, using the MOV PSP,A instruction. The PSP supports interrupt service under hardware control and CALL, RET, and
RETI instructions under firmware control. The PSP is not readable by the firmware.
During an interrupt acknowledge, interrupts are disabled and the 14-bit 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 PSP , then the PSP is incremented. The second
byte is stored in memory addressed by the PSP, and the PSP is incremented again. The overall effect is to store the program
counter and flags on the program “stack” and increment the PSP by two.
The Return from Interrupt (RETI) instruction decrements the PSP , then restores the second byte from memory addressed by the
PSP. The PSP is decremented again and the first byte is restored from memory addressed by the PSP. After the program counter
and flags have been restored from stack, the interrupts are enabled. The overall effect is to restore the program counter and flags
from the program stack, decrement the PSP by two, and reenable interrupts.
The Call Subroutine (CALL) instruction stores the program counter and flags on the program stack and increments the PSP by
two.
The Return from Subroutine (RET) instruction restores the program counter but not the flags from the program stack and decrements the PSP by two.
CY7C64113
5.4.1Data Memory Organization
The CY7C64x13 microcontrollers provide 256 bytes of data RAM. Normally, the SRAM is partitioned into four areas: program
stack, user variables, data stack, and USB endpoint FIFOs. The following is one example of where the program stack, data stack,
and user variables areas could be located.
After resetAddress
8-bit DSP8-bit PSP0x00Program Stack Growth
(Move DSP
8-bit DSP
Notes:
1. Refer to Section 5.5 for a description of DSP.
2. Endpoint sizes are fixed by the Endpoint Size Bit (I/O register 0x1F, Bit 7), see Table 18-1.
[1]
)
user selectedData Stack Growth
User variables
USB FIFO space for five endpoints
0xFF
[2]
Document #: 38-08001 Rev. *APage 15 of 51
CY7C64013
5.58-Bit Data Stack Pointer (DSP)
The data stack pointer (DSP) supports PUSH and POP instructions that use the data stack for temporary storage. A PUSH
instruction pre-decrements the DSP, then writes data to the memory location addressed by the DSP. A POP instruction reads
data from the memory location addressed by the DSP, then post-increments the DSP.
During a reset, the DSP is reset to 0x00. A PUSH instruction when DSP equals 0x00 writes data at the top of the data RAM
(address 0xFF). This writes data to the memory area reserved for USB endpoint FIFOs. Therefore, the DSP should be indexed
at an appropriate memory location that does not compromise the Program Stack, user-defined memory (variables), or the USB
endpoint FIFOs.
For USB applications, the firmware should set the DSP to an appropriate location to avoid a memory conflict with RAM dedicated
to USB FIFOs. The memory requirements for the USB endpoints are described in Section 18.2. Example assembly instructions
to do this with two device addresses (FIFOs begin at 0xD8) are shown below:
MOV A,20h; Move 20 hex into Accumulator (must be D8h or less)
SWAP A,DSP ; swap accumulator value into DSP register
5.6Address Modes
The CY7C64013 and CY7C64113 microcontrollers support three addressing modes for instructions that require data operands:
data, direct, and indexed.
5.6.1Data (Immediate)
“Data” address mode refers to a data operand that is actually a constant encoded in the instruction. As an example, consider the
instruction that loads A with the constant 0xD8:
• MOV A,0D8h
This instruction requires two bytes 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 is the constant “0xD8.” 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 0D8h
• MOV A,DSPINIT
CY7C64113
5.6.2Direct
“Direct” address mode is used when the data operand is a variable stored in SRAM. In that case, the one byte address of the
variable is encoded in the instruction. As an example, consider an instruction that loads A with the contents of memory address
location 0x10:
• MOV A,[10h]
Normally, 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]
5.6.3Indexed
“Indexed” address mode allows the firmware to manipulate arrays of data stored in SRAM. The address of the data operand is
the sum of a constant encoded in the instruction and the contents of the “X” register . Normally , the constant is the “base” address
of an array of data and the X register contains 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 0x10. The fourth
element would be at address 0x13.
Document #: 38-08001 Rev. *APage 16 of 51
Loading...
+ 35 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.