Programming AI with Leaf/Development/Installing drivers for Microcontroller

FTDI driver installation for microcontroller board
Intro

The USB interface between the robot’s PC or laptop an the microcontroller board has sometimes been difficult to get working correctly. Recently, FTDI (ftdichip.com), the manufacturer of the USB chip installed on the USB module on the microcontroller board, has come out with a new driver installation method using a simple setup.exe program.

I’ve tried this program on Windows XP, Vista and Windows 7 (32 and 64 bit versions) with success, so I’m going to use that method below. If it ever fails to install properly, let me know and we’ll try the good old problematic installation methods.

Prerequisites

The only hardware required is  the DLP-USB245M module installed on the microcontroller board,  the USB cable, and the PC or laptop with USB ports (1.0 or 2.0)

We are using the latest version of the driver from the chip manufacturer. See ftdichip.com/FTDrivers.htm Note that there are two types of driver interfaces available. A Virtual Com Port (VCP) which appears to the PC software exactly like a com port but without baudrate limitations. And a direct driver (D2XX) which the PC interfaces with through a DLL. The NavAndControl.exe software in the Leaf PC uses the D2XX interface.

So, step 1 is to get the latest driver. You will find on page ftdichip.com/Drivers/D2XX.htm that they have a single driver, called the “Combined Driver Model” which supports both the VCP interface and the DLL. This driver is currently (as of 8/28/10) version 2.08.02 which is available as a zip file or as a setup exe. We’ll be using the setup.exe

This driver installation supports Windows XP, Vista and Windows 7 in both 32 and 64 bit versions. As far as I know, this driver (or previous versions) has been installed in Windows XP and Vista 32 bit versions and in Windows 7 in 32 and 64bit versions. Installation varies slightly between Windows versions, so sections are provided below for each version.

Windows XP or Vista

The following was tested on a newly installed version of XP (32 bit) with SP3 installed and on a machine running Vista with SP2. I found no instructions for using this setup, so I did it as follows:

Don’t plug in the USB cable yet (to avoid potential automatic installation of an incorrect driver.)

Download the Setup.exe referred to above from http://ftdichip.com/Drivers/D2XX.htm I always Save rather than Run so I have a copy for later use. Save it anywhere you want to keep it. Note, it downloads as “CDM20802_Setup.exe”.

Run the file by double clicking on it. A console window comes up saying “32 bit OS detected” and automatically installs and closes. This usually takes just a couple seconds. (Once I had it hang up in the install phase. I closed the window and restarted the program and it completed normally.)

Plug in the USB cable (the microcontroller board does not need to be powered since the DLP-USB module is powered from the USB cable. However, the module must be plugged onto the microcontroller board since there are connections that have to be made.)

The “Found New Hardware” popup appeared. After a minute or so, it changed to “your new hardware is installed and ready to use” (or “your new device…”).

If it doesn’t say your new hardware is installed and ready to use, go to Troubleshooting Driver below.

Otherwise, continue to Testing Interface below.

Windows 7 (32 and 64 bit versions)

First time the microcontroller board was connected to the Windows 7 machine, the “Installing Device Driver Software” window came up followed quickly by  “Device Driver software installed successfully”

Drivers show up in Device manager as USB Serial Port in Ports, and as USB Serial Converter in Universal Serial Bus Controllers.

The Driver is:  FTDI  Version  2.8.2.0 which is the latest version as of 8/28/10

I can’t say for sure whether the drivers are preinstalled in Windows 7 or they were downloaded automatically from the internet.

If the above doesn’t work on your machine, I assume you can download the setup.exe version of this driver and install as described above for XP. If you don’t have internet access, you can download setup.exe on any computer with access and copy it to your robot computer.

If it doesn’t say your new hardware is installed and ready to use, go to Troubleshooting Driver below.

Otherwise, continue to Testing Interface below.

''Hmmm, before attempting the following test using NavAndControl, be aware that I just tried running NavAndControl on my Windows 7 machine and it wouldn’t start. I’m SURE I had it working before. However, the LeafUSBtest.exe program referred to elsewhere for troubleshooting did run successfully on both the 32 and 64 bit machines, so the USB interface is working.''

Testing Interface

At this point, the drivers are installed you should be able to test the interface by installing the Leaf runtime version of code into the microcontroller (if not already done) and run NavAndControl.exe from the Leaf folder as described in the software installation instructions.

Make sure the microcontroller Run/Prog switch is in the Run position and the microcontroller board is powered. Press the reset button on the microcontroller Adapt board.

You will initially see a red annunciator window in the upper left corner of the NavAndControl window which says “Micro Inactive”. The Window should turn amber within a few seconds and say “Micro Active” if everything is working. Otherwise it will remain red. If red, continue with the troubleshooting tips below. It is possible, but unlikely, that the annunciator will turn green after a while and say “Micro Ready”. This would mean that the yaw rate gyro is all set up and calibrated. The “Micro active” state is adequate for all basic operation.

So, if you got Micro Active or Ready, you have successfully installed the drivers. If not, continue with Troubleshooting Interface below.

Troubleshooting Driver:

Try another USB cable.

There are driver installation instructions available at http://ftdichip.com/Support/Documents/InstallGuides.htm in case my instructions don’t work. These guides have directions for installing as well as troubleshooting instructions.

If you don’t have any luck with these, ask for help on the mail list.

You can do further verification that the driver is correct with the following:

You can verify that both the VCP and D2XX interfaces are installed by going to device manager and checking that USB Serial port COM4 is listed in PORTS and USB Serial converter is listed in Universal Serial Bus Controllers

If you want to be sure that the two references above are your microcontroller module (and not something else you have installed that looks similar), you can either disconnect the cable and see that both references disappear; or you can double click each reference in device manager, look at the “Details” tab and see that the device is VID 0403 & PID 6001 which is the identication of this specific module chip.

Another check you can make that the laptop is talking to the USB module properly is to download a small utility program called “Microsoft usbview.exe” from http://ftdichip.com/Support/Utilities.htm

Run this program and you should see an entry called “USB serial converter”. Double click this entry and you will see a list of parameters for this device which should include that it is a DLP-USB245M.

Troubleshooting Interface:

If the interface does not appear to be working with NavAndControl, you can run a simpler test to just verify the usb interface. There is a test program called “LeafUSBtest.exe” located on the website under software utilities and/or on the mail list files section.. You just attach the USB cable from the PC to the microcontroller AND apply power to the micro. I'm assuming that the usual runtime software is installed on the micro and the micro is set to run when power is applied. Then run the program from any location. It puts up a simple console window which will do two things. It enumerates the USB devices on your PC that have interface chips manufactured by FTDI (ftdichip.com). This should include the chip on the USB module which you have plugged into the microcontroller board as well as any others, for example, you may have some in common USB serial converter cables. So, it gives you the number of such chips found, and the descriptions of those chips. It is looking for a chip whose description is "DLP-USB245M" (which most people have) or "D2XX Recover PID for XP" which is an old version but some people may still have it. Having found the correct chip it will initialize it and return and error code of zero (printed on the screen). If successful. It then transmits all the numbers from 1 to 256 down to the micro which echos them back to the screen. This proves the 8 bit parallel interface to the microcontroller is all working in both directions. It will then report success or failure.

There are several pins that must be wired together on the microcontroller board. To check the connection of the USB module to the microcontroller board, verify that the USB module has 5 vdc on pins 3, 10, 11 and 12. This test must be done with the USB cable installed and the laptop powered up. If not, check your soldering of those pins on the micro board and/or verify continuity between all those pins with an ohmmeter. These pins are sufficient to install the driver, but there are additional pins required to transfer data which the LeafUSBtest.exe program can verify. These pins alone should allow the LeafUSBtest program to at least talk to the USB module even if it can’t send microcontroller data back and forth.

If you install using the Setup.exe, it will automatically move FTD2xx.dll to the Windows/system32 folder. Verify that it is there. It should have a date the same as the setup.exe file (7/12/2010 for ver 2.08.02)

Notes:

The USB module on the microcontroller board is the DLP-USB245M which is available from digikey.com as their part number 813-1019-ND.

The cable is a standard USB cable with a type A connector on one end and a B on the other.

Any PC USB port should work. (but it never hurts to try another if one doesn’t work)

--Rbirac (talk) 15:41, 29 August 2010 (UTC)