Différences entre versions de « RASP-FT232H-MPSSE-Windows »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
Ligne 71 : Ligne 71 :
 
That's all you need to do to install libftdi.  Let's move on to install the Adafruit Python GPIO library next.
 
That's all you need to do to install libftdi.  Let's move on to install the Adafruit Python GPIO library next.
  
== Bibliothèque Adafruit Pyhton GPIO ==
+
== Bibliothèque Adafruit Python GPIO ==
 
Finally let's install the Adafruit Python GPIO library which will allow your Python scripts to access the MPSSE functionality of the FT232H breakout
 
Finally let's install the Adafruit Python GPIO library which will allow your Python scripts to access the MPSSE functionality of the FT232H breakout
  
Ligne 81 : Ligne 81 :
  
 
  <nowiki>python setup.py install</nowiki>
 
  <nowiki>python setup.py install</nowiki>
 +
 +
Note if you see an error that Python can't be found then make sure you installed Python 2.7 as mentioned at the top of the page, and that it was added to your system path. [http://stackoverflow.com/questions/6318156/adding-python-path-on-windows-7 Here's more details on how to manually add Python to your system path].
 +
 +
You should see the Python library install itself with text similar to the below:
 +
 +
{{ADFImage|RASP-FT232H-MPSSE-Windows-30.png}}
 +
 +
Now let's test if both the libftdi and Adafruit Python GPIO libraries were correctly installed.  In the command terminal run Python by executing:
 +
 +
<nowiki>python</nowiki>
 +
 +
Once the Python interpretor has loaded, type the following at the >>> prompt:
 +
 +
<syntaxhighlight lang="python">
 +
import Adafruit_GPIO
 +
import ftdi1
 +
</syntaxhighlight>
 +
 +
You should see no response from the Python interpretor after entering each command like below:
 +
 +
{{ADFImage|RASP-FT232H-MPSSE-Windows-31.png}}
 +
 +
No response from the Python interpretor is a good sign because it means Python was able to successfully load the libraries.
 +
 +
If you see an error message or failure after entering a command, unfortunately something went wrong with the installation of the library.  Go back through the steps above and carefully check that nothing was missed.  You want to make sure all the libftdi files are copied into the Python site-packages folder, and that the Adafruit Python GPIO library installed itself successfully.
 +
 +
Once you've confirmed Python can load the libraries, exit the Python interpretor by typing:
 +
 +
<nowiki>quit()</nowiki>
 +
 +
Congratulations, the MPSSE mode drivers and Python libraries are installed and ready to use!  Move on to the next section to see how to use the MPSSE mode to access GPIO, SPI, I2C, etc.
 +
 +
== Désinstallation de libusb ==
 +
Should you ever want to disable the MPSSE mode for the FT232H and return to its serial UART mode follow the steps below.
 +
 +
First make sure the FT232H breakout is plugged in to the computer.  Then open Device Manager and find the '''libusbK USB Devices''' node and the '''USB Serial Converter''' child of that node.  Right click the device and select Uninstall as shown below:
 +
 +
{{ADFImage|RASP-FT232H-MPSSE-Windows-40.png}}
 +
 +
In the dialog that appears make sure the 'Delete the driver software for this device.' option is checked as shown below:
 +
 +
{{ADFImage|RASP-FT232H-MPSSE-Windows-41.png}}
 +
 +
Click '''OK''' and the libusb driver should be completely uninstalled for the device.
 +
 +
Now unplug the FT232H breakout board and go back to the [https://learn.adafruit.com/adafruit-ft232h-breakout/serial-uart#windows-serial-driver-installation Serial UART page] to find the instructions for installing the Windows serial driver.  Follow those instructions again and you should be set with the device acting as a USB serial UART again.
 +
  
 
{{RASP-FT232H-TRAILER}}
 
{{RASP-FT232H-TRAILER}}

Version du 19 février 2017 à 21:13


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

Installation sous Windows

To access the MPSSE mode of the FT232H on Windows we need to install special drivers and software. We'll use a tool called Zadig to replace the FTDI driver for the FT232H with a libusb-based driver required by libftdi. Then we'll download a libftdi binary and install it for Python to access. Finally we'll install the Adafruit Python GPIO library. Carefully follow the steps below to setup the software.

Note: When you enable MPSSE mode the serial UART driver will be disabled. If you want to disable MPSSE mode and enable the serial UART again I'll show instructions at the end of the page.

First before you get started make sure you have Python 2.7 installed. You can download the latest Python 2.7 installer here (at the time of writing it's version 2.7.8, but any 2.7.x version should work--unfortunately the 3.x series isn't supported yet). Download the MSI installer for your version of Windows, either 32-bit or 64-bit, and run the installer. Install Python into its standard location, typically C:\python27. Also make sure to install the option to add Python to the system path so you can easily call the Python interpretor from a command terminal.

Installation de libusb

Download the appropriate Zadig tool for your version of Windows its homepage. This tool simplifies the installation of a libusb driver for the FT232H device.

Before you run the tool unplug all FTDI devices from your computer. This includes devices likebArduinos which include an FTDI chip as a USB to serial converter. You want to unplug these devices to make sure you don't accidentally select one with the tool and replace its driver.

After all the FTDI devices are unplugged, plug in your FT232H breakout to the computer so it is the only FTDI device connected to the computer.

Now run the Zadig tool executable you just downloaded (there is no installation necessary, the executable is the program). Click the Options menu and select the List All Devices item below:

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

The list box of devices should populate with many devices. Select the USB Serial Converter device shown below.

Note: Make sure to select the device with Driver equal to FTDIBUS and USB ID equal to 0403 6014! If you pick the wrong device you might accidentally uninstall another device's driver and make it inoperable.

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Click the up/down arrows on the driver select box to the right of the green arrow and select the libusbK driver as shown above.

Now click the Replace Driver button to replace the FTDI driver with the libusb-based driver. After the driver replacement finishes you can close Zadig tool.

To check that the driver was successfully replaced, open Device Manager from Control Panel or searching in the Start menu. You should see a new top level node libusbK USB Devices and the USB Serial Converter underneath it as shown below.

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

If you see the libusbK node and USB serial device, move on to the next step to install libftdi.

If you don't see the libusbK node, try unplugging and plugging back in the FT232H breakout. If you still don't see the node, run Zadig tool again and follow the steps above again to make sure you replace the FTDI driver for the device with the libusbK driver.

Installation libftdi

This step will install libftdi's Python library. Carefully follow the steps below to make sure the library is installed.

Start by downloading the binary version of the libftdi library by clicking the button below. This binary is provided by the picusb USB resources project.

Download-icon.pnglibftdi1-1.0_devkit_mingw32_17Feb2013.zip

Unzip the archive and you should see a series of folders like below:

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

We need to copy some files from libftdi into Python's package directory. Open another Explorer window and navigate to the location you installed Python earlier, typically C:\python27. Inside the Python directory navigate to the Lib > site-packages folder. Files you copy into this folder will be available globally as packages that your Python scripts can use.

From the libftdi archive folder, copy all the .DLL files from the bin folder into the Python site-packages folder, specifically:

  • bin\libftdi1.dll
  • bin\libftdipp1.dll
  • bin\libgcc_s_dw2-1.dll
  • bin\libiconv-2.dll
  • bin\libintl-8.dll
  • bin\libstdc++-6.dll
  • bin\libusb-1.0.dll

Then also copy in the files from the python2.7 folder of the libftdi archive into the Python site-packages folder:

  • python2.7\_ftdi.pyd
  • python2.7\ftdi1.py

To double check you copied in the right files, your Python site-packages folder should have at least the files below inside it (you might see other files & directories, but don't worry they can be ignored):

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

That's all you need to do to install libftdi. Let's move on to install the Adafruit Python GPIO library next.

Bibliothèque Adafruit Python GPIO

Finally let's install the Adafruit Python GPIO library which will allow your Python scripts to access the MPSSE functionality of the FT232H breakout

First download an archive of the library by clicking the button below:

Download-icon.pngAdafruit Python GPIO Library

Unzip the contents and then open a command terminal and navigate to the directory where the library was unzipped. Execute the following command to install the library:

python setup.py install

Note if you see an error that Python can't be found then make sure you installed Python 2.7 as mentioned at the top of the page, and that it was added to your system path. Here's more details on how to manually add Python to your system path.

You should see the Python library install itself with text similar to the below:

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Now let's test if both the libftdi and Adafruit Python GPIO libraries were correctly installed. In the command terminal run Python by executing:

python

Once the Python interpretor has loaded, type the following at the >>> prompt:

import Adafruit_GPIO
import ftdi1

You should see no response from the Python interpretor after entering each command like below:

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

No response from the Python interpretor is a good sign because it means Python was able to successfully load the libraries.

If you see an error message or failure after entering a command, unfortunately something went wrong with the installation of the library. Go back through the steps above and carefully check that nothing was missed. You want to make sure all the libftdi files are copied into the Python site-packages folder, and that the Adafruit Python GPIO library installed itself successfully.

Once you've confirmed Python can load the libraries, exit the Python interpretor by typing:

quit()

Congratulations, the MPSSE mode drivers and Python libraries are installed and ready to use! Move on to the next section to see how to use the MPSSE mode to access GPIO, SPI, I2C, etc.

Désinstallation de libusb

Should you ever want to disable the MPSSE mode for the FT232H and return to its serial UART mode follow the steps below.

First make sure the FT232H breakout is plugged in to the computer. Then open Device Manager and find the libusbK USB Devices node and the USB Serial Converter child of that node. Right click the device and select Uninstall as shown below:

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

In the dialog that appears make sure the 'Delete the driver software for this device.' option is checked as shown below:

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Click OK and the libusb driver should be completely uninstalled for the device.

Now unplug the FT232H breakout board and go back to the Serial UART page to find the instructions for installing the Windows serial driver. Follow those instructions again and you should be set with the device acting as a USB serial UART again.



Source: Adafruit FT232H Breakout Add a serial protocol 'swiss army knife' to your computer and talk directly to devices with SPI, I2C, serial UART, GPIO's, and more!
Créé par Toni DiCola pour AdaFruit Industries.

Traduction réalisée par Meurisse D pour MCHobby.be.

Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : «  Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.

L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com