Hello Everyone,
I have downlaoded sample code of USB HID of LPC2368 and I am using to test it with LPC2387. But code is not working properly.
LED of USB connect is blink while I am attaching USB that means it connects properly But its not able to transfer data. I don't know what is wrong in my code or I am doing something wrong.
Please if anybody had done this before it please suggest me what is wrong.
Thanks in advance.
sample code of USB HID of LPC2368 and I am using to test it with LPC2387.
And it didn't even occur to you to wonder whether these two different controllers might be too different to run the same sample code, unmodified?
I don't know what is wrong in my code or I am doing something wrong.
For starters, it's not your code --- it's NXP's sample code. And you're using it on the wrong hardware.
What is your board, Keil MCB2387 or one from another company?
Fortunately, LPC2387 belongs to the same device family with LPC2368. USB SIE is the same for the USB device, and they are assigned to the same port pins, same PINSELs. The USB examples are expected to run both on KEIL MCB2360 (LPC2368) board and MCB2387 (LPC2387) without any change
If you are running the example on a board other than MCB2387, check these points.
Crystal frequency The example is tuned for the 12MHz crystal on the LPC23xx board To run it on other crystal frequency, touch to PLL / USB clock setting on LPC2300.s
Open LPC2300.s on Keil uVision, and switch to "Configuration Wizard" tab under edit pane. - Clock Setup - PLLCFG - MSEL/NSEL (original: 12/1) - Clock Setup - USBCLKCFG - USBSEL (6)
Tune these parameters, so that they satisfy this calculation. crystal frequency * MSEL / NSEL / USBSEL * 2 = 48 MHz
USB_CONNECT pin (P2.9) The example code expects D+ pull-up resistor is controlled by P2.9 Compare the circuit around P2.9 - D+ with MCB2300 board You'll see this circuit at right bottom on the second page of this schematic PDF.
MCB2300-v47 schematic http://www.keil.com/mcb2300/mcb2300-schematics.pdf
Tsuneo
Hi Tsuneo,
Thanks for the reply. I am using the same frequency 12 Mhz. So I think I don't need to make changes in code..right? Is there any other way to check its faults?
Regards Dhaval
> So I think I don't need to make changes in code..right?
Is it Keil MCB2387 board? If it doesn't, I'm not sure. Post the schematic around USB port.
Thanks for your time and reply. Here I have attached my schematic. You can download my schematic from below link.
www.sendspace.com/.../p9mt84
file name is document2 so you can download it. And in schematic symbol of Q2 is wrong. I have used BC807 pnp transistor only at Q2 and I am using USB A type connector at J5 and connect pen drive for testing. Let me know what is wrong in my schematic.
Hi I forgot to mention something.
I have short that jumper J4 while testing as well as i have remove diode D3 and made it short.. Thanks
> I am using USB A type connector at J5 and connect pen drive for testing.
Huh? The circuit is for USB device, not for host. Also, the HID firmware is.
The J5 connector should be type B (or mini-B/micro-B) And the J5 connector is connected to PC USB port.
With type B connector, the circuit is good for LPC2387 as USB device configuration. > I have downlaoded sample code of USB HID of LPC2368
Do you mean you have downloaded LPC2368_USBHID.ZIP on this Keil "File Download Area" page? http://www.keil.com/download/docs/335.asp
The time stamp of this file (Tuesday, June 19, 2007) suggests it's an old version. You'll find newer one on this folder, after installation of MDK-ARM C:\Keil\ARM\Boards\Keil\MCB2300\USBHID
Thank you so much for fast reply... how silly mistake I have done..But I am new in embedded as well as in ARM.
But anyways thanks for your all helps. I will try the new version of firmware and check it..and I think it should work without any problem as you said and then get back to you.
Thanks a lot..
Hi Tsuneo
I have download latest firmware from C:\Keil\ARM\Boards\Keil\MCB2300\USBHID. But when I tried to connect my board with pc using USB cable(A-type to B-type)it shows an error that driver for this device is not installed. Its documents say that there is no need for any external driver.
Let me know what is wrong I am doing.
Thanks
> it shows an error that driver for this device is not installed.
Sound like D+/D- connection is swapped at the USB connector.
Run USBView while the device is connected to the PC. If you see this symptom on USBView, D+/D- connection is swapped - The device appears as an Unknown Device on the left connection tree pane - VID/PID (idVendor / idProduct) is read out as 0x0000/0x0000 - Device Bus Speed is Low
USBView output when D+/D- connection is swapped - Unknown device Device Descriptor: bcdUSB: 0x0000 bDeviceClass: 0x00 bDeviceSubClass: 0x00 bDeviceProtocol: 0x00 bMaxPacketSize0: 0x00 (0) idVendor: 0x0000 <---------- idProduct: 0x0000 <---------- bcdDevice: 0x0000 iManufacturer: 0x00 iProduct: 0x00 iSerialNumber: 0x00 bNumConfigurations: 0x00 ConnectionStatus: DeviceFailedEnumeration Current Config Value: 0x00 Device Bus Speed: Low <---------- Device Address: 0x00 Open Pipes: 0
USBView on FTDI site www.ftdichip.com/.../usbview.zip
The original USBView is distributed by MS as a part of WDK (Windows Driver Kit) msdn.microsoft.com/.../gg454513
Thanks for the help. Yes the symptom is same as you said in USBview. But I had check connection of D+ and D- and its perfectly connected with microcontroller's pins. I mean D+ is connected with pin29 which is USB D+ bidirectional line and D- is connected with pin30 which is USB D- bidirectional line. So I think it should not create any problems.
Is there any other way? Regards Dhaval
> Yes the symptom is same as you said in USBview.
The point of above diagnosis is "Device Bus Speed is Low" Do you see exactly this evidence? If so, the D+/D- lines are certainly swapped at the USB connector.
I am confused in this matter. I had checked my connections and D+ line of connector is connected to D+ line of microcontroller and same for D- line.
You said that lines are swapped so I have to change that connection and if I do this means I have to connect D+ line of connector to D- line of controller. But I don't understand how it will work if I make this type of reverse connection..
Let me know the logic behind it.
Thanks & Regards Dhaval
I have swapped connection of D+ and D- but still the problem is same.. I don't know what should be the next step. any suggestion?
Thanks Dhaval
1) Is the 1.5k pull-up resistor connects to the D+ pin (P0.29) of the MCU? 2) Does USBView reports "Device Bus Speed is Full"
"Device Bus Speed is Low" suggests that the pull-up resistor connects to D- line of the PC side - wrong connection. Until above 1) 2) are satisfied, try connection combinations :-)