Main Site Documentation

FT232R USBHost bad connection


#1

Dear GHI support,

I’m currently programming a FEZ spider with a USB Host Module. Its purpose is to communicate with another microcontroller with a serial connection. The microcontroller uses a FT232R chip for its serial communication as a USB client. The problem is that the USB Host module is unable to detect/connect to this device giving a “Bad Connection” error 100% of the time.

I already checked if the power supply could be the problem, but this doesnt seem to be the case. Do you guys have any idea what may cause this error to occur?

Code below:


using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using System.Text;
using GHI.Premium.USBHost;
using GHI.Premium.System;

namespace GadgeteerApp1
{
    public partial class Program
    {
        void ProgramStarted()
        {
            // Create a timer
            GT.Timer timer = new GT.Timer(500);
  
            timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);
            timer.Start();

            USBHostController.DeviceConnectedEvent += USBHostController_DeviceConnectedEvent;
            USBHostController.DeviceBadConnectionEvent += USBHostController_DeviceBadConnectionEvent;

            // Let the method return
        }

        void USBHostController_DeviceBadConnectionEvent(USBH_Device device)
        {
            Debug.Print("BADCONNECTION");
        }

        void USBHostController_DeviceConnectedEvent(USBH_Device device)
        {
            switch (device.TYPE)
            {
                case GHI.Premium.System.USBH_DeviceType.HID:
                    Debug.Print("HID");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Hub:
                    Debug.Print("HUB");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Joystick:
                    Debug.Print("JOYSTICK");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Keyboard:
                    Debug.Print("KEYBOARD");
                    break;
                case GHI.Premium.System.USBH_DeviceType.MassStorage:
                    Debug.Print("MASSSTORAGE");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Mouse:
                    Debug.Print("MOUSE");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Printer:
                    Debug.Print("PRINTER");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Serial_CDC:
                    Debug.Print("SERIALCDC");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Serial_FTDI:
                    Debug.Print("SERIALFTDI");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Serial_Prolific:
                    Debug.Print("SERIALPROLIFIC");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Serial_Prolific2:
                    Debug.Print("SERIALPROLIFIC2");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Serial_SiLabs:
                    Debug.Print("SERIALSIBLABS");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Serial_Sierra_C885:
                    Debug.Print("SERIALSIERRA");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Sierra_Installer:
                    Debug.Print("SERIALSIERRAINSTALLER");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Unknown:
                    Debug.Print("UNKNOWN");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Video:
                    Debug.Print("VIDEO");
                    break;
                case GHI.Premium.System.USBH_DeviceType.Webcamera:
                    Debug.Print("WEBCAM");
                    break;
                default:
                    break;
            }
        }

        bool Is_LED_On = false;
        void timer_Tick(GT.Timer timer)
        {
            // Do periodic work here
            Mainboard.SetDebugLED(Is_LED_On);
            Is_LED_On = !Is_LED_On;
        }

    }
}


#2

We are looking into it.

Welcome to the community.


#3

Do you have a second Spider or microcontroller you can test with? I was unable to get any bad connections using an FT232R chip we have here. Could you tell us what the microcontroller is?


#4

I have several copies of this microcontroller that give the error aswell. The microcontrollers are from another company and unfortunate its name is a business secret. However i have been granted permission to look into the EEPROM values and adjust them to let the FEZ spider recognize them.

You mentioned that your FT232R chip connected successfully to the FEZ spider. Could you perhaps give me the settings that are available in the FT_Prog program for your FT232R chip?


#5

The one we use has the default settings from the manufacture.


#6

The default FTDI settings do not seem to fix the problem. How much current is the USB Host module able to deliver? It could be that the microcontroller says it has enough power but actually hasnt causing a “Bad connection” error.


#7

It is not the module but the power you have connected. How is your system powered?


#8

The system is currently powered by a laptop with a USB cable connected to a USB Client DP module. The microcontroller needs 100mA in power.

I found in the GadgeteerHardware.xml of the USB Host module that the power is configured at 50mA.

0.050 Infinity

Is it a valid option to change this setting to 0.1 current?


#9

Thanks for the advice. I will try your suggestion and apply a power pack to my USB client DP module.


#10

As andre said, the GadgeteerHardware.xml file only gives information to the Visual Studio designer. Power consumption is listed to help give you an idea of your usage, but it is not a configuration value. The typical current of 0.05 is what you would see used on average, but some devices could draw more current which is why the maximum current is listed as infinite.


#11

As suggested i used a 12V, 1000mA DC power supply that was advised on the USB Client DP page. However the microcontroller still gives a “Bad Connection” error.

A way that did work was using a USB splitter between the microcontroller, laptop and FEZ spider. See IMG.jpg.

Can i use a power supply with more mA or should i purchase a powered hub?