SEARCH OUR SITE![]() ![]()
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
PRODUCT FAMILIES |
|
||||||
|
|||||||
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 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:
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)
Write data from 8 bit buffer into Port B (using OUTB and OUT8DATA) Toggle Write Strobe Low then High (using OUTA, bit 7)
void ISR_Sof(void) interrupt
0 // OUTA(D0->D5) is address,
OUTA(D6) readstrobe, OUTA(D7) //writestrobe IsoPacketSize = 16; // number of packets per SOF // Port A always writes // Process any ISO IN data transfers
here (Data is received in the //IN8DATA FIFO) // Process any ISO OUT data transfers
here (Data is waiting in the //OUT8DATA FIFO) EZUSB_IRQ_CLEAR(); This is only a portion of the
code required to achieve IsoData transfer through the ports, but |
|||||||
Design Resources | Press Room | Investor Relations | Employment Please email your comments on this site to Webmaster. |