Difference between revisions of "DIY USB adapter"

From GIMX
Jump to: navigation, search
(Marked this version for translation)
 

(22 intermediate revisions by 3 users not shown)

Line 4: Line 4:
  
 
<!--T:22-->
 
<!--T:22-->
'''[https://blog.gimx.fr/shop/ Buy a ready to use GIMX adapter from the official GIMX shop.]'''<br />
+
'''[https://blog.gimx.fr/product/gimx-adapter/ Buy a ready to use GIMX adapter from the official GIMX shop.]'''<br />
 
'''A much easier but less complete tutorial is also available: [[DIY_USB_adapter_for_dummies|DIY USB Adapter for dummies]].'''<br />
 
'''A much easier but less complete tutorial is also available: [[DIY_USB_adapter_for_dummies|DIY USB Adapter for dummies]].'''<br />
 
A German translation of a previous version is also available on the forum: [https://forum.gimx.fr/viewtopic.php?f=4&t=362 old German translation].
 
A German translation of a previous version is also available on the forum: [https://forum.gimx.fr/viewtopic.php?f=4&t=362 old German translation].
Line 12: Line 12:
  
 
==Required hardware parts== <!--T:3-->
 
==Required hardware parts== <!--T:3-->
 +
 +
===USB to UART adapter=== <!--T:4-->
  
 
<!--T:35-->
 
<!--T:35-->
 
<div class="mw-collapsible mw-collapsed">
 
<div class="mw-collapsible mw-collapsed">
 
===USB to UART adapter=== <!--T:4-->
 
 
<!--T:36-->
 
<div class="mw-collapsible-content">
 
  
 
<!--T:37-->
 
<!--T:37-->
Line 62: Line 59:
 
<!--T:38-->
 
<!--T:38-->
 
</div>
 
</div>
</div>
+
 
 +
=== AVR USB development board === <!--T:5-->
  
 
<!--T:39-->
 
<!--T:39-->
 
<div class="mw-collapsible mw-collapsed">
 
<div class="mw-collapsible mw-collapsed">
 
=== AVR USB development board === <!--T:5-->
 
 
<!--T:40-->
 
<div class="mw-collapsible-content">
 
  
 
<!--T:41-->
 
<!--T:41-->
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<br />
+
Make sure it is '''working at 5V''' and that is has a chip among the following: '''atmega32u4''', <s>at90usb82, at90usb162, at90usb646, at90usb647, at90usb1286, at90usb1287, atmega16u2, atmega32u2, atmega16u4,</s><br />
There is a known issue with at90usb162, at90usb1286 and at90usb1287 boards. Other chips may be impacted. The best choice is an atmega32u4 board.<br />
+
<span style="color:red; font-weight:bold;">There is a known issue with at90usb162, at90usb1286 and at90usb1287 boards. Other chips may be impacted. The best choice is an '''atmega32u4''' board.</span><br />
 
Examples:
 
Examples:
* [http://www.pjrc.com/store/teensy.html Teensy 2.0 board (atmega32u4, 16$ excl. shipping costs)] (to build a solderless adapter, take a board [http://www.pjrc.com/store/teensy_pins.html with header pins]) (newer Teensy 3.x and LC boards are NOT compatible as they do not have the same chip)
+
* [http://www.pjrc.com/store/teensy.html Teensy 2.0 board ('''atmega32u4''', '''16$''' excl. shipping costs)] <span style=" font-weight:bold;">(Warning: Chinese clones of Teensy are '''NOT SUPPORTED''', use only genuine product)</span> (to build a solderless adapter, take a board [http://www.pjrc.com/store/teensy_pins.html with header pins]) (newer Teensy 3.x and LC boards are NOT compatible as they do not have the same chip)
 +
* Arduino-compatible boards based on the '''atmega32u4 chip''' '''(4$-11$)'''
 +
** [http://arduino.cc/en/Main/ArduinoBoardLeonardo Arduino Leonardo] - [http://arduino.cc/en/Main/Buy distributors] - (cheap Chinese clones can be found on ebay for '''11$''' incl. shipping costs)
 +
** [http://www.ebay.com/sch/i.html?_sop=15&_from=R40&_sacat=0&_nkw=pro+micro+atmega32u4+-atmega328&LH_PrefLoc=2&rt=nc&LH_BIN=1 Cheap '''atmega32u4''' boards on ebay] (about 4$). Soldering required.
 
* Boards used for the psgroove hack (check the on-board chip).
 
* Boards used for the psgroove hack (check the on-board chip).
* Arduino-compatible boards based on the atmega32u4 chip
 
** [http://arduino.cc/en/Main/ArduinoBoardLeonardo Arduino Leonardo] - [http://arduino.cc/en/Main/Buy distributors] - (cheap Chinese clones can be found on ebay for 11$ incl. shipping costs)
 
** [http://www.ebay.com/sch/i.html?_sop=15&_from=R40&_sacat=0&_nkw=pro+micro+atmega32u4+-atmega328&LH_PrefLoc=2&rt=nc&LH_BIN=1 Cheap atmega32u4 boards on ebay] (about 4$). Soldering required.
 
  
 
<!--T:42-->
 
<!--T:42-->
</div>
 
 
</div>
 
</div>
  
 
==Wiring== <!--T:12-->
 
==Wiring== <!--T:12-->
 +
 +
===Connection table=== <!--T:44-->
  
 
<!--T:43-->
 
<!--T:43-->
 
<div class="mw-collapsible mw-collapsed">
 
<div class="mw-collapsible mw-collapsed">
 
===Connection table=== <!--T:44-->
 
 
<!--T:45-->
 
<div class="mw-collapsible-content">
 
  
 
<!--T:13-->
 
<!--T:13-->
Line 124: Line 113:
 
<!--T:46-->
 
<!--T:46-->
 
</div>
 
</div>
</div>
+
 
 +
===Examples=== <!--T:48-->
  
 
<!--T:47-->
 
<!--T:47-->
 
<div class="mw-collapsible mw-collapsed">
 
<div class="mw-collapsible mw-collapsed">
 
===Examples=== <!--T:48-->
 
 
<!--T:49-->
 
<div class="mw-collapsible-content">
 
  
 
<!--T:19-->
 
<!--T:19-->
* mislabeled CP2102 converter (left) to a Teensy 2.0 board (right)
+
* /!\ '''mislabeled''' /!\ CP2102 converter (left, TXD and RXD are inverted) to a Teensy 2.0 board (right). '''Warning, new versions may be labeled properly!'''
 
:<div class="image200px">[https://gimx.fr/img/screenshots/PC-to-PS3-USB-controller.JPG https://gimx.fr/img/screenshots/PC-to-PS3-USB-controller.JPG]</div>
 
:<div class="image200px">[https://gimx.fr/img/screenshots/PC-to-PS3-USB-controller.JPG https://gimx.fr/img/screenshots/PC-to-PS3-USB-controller.JPG]</div>
 
* using jumper wires (these are generally provided with USB to serial TTL boards) in case your AVR USB board has header pins:
 
* using jumper wires (these are generally provided with USB to serial TTL boards) in case your AVR USB board has header pins:
Line 147: Line 132:
  
 
<!--T:50-->
 
<!--T:50-->
</div>
 
 
</div>
 
</div>
  
 
==Firmware loading== <!--T:8-->
 
==Firmware loading== <!--T:8-->
  
<!--T:51-->
+
'''Firmwares'''
 +
 
 
<div class="mw-collapsible mw-collapsed">
 
<div class="mw-collapsible mw-collapsed">
  
===Firmwares=== <!--T:52-->
 
 
<!--T:53-->
 
<div class="mw-collapsible-content">
 
 
<!--T:9-->
 
 
[http://gimx.fr/download/gimx-firmwares Download link]<br/>
 
[http://gimx.fr/download/gimx-firmwares Download link]<br/>
 
Available controller emulations:
 
Available controller emulations:
 
{{Firmwares/en}}
 
{{Firmwares/en}}
  
<!--T:54-->
 
</div></div>
 
 
===GIMX adapter or Arduino-compatible atmega32u4-based boards=== <!--T:26-->
 
 
<!--T:55-->
 
<div class="mw-collapsible mw-collapsed">
 
 
====Using the GIMX loader tool==== <!--T:56-->
 
 
<!--T:57-->
 
<div class="mw-collapsible-content">
 
 
<!--T:58-->
 
'''(easy method, recommended)'''
 
 
<!--T:59-->
 
* Download the [https://gimx.fr/download/gimx_loader.zip GIMX loader tool] and unzip the archive.
 
* Right-click on the arduino.inf file and click on Install.
 
* Replace the atmega32u4.hex file with the one you which to load (the firmware included in the archive is the EMUG29PS4 one).
 
* Run loader.exe and follow the instructions.
 
Upon success a "Success! Press enter to exit." message should be displayed.<br />
 
 
<!--T:60-->
 
</div></div>
 
 
<!--T:61-->
 
<div class="mw-collapsible mw-collapsed">
 
 
====Using Avrdude==== <!--T:29-->
 
 
<!--T:62-->
 
<div class="mw-collapsible-content">
 
 
<!--T:63-->
 
'''(hard method, not recommended)'''
 
 
<!--T:30-->
 
* Download the [https://gimx.fr/download/arduino_drivers.zip Arduino Leonardo drivers] and unzip the archive.
 
* 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 (see above GND->GND, TXD->RXD, RXD->TXD).
 
* Make sure that the atmega32u4 board is connected to your computer and powered.
 
* You should now have the atmega32u4 board connected via the USB-to-UART  ''and'' via its on-board USB port
 
* Download the [http://sourceforge.net/projects/arduinodev/files/ArduinoBuilder/ArduinoBuilder-0.9.1.7z/download Arduino Builder tool] and extract the archive (using [http://www.7-zip.org/ 7zip]).
 
* Open a command window (cmd) and change the current directory to the extracted ArduinoBuilder folder. e.g. cd "C:\Path\To\ArduinoBuilder\", or simply shift-right-click in windows file explorer and click "open command window here."
 
* Type the following text but don't press enter:
 
avrdude -p atmega32u4 -c avr109 -P COMx -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).
 
* Open the device manager, and expand the "Ports" item. You should see your USB-to-UART driver (e.g. CP2102) connected to a COM port and the Arduino connected to another COM port. *Neither* of these are the COM ports you're looking for, in all likelihood.
 
* Unplug/replug the atmega32u4 on-board USB (''not'' the USB-to-UART) from your computer (doing this on the computer side rather than the Arduino side may be easier). When you replug it back in, watch the device manager, and notice which COM port is opened when the bootloader starts up. Ideally, this will be the same every time it is disconnected and reconnected. *THIS* is the COM port you want!
 
* Change the "x" in "COMx" in the above command to the number of the COM port that the bootloader uses.
 
* Unplug and replug the atmega32u4 USB again, and as soon the bootloader COM shows up, press enter to execute your command
 
* The bootloader is executed very briefly. You may have to make a few attempts before the firmware gets loaded correctly!
 
* If successful, avrdude should say "avrdude done. Thank you."
 
 
<!--T:31-->
 
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)
 
 
<!--T:64-->
 
</div>
 
</div>
 
 
<!--T:65-->
 
<div class="mw-collapsible mw-collapsed">
 
 
===Teensy boards=== <!--T:24-->
 
 
<!--T:66-->
 
<div class="mw-collapsible-content">
 
 
<!--T:25-->
 
Teensy boards can be easily flashed using the [http://www.pjrc.com/teensy/loader.html Teensy Loader].<br />
 
It is only compatible with '''genuine''' teensy boards.
 
 
<!--T:67-->
 
</div>
 
 
</div>
 
</div>
  
<!--T:68-->
+
{{FirmwareLoading}}
<div class="mw-collapsible mw-collapsed">
 
 
 
===Other tools (DFU-compatible boards)=== <!--T:32-->
 
 
 
<!--T:69-->
 
<div class="mw-collapsible-content">
 
 
 
<!--T:10-->
 
There are a few other tools that can be used to load the hex file:
 
* [http://www.atmel.com/tools/FLIP.aspx Flip utility from Atmel] (not compatible with genuine teensy boards and with Arduino-compatible atmega32u4-based boards)
 
* [http://dfu-programmer.sourceforge.net/ dfu-programmer command-line tool] (not compatible with genuine teensy boards and with Arduino-compatible atmega32u4-based boards)
 
 
 
<!--T:11-->
 
dfu-programmer example:
 
    sudo dfu-programmer at90usb162 erase
 
    sudo dfu-programmer at90usb162 flash at90usb162.hex
 
    sudo dfu-programmer at90usb162 reset
 
 
 
<!--T:70-->
 
</div></div>
 
 
 
<!--T:71-->
 
<div class="mw-collapsible mw-collapsed">
 
  
 
==Serial port settings== <!--T:33-->
 
==Serial port settings== <!--T:33-->
Line 275: Line 153:
 
This is needed on Windows, for USB to UART adapters based on a FTDI chip.
 
This is needed on Windows, for USB to UART adapters based on a FTDI chip.
  
<!--T:73-->
+
<!--T:71-->
<div class="mw-collapsible-content">
+
<div class="mw-collapsible mw-collapsed">
  
 
<!--T:34-->
 
<!--T:34-->
Line 283: Line 161:
  
 
<!--T:74-->
 
<!--T:74-->
</div>
 
 
</div>
 
</div>
  
Line 289: Line 166:
  
 
<!--T:21-->
 
<!--T:21-->
Now that your adapter is ready you can follow the instructions on the [[Quick_Start|Quick Start page]].
+
Now that your adapter is ready you can follow the instructions on the [[Installation|Installation page]].
 
</translate>
 
</translate>

Latest revision as of 22:33, 4 April 2018

Other languages:
English • ‎français

This page explains how to build a GIMX DIY USB adapter.

Buy a ready to use GIMX adapter from the official GIMX shop.
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.

Required hardware parts

USB to UART adapter

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:

AVR USB development board

Make sure it is working at 5V and that is has a chip among the following: atmega32u4, at90usb82, at90usb162, at90usb646, at90usb647, at90usb1286, at90usb1287, atmega16u2, atmega32u2, atmega16u4,
There is a known issue with at90usb162, at90usb1286 and at90usb1287 boards. Other chips may be impacted. The best choice is an atmega32u4 board.
Examples:

Wiring

Connection table

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◀

Examples

  • /!\ mislabeled /!\ CP2102 converter (left, TXD and RXD are inverted) to a Teensy 2.0 board (right). Warning, new versions may be labeled properly!
PC-to-PS3-USB-controller.JPG
  • using jumper wires (these are generally provided with USB to serial TTL boards) in case your AVR USB board has header pins:
solderless.jpg
  • Bumble-b and FT232RL wired on a breadboard:
ft232rl_bumbleb.jpg
  • Teensy++ and CP2102 wired on a breadboard:
cp2102_teensy++.jpg
  • Teensy 2.0 and CP2102 soldered:
soldered.jpg

Firmware loading

Firmwares

Download link
Available controller emulations:

  • 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

GIMX adapter or Arduino-compatible atmega32u4-based boards

Using gimx-loader

(easy method, recommended)

  • Install the GIMX software.
  • Run gimx-launcher.
  • Click on "Help > Update firmware".
  • Select a firmware, click on "Load", and follow the instructions.

Upon success a "Firmware loaded successfully!" message should be displayed.

Notes:

  • gimx-loader is available since GIMX 6.8
  • it is not necessary to download the firmwares since they are provided by the installer

Using Avrdude

(hard method, not recommended)

  • Download the Arduino Leonardo drivers and unzip the archive.
  • 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 (see above GND->GND, TXD->RXD, RXD->TXD).
  • Make sure that the atmega32u4 board is connected to your computer and powered.
  • You should now have the atmega32u4 board connected via the USB-to-UART and via its on-board USB port
  • Download the Arduino Builder tool and extract the archive (using 7zip).
  • Open a command window (cmd) and change the current directory to the extracted ArduinoBuilder folder. e.g. cd "C:\Path\To\ArduinoBuilder\", or simply shift-right-click in windows file explorer and click "open command window here."
  • Type the following text but don't press enter:
avrdude -p atmega32u4 -c avr109 -P COMx -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).
  • Open the device manager, and expand the "Ports" item. You should see your USB-to-UART driver (e.g. CP2102) connected to a COM port and the Arduino connected to another COM port. *Neither* of these are the COM ports you're looking for, in all likelihood.
  • Unplug/replug the atmega32u4 on-board USB (not the USB-to-UART) from your computer (doing this on the computer side rather than the Arduino side may be easier). When you replug it back in, watch the device manager, and notice which COM port is opened when the bootloader starts up. Ideally, this will be the same every time it is disconnected and reconnected. *THIS* is the COM port you want!
  • Change the "x" in "COMx" in the above command to the number of the COM port that the bootloader uses.
  • Unplug and replug the atmega32u4 USB again, and as soon the bootloader COM shows up, press enter to execute your command
  • The bootloader is executed very briefly. You may have to make a few attempts before the firmware gets loaded correctly!
  • If successful, avrdude should say "avrdude done. Thank you."

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)

Teensy boards

Teensy boards can be easily flashed using the Teensy Loader.
It is only compatible with genuine teensy boards.

Other tools (DFU-compatible boards)

There are a few other tools that can be used to load the hex file:

dfu-programmer example:

   sudo dfu-programmer at90usb162 erase
   sudo dfu-programmer at90usb162 flash at90usb162.hex
   sudo dfu-programmer at90usb162 reset

Serial port settings

This is needed on Windows, for USB to UART adapters based on a FTDI chip.

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 Installation page.