SEARCH OUR SITE

Quick Search

Advanced Search
Parametric Search
(Includes Part No. Searches)

RESOURCES INDEX

Data Sheets
Selector Guides
Cross Reference
Application Notes
Support
Packaging
Quality
Technical Articles

PRODUCT FAMILIES

ATM & SONET/SDH
Bus Logic
Multi-Port RAMs
FIFOs
Programmable Logic
PROMs
Pt-to-Pt Comm(HOTLink™)
SRAMs & Modules
Timing Technology
USB (Univ'l Serial Bus)
Video Chipsets (SMPTE)
VMEbus
Wireless RF

Military

Product Family Tree

Online Store
Literature Request

CypressHomeCorporate InfoSite MapContact Us

Design Resources Image Design Resources
SUPPORT

 

ISO Data Transfer Using I/O Ports A and B

This application note details the EZ-USB firmware needed to create a bi-directional Isochronous
data stream that is sent out of Ports A and B in the form of a simulated parallel address/data bus.

Overview

One type of data transfer capable over the USB is Isochronous data. This type of data is sent in small packets, once every 1 millisecond following a Start of Frame (SOF). This example code creates a simulated parallel address/data bus using the I/O Ports A and B. The data that is sent from the PC to the EZ-USB chip (OUT data) is written out the simulated bus to a phantom device. The phantom device is also read every frame for the data to send to the PC from the EZ-USB chip (IN data). Users can modify the code below and create custom interfaces needed for their designs. Note that the following code is written using the Application Frameworks libraries contained on the EZ-USB Developer Kit CD.

Operation

The data channels are set to use 16 bytes of ISO data every frame (1ms) for each direction. The data is read and written out the ports using a 6 bit address, 8 bit data, a Read strobe, and a Write strobe.

Port A - The first 6 pins (0 through 5) are designated to holding the address of the memory location that incoming data is coming from or the location that outgoing data is going to. The next two pens are the read and write strobes. Pin 6 is the read strobe which goes low while reading data, and pin 7 is the write strobe which goes low while writing data.

Port B - All eight pins are designated to recording a byte of data for either reading or writing.

As can be seen in the logic analyzer screen below, the simulated data bus performs a burst of 16 reads followed by a burst of 16 writes. It does this process every frame time (1ms). This 1ms timing is automatically generated by the EZ-USB core vectoring to the ISR_SOF subroutine (through the Jump Table) every time a SOF occurs. Notice that the OUT data (data written to the phantom device) is not always present and only appears when actual data is sent from the host PC.

Performance

Using this code, each direction (IN and OUT) can send 16 bytes per one millisecond giving a total of 16000 bytes per second = 128000 bits/second each way. When both directions are sending data, the processor usage to transfer the data to and from the external device is approximately 36% of the 8051 bandwidth. This leaves 64% of the 8051 bandwidth free for user application code and error checking.

Details

To send Isochronous Data to the ports, the PORTnCFG Registers must be set to 0. In order for the 8051 to write to a port, OEn must be set to 0. In order for the 8051 to read from a port, OEn must be set to 1.

The process used in the following C code to read is:


Set Address to read from (using OUTA, bits 0 through 5 of Port A hold the address)

Toggle Read Strobe Low then High to drive Port B (using OUTA, bit 6)

Read the data from Port B into the 8 bit buffer (using PINSB and IN8DATA)


The process to write is:


Set Address to write to (same first 5 bits of Port A)

Write data from 8 bit buffer into Port B (using OUTB and OUT8DATA)

Toggle Write Strobe Low then High (using OUTA, bit 7)


C CODE

void ISR_Sof(void) interrupt 0
{
register BYTE zbcout = ZBCOUT;
register int byteCount;
int i;

// OUTA(D0->D5) is address, OUTA(D6) readstrobe, OUTA(D7) //writestrobe
// PINSB reads byte at PortB, OUTB writes to byte at port B
// INITADDR is constant 0

IsoPacketSize = 16; // number of packets per SOF

// Port A always writes
OEA = 255;
PORTBCFG = 0;
PORTACFG = 0;

// Process any ISO IN data transfers here (Data is received in the //IN8DATA FIFO)
for (i=0; i < IsoPacketSize; i++)
{
// Fill up the FIFO with one frame worth:
OEB=0; // Output Enable off for Port B
OUTA = (INITADDR+i) + (3 << 6); // Sets address (bits 0->5), rdstrobe(6)=1,
wrstrobe(7)=1
OUTA = OUTA - (1 << 6); // OUTA - 100000(b) Toggles read strobes
OUTA = OUTA + (1 << 6); // Toggles rdstrobe back
IN8DATA = PINSB; // Reads data from Port B
}

// Process any ISO OUT data transfers here (Data is waiting in the //OUT8DATA FIFO)
if (!(zbcout & bmEP8)) { // Check to see if data came in this frame
OEB=255; // Output Enable On
byteCount = (OUT8BCH << 8) + OUT8BCL; // How much data?
for (i=0; i < byteCount; i++) {
OUTA = (INITADDR+i) + (3 << 6); // Sets address(bits 0->5), rdstrobe(6)=0,
wrstrobe(7)=1
OUTB = OUT8DATA; // Sets the data
OUTA = OUTA - (1 << 7); // Toggles strobes
OUTA = OUTA + (1 << 7); // Toggles strobes back
}
}

EZUSB_IRQ_CLEAR();
USBIRQ = bmSOF;
// Clear SOF IRQ
}

This is only a portion of the code required to achieve IsoData transfer through the ports, but
it is the only the relevant code pertaining to the ports. The absent code handles the USB
procedures of isochronous data transfer that does not deal with the IO Ports.



Home | Corporate Info | Site Map | Contact Us | Search
Design Resources | Press Room | Investor Relations | Employment

Please email your comments on this site to Webmaster.
© Copyright 1995-2000. Cypress Semiconductor Corporation. All rights reserved.
Terms & Conditions | Year 2000