ETC USB245

USB245
•
•
•
•
•
Pinout
Res. [1]
[24] VCC
Res. [2]
[23] FILTER_VCC
Res. [3]
[22] USB_VCC
SD7 [4]
[21] DM
SD6 [5]
[20] DP
SD5 [6]
[19] GND
SD4 [7]
[18] TXE#
SD3 [8]
[17] WRITE
SD2 [9]
[16] READ#
SD1 [10]
[15] RESET#
SD0 [11]
[14] RXF#
GND [12]
[13] RCCLK
USB ver1.1 compatible device with
a 384 byte transmit FIFO and 128
Byte receive FIFO.
Works with FTDI’s Virtual Com
Port (VCP) and D2XX Drivers for
Microsoft Windows.
Small Size: Surface Mount
Technology allows the device to fit
in standard 24 pin DIP socket.
Preprogrammed 93C46 EEPROM
with unique USB device information.
Easy to use 8-bit microcontrollermicroprocessor interface with FIFO
status lines
All Trademarks are property of
their respective owners
Res.
SD(0..7)
RCCLK
RXF#
RESET#
READ#
WRITE
TXE#
DP
DM
USB_VCC
FILTER_VCC
VCC
GND
Information
Reserved, Unconnected. Do not use.
Data Bus. Driven when READ# is asserted.
Data inputs when WRITE is asserted.
Output of the onboard RC Timer.
Active low output. When asserted, receive
data is available, and can be read from FIFO.
Active Low output. Remains low for 140msec
after power-up, then goes high.
Active Low input. When low, the device drives
the current receive FIFO data onto SD0-SD7.
Input that Clocks Data at SD0-SD7 into
transmit FIFO on a High-to-Low transition.
Active Low Output. When asserted, signifies
transmit FIFO space is available.
USB Plus Data Signal.
USB Minus Data Signal.
Input to onboard 5volt power filter.
Output of onboard 5volt power filter.
5 Volt power input.
Ground.
The USB245 is small, easy to use device with all necessary
timing circuits, and power filtering built in.
Each contains a preprogrammed EEPROM which holds the
device and vendor ID codes.
The 8-bit data bus easily connects to processor data buses.
The two control bus lines (READ# and WRITE) direct data flow
from the device, while two status lines (TXE# and RXF#) give
information about the state of the internal transmit and receive
FIFOs. The status lines can also be used as interrupt sources
for the processor.
The onboard RESET# line is routed externally and can be
used to drive other circuits.
The device can be wired to derive and source power from
the USB bus, or alternatively have power sourced from the
processor interface.
© 2002 Xylotex
www.xylotex.com
Timing Information
FIFO READ CYCLE
T5
T6
RXF#
T1
T2
RD#
T3
T4
D0-D7
T1
RD Active Pulse Width
Min
50
T2
RD to RD Pre-Charge Time
50
T3
RD Active to Valid Data
T4
Valid Data Hold from RD inactive
10
T5
RD Inactive to RXF#
5
T6
RXF# Inactive after RD cycle
80
Max
ns
30
FIFO WRITE CYCLE
Unit
ns
ns
ns
25
ns
ns
T12
T11
TXE#
T7
T8
WR
T9
T10
D0-D7
T7
WR Active Pulse Width
50
ns
T8
WR to WR Pre-Charge Time
50
ns
T9
Data Setup Time Before WR Inactive
T10
Data Hold Time from WR Inactive
10
T11
WR inactive to TXE#
5
T12
TXE# inactive after RD cycle
80
20
ns
ns
25
ns
ns
Device Function
A processor can use the status lines TXE# and RXF# in either a polled or interrupt manner.
The TXE# line will go active LOW indicating that there is room available in the 384 bytes transmit
buffer for the processor to place another byte for transmission over the USB bus. The RXF# line
will go active LOW when there is at least one byte available in the 128 byte FIFO for the
processor to read.
To write data into the transmit FIFO, the following procedure should be used: With the WRITE
line LOW, the processor places the data on lines D0-D7. The processor then strobes the WRITE
line by bringing it HIGH for a minimum of 50 ns, and then completes the cycle by bringing the
WRITE line back LOW.
To read data from the receive FIFO, the processor drives the RD# line LOW. After a maximum
time of 30 ns, valid data will be driven on lines D0-D7. The processor reads the data and then
drives the RD# line back inactive HIGH.
For USB powered controls, USB power would be fed into Pin 22. The filtered output provided
at Pin 23 would then be tied to Pin 24 (Vcc). This power (+5volts) can be used to power other
circuits in the design, up to the maximum current draw per USB device. For USB specifications
see: www.usb.org/developers.
For System powered controls, +5 volts can be directly fed into Pin 24. Pins 22-23 are left
unconnected. Alternatively system power can be fed into Pin 22. Pin 23 would then be tied to Pin
24 for extra system power filtering. In this case USB power is never connected to the device.
USB power and alternate System power sources should not be tied together, except for
common grounding (GND).
The USB245 is a ‘slave’ or ‘peripheral’ device to a ‘master’ or ‘host’ USB controller such as a
PC running Windows 98/2000. The host must have appropriate drivers running to access the
USB245. Drivers are available for Windows and Mac Systems.
Addition Information
USB Cable color codes: RedÆ 5 Volts, Black Æ GND, Green Æ DP, White Æ DM
Schematic Usage
See appendix for a simple example using the USB245 with the Ubicom SX-28.
Pin Orientation
Pin 1
GND
Vcc
(version 1.0)
Software Drivers Supplied & Supported by: Future Technology Devices International Ltd. (FTDI).
http://www.ftdichip.com
The Following is a sample ‘C’ that reads a character from the USB and writes it back out.
#include <c:\sxc\include\dev\SX28AC.H>
#include <c:\sxc\include\port.h>
#define
#define
#define
#define
TXEn
WRITE
READn
RXFn
PORTA.3
PORTA.2
PORTA.1
PORTA.0
//
//
//
//
INPUT
OUTPUT
OUTPUT
INPUT
#pragma FUSE = FOSC_HS2 & TURBO & WDTD
#pragma FUSEX = EXTEND
unsigned char byte;
/*--------------------------------------------------------------------------*/
/*
*/
/*--------------------------------------------------------------------------*/
void send_byte()
{
DDR(PORTC,0x00); // make PORTC output
WRITE=1;
NOP();
PORTC=byte;
NOP();
WRITE=0;
DDR(PORTC,0xFF); // now make PORTC input
}
/*--------------------------------------------------------------------------*/
/*
*/
/*--------------------------------------------------------------------------*/
void read_byte()
{
READn=0;
NOP();
byte=PORTC;
NOP();
READn=1;
}
/*--------------------------------------------------------------------------*/
/*
*/
/*--------------------------------------------------------------------------*/
void main()
{
OPTION(RTW|RTE_D|PSA); // start with RTC int disabled
DDR(PORTC,0xFF);
DDR(PORTB,0xFF);
DDR(PORTA,0xF9);
// USB Data Port
// all inputs
// USB Status lines
WRITE=0;
READn=1;
// Initialize control
// Outputs Here
while (1)
{if (RXFn == 0)
{read_byte();
send_byte();
}
}
}
//
//
//
//
Loop forever
Is there a character available
Yes, so get it
and send it back out
Setup and running.
Place the USB device in an empty breadboard, noting proper pin orientation. If you are using
the USB adapter cable, while it is NOT plugged into a master or PC, plug the proper end into the
breadboard next to the USB245 so that the pin with the Red wire connects to USB245 pin 22, and
the pin with the black wire connects to pin 19. Place a jumper wire between pins 22 & 23 of the
USB245 on the breadboard. At this point only the top-right 6 pins of the USB245 will be attached.
With nothing else attached to the module, except as noted above, now plug the other end of the
cable into the PC. It should recognize a new USB device a start searching for drivers. When it
asks for the drivers, put the floppy disk sent with the USB245 into the computer’s floppy drive and
tell the setup routine which drive you placed it into (usually A:).
After it has completed setup, you can find the COM port the USB245 has been assigned, by
clicking on: Start ÎSettingsÎControl Panel, then double click the System Icon Î Device
Manager Î Ports (COM &LPT). Here you should see: USB Serial Port (COMn), where n is the
COM port assigned.
Now that it has been found, unplug the USB cable from the PC. Never unplug the cable from
the USB245 end, while the other end is plugged into a PC or USB master..
Wire the 8 data lines and 4 status lines to your preprogrammed microcontroller. You can use
the 5V supply from pin 24, and the GND from pin 12 for you microcontroller. Do NOT tie another
5V source to the USB 5V source. RESET# is also available if needed.
Plug the USB cable back into the PC. The PC should now search for and find the proper driver
software. The PC may ‘freeze’ for about 25 seconds while the software is loaded. The chipset &
driver manufacturer explains that this is normal.
If the example program listed above was downloaded to your embedded processor, you should
be able to open a COM program like PCPlus, choose the correct COM Port, and start typing in
the data entry area and see you characters show up on the screen. If they show up twice, go to
half-duplex mode.
A very simple Basic program
USB
VAR
BYTE
LOW 8
HIGH 9
10 IF IN10 = 0 THEN
LOW 9
USB=INL
HIGH 9
DIRL=%11111111
HIGH 8
OUTL=USB
LOW 8
DIRL=%00000000
END
GOTO 10
REM
REM
REM
REM
REM
REM
A Place to store the character
I/O 0-7 used for DATA
I/O 8 used for WRITE SIGNAL, Start LOW
I/O 9 used for READ SIGNAL, Start HIGH
I/O 10 used for RXF# input
TXE IS NOT CHECKED
REM
REM
REM
REM
REM
REM
REM
REM
REM
IF RXF is LOW, there is a char available
make the READ line active LOW
read the character
deactivate the READ line
set PORT for OUTPUT
strobe the WRITE line HIGH
output the character
bring the strobe back LOW LOW
set PORT for INPUT
1
2
SX28
3
VCC
CR1
20 MHz Resonator
1
VCC
U1
C1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
GND
READ#
WRITE
RXF#
TXE#
GND
GND RESET#
RTCC OSC1
VCC
OSC2
VCC
RC7
RA0
RC6
RA1
RC5
RA2
RC4
RA3
RC3
RB0
RC2
RB1
RC1
RB2
RC0
RB3
RB7
RB4
RB6
GND
RB5
28
27
26
25
24
23
22
21
20
19
18
17
16
15
RESET#
OSC1
OSC2
D7
D6
D5
D4
D3
D2
D1
D0
D
2
D
4
3
VCC
GND
U2
4
5
6
7
8
9
10
11
SX28AX-SS
READ#
WRITE
RXF#
TXE#
16
17
14
18
PORTB on SX28 for other I/O
RESET#
15
SD7
SD6
SD5
SD4
SD3
SD2
SD1
SD0
24
23
22
VCC
FILTER_VCC
USB_VCC
21
20
DM
DP
5
GND
READ#
WRITE
RXF#
TXE#
C
VCC0
DATAODATA0+
GND0
GND
13
RXCLK
19
12
GND
GND
RESET#
J1
RED
1
WHITE 2
GREEN 3
BLACK 4
C
USB245
GND
BS2-IC
VCC
U3
U4
BS2-IC
B
GND
P0
P1
P2
P3
P4
P5
P6
P7
1
2
3
4
5
6
7
8
9
10
11
12
SOUT VIN
SIN
VSS
ATN RES#
VSS VDD
P0
P15
P1
P14
P2
P13
P3
P12
P4
P11
P5
P10
P6
P9
P7
P8
24
23
22
21
20
19
18
17
16
15
14
13
GND
VCC
TXE#
RXF#
READ#
WRITE
P7
P6
P5
P4
P3
P2
P1
P0
4
5
6
7
8
9
10
11
READ#
WRITE
RXF#
TXE#
16
17
14
18
15
SD7
SD6
SD5
SD4
SD3
SD2
SD1
SD0
VCC
FILTER_VCC
USB_VCC
DM
DP
RXCLK
READ#
WRITE
RXF#
TXE#
RESET#
GND
GND
24
23
22
J1
RED
WHITE
GREEN
BLACK
21
20
1
2
3
4
VCC0
DATAODATA0+
GND0
GND
B
5
13
GND
19
12
USB245
GND
Title
A
Size
USB245 Demo Schematic
A
Number
Revision
A
Date:
File:
1
2
3
5-Dec-2002
C:\Designs\stamps.ddb
Sheet of
Drawn By:
4