Computer Interfacing The USB 2 X 16 Board
Computer Interfacing The USB 2 X 16 Board • The FTDI 2232 Chip basics • 2 x 16 I/O ISA Board • Software ACOE 243 1
The FT 2232 Chip • FT 2232: A USB chip family by FTDI (Future Technology Devices International – Various generations FT 2232 B, FT 2232 C, FT 2232 D, etc • The FT 2232 C is the 3 rd generation of FTDI’s USB UART / FIFO I. C. family. – It provides two Multi-Purpose UART / FIFO controllers • Each can be configured individually in several different modes such as – the 2 nd generation UART interface, FIFO interface and Bit. Bang IO modes – a variety of additional modes such as the Multi-Protocol Synchronous Serial Engine interface which is designed specifically for synchronous serial protocols such as JTAG and SPI bus. • The FT 2232 C can also operate in the MCU mode emulating the 8051 and the AT ISA bus ACOE 243 2
The FT 2232 C Chip ACOE 243 3
The FT 2232 MCU Mode • This mode emulates the basic operation of the 8051 microcontroller. • It provides the signals of the AT ISA expansion slot • On startup, the FT 2232 enters the MPSSE mode of operation by default • To switch to the MCU mode: • • • Output to the device queue the number 0 x 00 to reset the device • Output to the device queue the number 0 x 80 to switch to the MCU mode To write to an output port • Output to the device queue the “Write” code (0 x 92 or ox 93) • Output to the device queue the address of the port • Output to the device queue the value to be written on the output port Follow a similar sequence for a port input operation ACOE 243 4
The DM 2232 DIL Board • A Dual-In-Line (DIL) Board equipped with an FD 2232 C chip and the necessary USB support circuitry: – USB connector – Crystal clock oscillator – Reset Circuit – Power supply ACOE 243 5
The DM 2232 DIL Board ACOE 243 6
The 2 x 16 ISA FT 2232 Board ACOE 243 7
The 2 x 16 FT 2232 Board – Eagle Schematic ACOE 243 8
The 2 x 16 FT 2232 Board – Eagle PCB Layout ACOE 243 9
The 2 x 16 FT 2232 Board –Testing Software • To use the FT 2232 board we must first “Open” the USB port where the board is attached • • Load and register the driver of the device (FT 2232) • Get a handler that enables the communication with the device • Link the handler with the physical USB connector where the device is attached FTDI offers three different drivers for the FT 2232 chip • Ftd 2 xx. lib: an Unmanaged DLL library • VCM. dll: A virtual COM port library • FDT 2 XXNET. dll: A managed DLL library ACOE 243 10
The GUI of the FT 2232 Test program ACOE 243 11
Opening the FT 2232 Port using FTD 2 XX_NET; namespace FT 2232 USB_Tst 1 { public partial class Form 1 : Form { UInt 32 ftdi. Device. Count = 0; FTDI. FT_STATUS ft. Status = FTDI. FT_STATUS. FT_OK; FTDI my. Ftdi. Device = new FTDI(); public Form 1() { Initialize. Component(); } private void bt_Open_Click(object sender, Event. Args e) { ft. Status = my. Ftdi. Device. Get. Number. Of. Devices(ref ftdi. Device. Count); if (ft. Status == FTDI. FT_STATUS. FT_OK) { rtb_Display. Text = ("Number of FTDI devices: " + ftdi. Device. Count. To. String() + "n"); } else { Message. Box. Show("Failed to get number of devices (error " + ft. Status. To. String() + ")"); return; } if (ftdi. Device. Count == 0) {Message. Box. Show("Failed to get number of devices (error " + ft. Status. To. String() + ")"); return; } ……. ACOE 243 12
Opening the FT 2232 Port …… FTDI. FT_DEVICE_INFO_NODE[] ftdi. Device. List = new FTDI. FT_DEVICE_INFO_NODE[ftdi. Device. Count]; ft. Status = my. Ftdi. Device. Get. Device. List(ftdi. Device. List); if (ft. Status == FTDI. FT_STATUS. FT_OK) { for (UInt 32 i = 0; i < ftdi. Device. Count; i++) { cb_Devices. Items. Add(ftdi. Device. List[i]. Description. To. String()); rtb_Display. Append. Text("Device Index: " + i. To. String() + "n"); rtb_Display. Append. Text("Flags: " + String. Format("{0: x}", ftdi. Device. List[i]. Flags) + "n"); rtb_Display. Append. Text("Type: " + ftdi. Device. List[i]. Type. To. String() + "n"); rtb_Display. Append. Text("ID: " + String. Format("{0: x}", ftdi. Device. List[i]. ID) + "n"); rtb_Display. Append. Text("Location ID: " + String. Format("{0: x}", ftdi. Device. List[i]. Loc. Id) + "n" rtb_Display. Append. Text("Serial Number: " + ftdi. Device. List[i]. Serial. Number. To. String() + "n"); rtb_Display. Append. Text("Description: " + ftdi. Device. List[i]. Description. To. String() + "n"); rtb_Display. Append. Text("n n"); } //Setup the serial port parameters -- removed ft. Status = my. Ftdi. Device. Set. Bit. Mode(0 x 00, 0 x 00); //reset ft. Status = my. Ftdi. Device. Set. Bit. Mode(0 x 00, 0 x 08); // switch to mcu mode ACOE 243 13
Output to the FT 2232 Port private void bt. Write_Click(object sender, Event. Args e) { byte[] Sbuff = new byte[] {0 x 92, 0 x 01, 0 x 66}; Sbuff[1] = byte. Parse(tb_WAddress. Text); Sbuff[2] = byte. Parse(tb_WData. Text); UInt 32 num. Bytes. Written = 0; ft. Status = my. Ftdi. Device. Write(Sbuff, 3, ref num. Bytes. Written); if (ft. Status != FTDI. FT_STATUS. FT_OK) { Console. Write. Line("Failed to write to device (error " + ft. Status. To. String() + ")"); return; } } ACOE 243 14
- Slides: 14