Hello
I am using LPC1768 for one of the project and i need to detect if the USB device is plugged in. How is it possible that i detect something like a pen drive being inserted.
I will be using the controller to interact to the PC as well as with a pendrive and i dont intend to use OTG. I need to have a option which will be able to detect the connection type.
Regards Prakash
In a) Direct connection method, you can't switch device/host role by plug in to the connector. The current role (host/device) is detected by a switch attached to a sliding door in front of the USB receptacles. When the door switch detects role change, firmware disable current role, and it calls stack initialization for each role, host or device. In addition, before the host initialization, the firmware enables D+/D- pull-downs. Also, device initialization is preceded by disabling D+/D- pull-downs.
For a) Direct connection method, a sliding door is necessary so that users don't plug in to both receptacles at a time.
Anyway, try host and device separately, first.
Tsuneo
On the host circuit of above post, Is the D+/D- pull-down resistors (R8/R9) on the first figure are switched by NPN transistors, as you show in the second figure?
On the device circuit, Replace NPN transistor (Q1) for the D+ pull-up with PNP. On the NPN emitter-follower circuit, V<sub>CE</sub> doesn't saturate, less than V<sub>BE</sub>. You may take this circuit from some KEIL board, but it is wrong one.
Hello Tsuneo
Is the D+/D- pull-down resistors (R8/R9) on the first figure are switched by NPN transistors, as you show in the second figure?
I am switching ON these two NPN transistors and trying to communicate with the pen drive.
It can be seen that Q1 that is being used is already a PNP configuration.
As you rightly suggested, I have tested the HOST and the device code saparatly and everything seems to work fine.
It would be very helpful if you can post the relevent changes. probably a circuit would be very helpful.
-Prakash
>> On the device circuit, >> Replace NPN transistor (Q1) for the D+ pull-up with PNP.
> It can be seen that Q1 that is being used is already a PNP configuration.
Aha surely, It's PNP. But the emitter and the collector are swapped on the schematic.
>Aha surely, It's PNP. >But the emitter and the collector are swapped on the schematic.
The schematic I have send of USB device is working fine.
I don't know why it works. It shouldn't. Maybe, the pins on your footprint of the layout is swapped?
Compare your schematic with Olimex's www.olimex.com/.../LPC-1766STK-SCH.pdf
T3 (just near USB_DEVICE label) on Olimex's corresponds to your Q1.