I am using TIVA TM4C1237H controller .I wish to interface Keyboard and Pendrive to it.I am using FSUSB11MTX for multiplexing them.Using a GPIO pin I select the FSUSB11MTX . Now Iam able to interface 2 keyboards and switch between them .But while using pendrive I am able to transfer files as long as there is no device in the other port.As soon as I connect any device in other port the system hangs and shows unknown device for both ports.
I guess there is issue in creating interrupts. Please look into the matter today itself ,as soon as possible.The development process is now interrupted by this minor USB glitch.
Regards, Dhanush Nair
USB devices aren't designed to be muxed in/out like that. There is signalling happening even when you have no data to transfer.
Note that it's possible to have multiple functionality on a single USB interface. On one hand, you could have compound devices that implements multiple functions. On the other hand, a USB hub allows a computer to see multiple different devices connected to the same port.
Hi Westermark,
Thanks for your reaponse. Let mew elaborate to you my situation.
My controller has one USB port.I wish to interface a keyboard and pendrive. Most of the time I am using a keyboard but for dumping some data ,I sometime require a pendrive. On pressing a particular key in the keyboard , the D+ and D- lines of the USB shifts from keyboard to pendrive . After successful data dumping D+ and D- lines shifts back to keyboard.
Till now all seems to work nicely as expected for the first time after power-up.
But when I do data dumping again , the the controller fails to enumerate the pendrive , and data dumping fails and control comes back to keyboard without data dumping.If I restart the system , then again the above scenario.
I dont wish to restart the machine , every time for this.
So - are you able to turn off power to that thumb drive while you have D+/D- disconnected?
Physically removing and connecting the pendrive doesnot solve the issue. I have to power off and power on the machine to make the thumbdrive work again.
But how do you let your host side know that you are going to disconnect your thumb drive?
Does your USB host controller get any information? Does your file system driver get any information?
Dhanush,
As you didn't write the details, I made some assumptions,
a) You are working on TivaWare_C_Series-2.1.0.12573 from TI b) After device switch, your firmware calls USBHCDInit() to initialize the host stack, again
If these assumptions were correct, my suggestion is, - call USBHCDDeviceDisconnected() before USBHCDInit(), to initialize the host client driver at the time.
USBHCDDeviceDisconnected(0,0); USBHCDInit( ... );
As of a), Keil doesn't provide USB stack for TI Tiva-C yet. You should start on TI's stack. You have another post on TI's forum, e2e.ti.com/.../333671.aspx
As of b), Your board mounts Fairchild FSUSB11 for the USB lines switch. This switch doesn't have "open" positiion, in which host D+/D- lines are open. It means, the host on TM4C1237H can't detect device disconnection / re-connection (**1) In this reason, I suppose you are forcing the host stack reset after switch.
(**1) Host detects voltage change on D+/D- lines as connection / disconnection. Both of D+/D- lines are pulled down by the on-chip resistors of TM4C1237H host.
When a full-speed device plugs in to the host, the device pulls up the D+ line. - the host detects device connection. When the device plugs off, the D+ lines goes to low by the host pull-down. - the host detects device disconnection.
For low-speed device, D- works, instead of D+
To detect disconnection event, USB spec defines the time as 2-2.5 us (TDDIS: Section 7.1.7.3), in which both of D+/D- lines are low. However, the FSUSB11 datasheet tells the switch transition takes less than 100ns. www.fairchildsemi.com/.../FSUSB11.pdf
> Per: a USB hub allows a computer to see multiple different devices connected to the same port.
A USB hub should give the better way. Unfortunately, TM4C1237 has a silicon bug, in which USB low-speed device makes trouble over a hub. www.ti.com/.../spmz849c.pdf - USB#01: USB Host Controller may not be Used to Communicate With a Low-Speed Device When Connected Through a hub
And then, this line switch method may be a workaround for USB keyboard - usually, a low-speed device. The drawback of this method is, it requires re-enumeration, when the target device is switched.
Tsuneo
Hi Tsuneo,
Thanks for your feedback.Your suggestion worked fine.I guess that was the issue,Tiva did not understand USB disconnect.
Can you send me your email-id in case I have any other problems in future with USBs. Also suggest me some good documentations for getting more insight with USB.
Regards, Dhanush
I am using code of HOST USBkeyboard from tiva dk-tm4c129x example.My keyboard is working fine when my controller is not busy in doing other things like ADC read,write,uart,lcd,etc.(ADC read write is little time consuming).But when i add my ADC read write code with keyboard code then keyboard becomes very slow. When i press key on keyboard then USB keyboard callback gets called after 1sec and for key release USB keyboard callback also gets called very slowly.
I cross checked this thing thing by removing ADC function and by adding delay() functions ,but i am facing the same problem. why interrupt is coming very slow when controller is doing other things with keyboard routine.
Thread hijack...
hiii Per Westermark,
Why thread hijack ?????????????????????/
hi Tsuneo, I am using TM4c1237h controller, I have interface Keyboard and Pendrive to TIVA.I am using FSUSB11MTX for multiplexing them.Using a GPIO pin .Because of noise the controller of IBM controller gets hang (it is not showing Unknown device, It gets hang in while loop of USBHCDGetDeviceDescriptor() function ), now i want to reset this(IBM keyboard ) controller by disabling Vbus signal.How should i do this? How to remove power on VBus?
I am using tiva's TivaWare_C_Series-2.1.0 library i noticed that in function USBHCDGetDeviceDescriptor() (in USBHCDMain() fun -case USBConnect ) is compaired with 0 for unknown device check. But on error this function is returning 0xffffffff not zero. So unknown device connect this condition will never execute.
Regards, Sagar
> sagar: now i want to reset this(IBM keyboard ) controller by disabling Vbus signal.How should i do this? How to remove power on VBus?
I'm not sure, until you would show the circuit around the VBUS pins on the two USB connectors. Is there any switch chip between these VBUS pins and 5V supply?
hi Tsuneo, I am using TPS 2051 IC for giving VBUS supply as shown in fig. For switching D+ and D- i am using FSUSB11MTX IC.
+5V + VBUS | | | ---------------- | |--|------| IN OUT|----|6 | | | | | | |------| IN OUT|----|7 | | | | | Vusb0epe--EN OUT|----|8 capacitor-( | | | | Usb0flt---OCn | | | | | | Gnd| ---|-GND | -( capacitor | | | | Gnd| |________________| |Gnd
TPS 2051
+5V + VBUS | | | ---------------- | |--|------| IN OUT|----|6 | | | | | | |------| IN OUT|----|7 | | | | | Vusb0epe--EN OUT|----|8 capacitor-( | | | | Usb0flt---OCn | | | | | | Gnd| ---|-GND | -( capacitor | | | | Gnd| |________________| |Gnd TPS 2051
What does Vusb0epe mean on your schematic? Does this signal connect to one of TM4c1237h port pin?