Difference between revisions of "DIY USB adapter"
(Marked this version for translation) |
|||
Line 184: | Line 184: | ||
sudo dfu-programmer at90usb162 reset | sudo dfu-programmer at90usb162 reset | ||
− | ==Serial port settings== | + | ==Serial port settings== <!--T:33--> |
+ | <!--T:34--> | ||
On Windows the driver for FTDI chips (e.g. FT232R, FT230X, FT231X...) provides a "Latency Timer" setting than should be set to 1ms for optimal performance.<br /> | On Windows the driver for FTDI chips (e.g. FT232R, FT230X, FT231X...) provides a "Latency Timer" setting than should be set to 1ms for optimal performance.<br /> | ||
The procedure is detailed on the FTDI website: [http://www.ftdichip.com/Support/Knowledgebase/index.html?cdmcomportadvancedproperti.htm link]. | The procedure is detailed on the FTDI website: [http://www.ftdichip.com/Support/Knowledgebase/index.html?cdmcomportadvancedproperti.htm link]. |
Revision as of 17:48, 6 November 2016
This page explains how to build a GIMX DIY USB adapter.
A much easier but less complete tutorial is also available: DIY USB Adapter for dummies.
A German translation of a previous version is also available on the forum: old German translation.
Warning: you are responsible for the hardware you buy, and anything right or wrong you do with this.
Contents
Required hardware parts
USB to serial TTL converter
Make sure it works at 500kbps and that it is 5V tolerant.
chip | CP2102 | FT232R | PL2303HX | CH340 | FT230X |
5V tolerant | yes | (1) | (1) | (1) | yes |
500 kbps | yes | yes | (2) | no | yes |
compatible | yes | (1) | (1)(2) | no | yes |
(1) depends on the board
(2) only on Linux
Examples:
- MicroFTX (10$ excl. shipping costs)
- CP2102 converters on ebay (as low as 3$)
- FT232R converters on ebay (as low as 4$)
- CP2102 converter at sparkfun (22$ excl. shipping costs)
- FT232R converter at sparkfun (15$ excl. shipping costs)
- Some devices like the arduino have an on-board usb to serial chip (remove the AVR chip to use it)
- A second usb development board can also be programmed as a usb to serial converter.
AVR USB development board
Make sure it is working at 5V and that is has a chip among the following: at90usb82, at90usb162, at90usb646, at90usb647, at90usb1286, at90usb1287, atmega16u2, atmega32u2, atmega16u4, atmega32u4
Examples:
- Teensy 2.0 board (atmega32u4, 16$ excl. shipping costs) (to build a solderless adapter, take a board with header pins) (newer Teensy 3.x and LC boards are NOT compatible as they do not have the same chip)
- Boards used for the psgroove hack (check the on-board chip).
- Arduino-compatible boards based on the atmega32u4 chip
- Arduino Leonardo - distributors - (cheap Chinese clones can be found on ebay for 11$ incl. shipping costs)
- Cheap atmega32u4 boards on ebay (about 4$). Soldering required.
Recommended setup
- CP2102 converter from ebay (very low price, but sometimes low delivery)
- Teensy 2.0 board (low price, good quality, and quick delivery).
Wiring
The only thing you have to do is to connect the following pins:
USB dev board | USB to UART board |
GND | GND |
RX | TX / TXO / TXD |
TX | RX / RXI / RXD |
Warning: some adapters are mislabeled and have inverted RX/TX.
With a Teensy 2.0 or Arduino Leonardo as a USB dev board:
Arduino Leonardo | Teensy 2.0 | USB to UART board |
GND | GND | GND |
0 (RX1) | D2 | TX / TXO / TXD |
1 (TX1) | D3 | RX / RXI / RXD |
If you use the arduino on-board USB to serial converter, Rx and Tx are inverted, i.e. Rx = TX▶ and Tx = RX◀
The example below shows how to connect a (mislabeled) CP2102 converter (left) to a Teensy 2.0 board (right):
It's possible to solder wires or to use jumper wires (these are generally provided with USB to serial TTL boards) in case your AVR USB board has header pins:
Examples:
- Bumble-b and FT232RL wired on a breadboard:
- Teensy++ and CP2102 wired on a breadboard:
- Teensy 2.0 and CP2102 soldered:
Firmware loading
- EMUJOYSTICKPS3: HID joystick emulation, with 16bit stick axes, for PS3
- EMUPS3: Sixaxis emulation, for PS3
- EMU360: 360 pad emulation, for Xbox 360
- EMUPS4: Hori Pad FPS Plus emulation, for PS4 (with touchpad support)
- EMUXONE: Xbox One pad emulation, for Xbox One
- EMUG29PS4: Logitech G29 gaming wheel emulation, for PS4, with force feedback support
- EMUG27PS3: Logitech G27 gaming wheel emulation, for PS3, with force feedback support
- EMUGTFPS2: Logitech GT Force emulation, for PS2, with force feedback support
- EMUDFPS2: Logitech Driving Force emulation, for PS2, with force feedback support
- EMUDFPPS2: Logitech Driving Force Pro emulation, for PS2, with force feedback support
- EMUG27PC: Logitech G27 gaming wheel emulation, for PC, force feedback support
Teensy boards
Teensy boards can be easily flashed using the Teensy Loader.
It is probably the easier to use flashing tool, but it is only compatible with genuine teensy boards.
Cheap Arduino-compatible atmega32u4-based boards
Using the Arduino Builder tool
- Download the Arduino Leonardo drivers and save them into the same folder:
- Right-click on the arduino.inf file and click on Install.
- Make sure that the USB to UART board (e.g. CP2102) is connected and powered, and that the wiring with the atmega32u4 board is correct.
- Make sure that the atmega32u4 board is connected and powered.
- Download the Arduino Builder tool and extract the archive (using 7zip).
- Run ArduinoBuilder.exe.
- Click on "Load Sketch / HEX", and select the desired atmega32u4.hex firmware.
- Click on "Board Type" and select "Arduino Leonardo".
- Click on the COM port that matches the "Silicon Labs CP210x ... (COMX)" COM port in the device manager (or whatever the name of your USB to UART board is). This is a trick to make the Arduino Builder tool look for a new COM port.
- The following message should appear: "Forcing reset using 1200bps open/close on COMX...".
- Quickly unplug/replug the atmega32u4 board, or connect RST to GND twice.
- The atmega32u4 board should run the bootloader. The Arduino builder tool should find the Arduino Leonardo COM port and flash the firmware.
Upon success a "Uploading completed!" message should be displayed.
Using Avrdude
- Download the Arduino Leonardo drivers and save them into the same folder:
- Right-click on the arduino.inf file and click on Install.
- Make sure that the USB to UART board (e.g. CP2102) is connected and powered, and that the wiring with the atmega32u4 board is correct.
- Make sure that the atmega32u4 board is connected and powered.
- Download the Arduino Builder tool and extract the archive (using 7zip).
- Press shift and right-click into the bin folder, and click on "Open command window here".
- Type the following text but don't press enter:
avrdude -p atmega32u4 -c avr109 -P COM7 -D -U flash:w:<path to atmega32u4.hex>:i
- Make sure to replace "<path to atmega32u4.hex>" in the command line with the location of the firmware to load (for example: C:\Users\YourUserName\Downloads\firmwares-5.0\EMUPS4\atmega32u4.hex).
- Move the cursor right after COM7.
- Open the device manager, and unfold the COM port item.
- Quickly unplug/replug the atmega32u4 board, or connect RST to GND twice.
- The atmega32u4 board should run the bootloader. As soon as you see it appearing in the device manager, change the COM port number in the CMD window and press enter.
- The bootloader is executed very briefly. You may have to make a few attempts before the firmware gets loaded correctly!
In GNU/Linux, the avrdude command is:
avrdude -p atmega32u4 -c avr109 -P /dev/ttyACM0 -D -U flash:w:atmega32u4.hex:i
(make sure to adjust the port and the file)
Other tools
There are a few other tools that can be used to load the hex file:
- Flip utility from Atmel (not compatible with genuine teensy boards and with Arduino-compatible atmega32u4-based boards)
- dfu-programmer command-line tool (not compatible with genuine teensy boards and with Arduino-compatible atmega32u4-based boards)
dfu-programmer example:
sudo dfu-programmer at90usb162 erase sudo dfu-programmer at90usb162 flash at90usb162.hex sudo dfu-programmer at90usb162 reset
Serial port settings
On Windows the driver for FTDI chips (e.g. FT232R, FT230X, FT231X...) provides a "Latency Timer" setting than should be set to 1ms for optimal performance.
The procedure is detailed on the FTDI website: link.
Next Tutorial
Now that your adapter is ready you can follow the instructions on the Quick Start page.