Microchip PIC16F877 to FTDI USB interface
This is a simple design that interfaces a PIC 16F877 microcontroller to the USB bus using the FTDI FT245 USB FIFO device.
It has been designed using a simple single sided PCB with only one surface mount device, the USB chip itself. All schematics,
PCB layouts and software are available for download
As stated in the introduction the design uses the FTDI FT245BM USB FIFO device. This part handles all the details of
communicating via the USB bus, all it needs is a simple, 1KBit serial EEPROM to hold some USB configuration
information and you are ready to go.
The FT245 has the following interface to the microcontroller (taken from the databook)
D0 to D7 comprise the 8 bit data bus interface, in this design it connects to
PORT D of the PIC micro controller.
RD# and WR are the Read and Write pins of the device, they connect totwo
output pins on PORT C of the PIC microcontroller Both signals are active low.
Finally, RXF# is the RX FIFO flag, when logic 0, it indicates there is data to be
read from the device. TXE is used to indicate that it is possible to write to the FIFO
device, logic 0 indicates it is OK to write data. Both of these signals connect to input
pins of PORT C of the PIC microcontroller.
Accessing the USB device using the PIC
For the PIC to talk to this device is reasonably straightforward. To write data, you set PORTD as outputs,
present a byte of data on D0-D7, toggle WR from high to low, wait a bit then toggle WR high. The data gets
latched into the device on the rising edge of WR. Finally set PORT D as inputs (high impedance state)
To read data, set PORT D as inputs, toggle RD from high to low, wait then read the 8 bits of data presented on D0-D7. Toggle RD to high to
complete the cycle.
The FT245 data sheet provides the full timing for the device but even with a 20 MHz PIC, as used in my design, an external cycle takes 200ns,
4x the minimum 50ns cyles in the device data sheets, there will be no timing issues.
For more detail: Microchip PIC16F877 to FTDI USB interface
We recommend EasyEDA for electronic circuit design.
From Schematic Drawing to PCB Production, Just Need One Tool
Cheap PCB Prototype: 10 pcs 2 layers only $10, quick delivery, 100% E-test