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
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?
hi Tsuneo, In schematic Vusb0epe is connected to USB0EPEN pin of TM4c1237h controller. Vusb0epe = USB0EPEN (pin of controller)
I am facing another problem also,as In my project i am doing spark testing on keyboard . In this after some time in USBHCDEvent() function it shows an USB_DISCONNECT event only. I removed keyboard manually and connected again still it is showning only USB_DISCONNECT event only. Other than USB everything is working fine.
Ah, it’s USBEPEN. I searched USB[b]0[/b]EPEN on the datasheet, but it didn’t hit ;-)
You have another discussion on the TI Tiva forum, e2e.ti.com/.../363285.aspx And you got a right answer on this issue there.
> I am facing another problem also,as In my project i am doing spark testing on keyboard .
Noise caused by the spark should make the USB host module / firmware mad on the chip.
The USB ports should have TVS (ESD) protection chips, like ST USBLC6-2, just after the USB connectors, before the spark would break your Tiva chip down unrecoverablly.
Insert protection chips, and monitor these facts, - The host stack may return transaction error, just when a transaction is going on at the spark. But the next transaction (error retry) passes successfully. - The target keyboard still works properly after the spark, without power-cycling of VBUS.
I believe it should be the purpose of the spark test ;-)
Further discussion should go on OP’s same topic on the TI forum, as this thread goes more and more unrelated to Keil. e2e.ti.com/.../363285.aspx