Cypress Semiconductor enCoRe CY7C64215 Manual de usuario Pagina 10

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 16
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 9
August 17, 2011 Document No. 001-15340 Rev. *A
AN6073
10
4. Write to the sleep bit of the CPU_SCR register. This pow-
ers down most of the PSoC systems including FLASH
modules, Internal main Oscillator and bandgap. Care
should be taken to disable/power down the analog blocks
during the sleep condition; call M8C_Sleep function or set
bit [3] of the CPU_SCR0 register at location FFh.
5. Two NOPs – These execute before any ISR and are
prefetched by the processor.
6. Remaining code for exiting suspend routine.
Data Endpoint Transfers: IN and OUT
Bulk transfer is a common data transfer mechanism used in
full-speed USB devices. Typical pseudo code for setting IN
and OUT bulk endpoints and transfer of data in both cases is
given below. A sample project with IN and OUT transfers is
available in the PSoC Designer development tool under
CY7C64215.
CY7C64x13 Microcontroller
IN Transfers
1. Bits [7,6] of the USB Status and Control Register 0x1F are
used to configure the size and number of endpoints. Bit 7
controls the size and bit 6 the number.
2. Check if stall condition is set on the IN endpoint
3. If the stall condition is set, then set the endpoint mode;
endpoint Stall and ACK IN. Bit 7 of register 14, 16, 42, or
44 represents stall. Bits [3:0] of these registers represent
the mode of the endpoint.
4. If the stall condition is not set, then set the endpoint mode
to Stall and NAK IN.
Interrupt on the IN endpoint occurs when the device transfers
data to the USB host that results in an ACK transaction from
the host.
5. Set endpoint IN to ACK mode.
6. Transfer data to the endpoint FIFO.
7. Disable endpoint IN NAK interrupts.
8. Change data toggle.
9. Clear ACK bit in the mode register.
10. Reset endpoint IN.
OUT Transfers
1. Bits [7,6] of the USB Status and Control Register 0x1F are
used to configure the size and number of endpoints. Bit 7
controls the size and bit 6 the number.
2. Check if stall condition is set on the OUT endpoint.
3. If the stall condition is set, then set the endpoint mode;
endpoint Stall and ACK OUT. Bit 7 of register 14, 16, 42,
or 44 represents stall. Bits [3:0] of these registers repre-
sent the mode of the endpoint.
4. If the stall condition is not set, then set the endpoint mode
to No Stall and ACK OUT. This mode ACKs OUT and
ignores SETUP and IN packets.
Interrupt on the OUT endpoint occurs when the device trans-
fers data to the USB host that results in an ACK transaction
from the host.
5. Set endpoint OUT to ACK mode.
6. Transfer data to the endpoint FIFO.
7. Set the check for valid data toggle.
8. Use the count register to locate last occupied data space.
9. Check to see if you are reading the last data.
10. If not, transfer data to the RAM.
11. Disable NAK interrupts.
12. Clear ACK bit in the mode register.
13. Read the rest of the data.
14. When you get to the last data, return.
CY7C64215 Microcontroller
The CY7C64215 (enCoRe III) uses a GUI based tool for set-
ting up USB related information for the device. It has drop
down menus to add/edit/select Device Attributes, configura-
tion descriptor, interface descriptor, endpoint descriptors, etc.
For endpoint descriptors, select EP1 as IN endpoint, EP2 as
OUT endpoint, both with 10-ms interval and 64 max packet
size.
IN Transfers
1. Enable Global interrupts; M8C_EnableGInt;
2. Start USB user module;
USBFS_Start(0,USB_5V_OPERATION);
3. Wait for enumeration;
while(!USBFS_bGetConfiguration());
4. Prime EP1 – IN endpoint;USBFS_LoadInEP(USB_EP1,
&aBuf[0], EP1SZ, USB_TOGGLE);
5. Get count; bCount = USBFS_wGetEPCount(USB_EP2);
6. Load IN endpoint; USBFS_LoadInEP(USB_EP1,
&aBuf[0], bCount & 0x00FF, USB_TOGGLE);
OUT Transfers
1. Enable Global interrupts; M8C_EnableGInt;
2. Start USB user module;
USBFS_Start(0,USB_5V_OPERATION);
3. Wait for enumeration;
while(!USBFS_bGetConfiguration());
4. Enable endpoint interrupts;
USBFS_INT_REG|=USBFS_INT_EP1_MASK|
USBFS_INT_EP2_MASK;
5. When EP2 interrupt occurs, read OUT endpoint;
USBFS_bReadOutEP(USB_EP2, &aBuf[0], wCount) –
where aBuf[ ] is the array you want OUT data to be stored
in and wCount is gotten by
USBFS_wGetEPCount(USB_EP2)
Vista de pagina 9
1 2 ... 5 6 7 8 9 10 11 12 13 14 15 16

Comentarios a estos manuales

Sin comentarios