Keil Logo Arm Logo

Discussion Forum

USB Host (HID-Keyboard) on LPC2362

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Stefan G
Posted
5-Apr-2012 10:38 GMT
Toolset
ARM
New! USB Host (HID-Keyboard) on LPC2362

Hello,
I want to make a USB-Host work on the LPC2362. Therefore, I found Sample Code for the LPC2388(in the MCB2300-folder, refer to http://www.keil.com/support/man/docs/rlarm/rlarm_usb_host_hid_kbd.htm) that provides a Host for a HID (Keyboard). I sligthly adapted it to the LPC2362: Pinsel for USB_D+1, USB_D-1 and USB_OVRCR1. I provided 5V-Power and adapted serial interface configuration. I also let USBPortSel at reset value (to select Port1).
But trying the Project in Hardware does not work. Do you know where I could start debugging? The function usbh_hid_status(0, 0) always returns zero to me.
I hope that Hardware is correct, since it only has 2 wires.
Is there other configuration, that I must adapt? I am not to sure what to do with clock settings, for example.
Thanks for any help!

Sincerly yours, Stefan

Read-Only
Author
Tsuneo Chinzei
Posted
6-Apr-2012 05:21 GMT
Toolset
ARM
New! RE: USB Host (HID-Keyboard) on LPC2362
usbh_ohci_lpc23xx.c

#define USBH_OHCI_PORTS             0x00000002   // <-- 0x00000001 // port 1

Tsuneo

Read-Only
Author
Stefan G
Posted
7-Apr-2012 05:24 GMT
Toolset
ARM
New! RE: USB Host (HID-Keyboard) on LPC2362

I didn't change this define. I will try when I have acces to the board again. Thanks a lot!!

Read-Only
Author
Stefan G
Posted
16-Apr-2012 10:02 GMT
Toolset
ARM
New! RE: USB Host (HID-Keyboard) on LPC2362

Hi!
I tried this change on my hardware, but I couldn't get the USB-Host work on the LPC2362.
When I use the function usb_hid_get_last_error(0,0), I see that the error is "ERROR_USBH_HID".
Do you know whether there are other adaptions for the LPC2362, or whether there is some USB-Host example directly for this µC?
Do I need to adapt the "Start address of memory used by OHCI"? I do not know its significance. I am still learning about the host...
Thanks in advance!
Regards,
Stefan

Read-Only
Author
Stefan G
Posted
20-Apr-2012 15:30 GMT
Toolset
ARM
New! RE: USB Host (HID-Keyboard) on LPC2362

Hi again,
I resolved the issue now. Here's the summary:

Adaptation of USB-Host-Sample-Code for LPC2388 (USB-Host Keyboard) to LPC2362. You must only adapt the file usbh_ohci_lpc23xx.c:
in the configuration Wizard, change to Port1
Adapt PINSEL to your needs (see below).
in usb_ohci_hw_init(Bool on), instead of writing USBPortSel &= ~0x01; write instead USBPortSel |= ~0x03; (this one was cryptical to me, so I didn't do it correctly in the beginning)

Hope this can help someone.
Stefan

****************
Pinsel for USB-Host on LPC2362:

PINSEL1 &= ~((3 << 26));
PINSEL1 |= ((1 << 26)); /* P0.29 - USB_D+1 */
PINSEL1 &= ~((3 << 28));
PINSEL1 |= ((1 << 28)); /* P0.30 - USB_D-1 */

PINSEL3 &= ~((3 << 22));
PINSEL3 |= ((2 << 22)); /* P1.27 - ~USB_nOVRCR1 */

PINSEL3 &= ~(3 << 12);
PINSEL3 |= (2 << 12); /* P1.22 - USB_PWRD1 */

/*optional outputs also configured*/
PINSEL3 &= ~(3 << 4);
PINSEL3 |= (1 << 4); /* P1.18 - USB-UP-LED1 */
PINSEL3 &= ~(3 << 6);
PINSEL3 |= (2 << 6); /* P1.19 - USB-nPPWR1 */

Read-Only
Author
Carolina Ruiz
Posted
19-Jul-2012 18:22 GMT
Toolset
ARM
New! RE: USB Host (HID-Keyboard) on LPC2362

Hello Stefan,

Thank you very much for the valuable information. I wish I had found it earlier.
Are those all the modifications that you made? because I did exactly what you said and for some reason it is not working.

In the usbh_ohci_lpc23xx.c file I made the following mods.:
1. #define USBH_OHCI_PORTS 0x00000001
2. Added the same PINSELs that you have
3. Changed the USBPortSel to USBPortSel |= ~0x03;(I thought you only had to do it for the LPC2378 according to the User's Manual)

Am I missing something?

Carolina

Read-Only
Author
Tsuneo Chinzei
Posted
20-Jul-2012 03:31 GMT
Toolset
ARM
New! RE: USB Host (HID-Keyboard) on LPC2362

> USBPortSel |= ~0x03;

It is,
USBPortSel |= 0x03; // PORT_FUNC = 11b

As of PORT_FUNC bits of USBPortSel (identical to OTGStCtrl), refer to
"Table 336. Port function truth table" of the User manual.
http://www.nxp.com/documents/user_manual/UM10211.pdf

Tsuneo

Read-Only
Author
Carolina Ruiz
Posted
29-Aug-2012 14:21 GMT
Toolset
ARM
New! RE: USB Host (HID-Keyboard) on LPC2362

Tsuneo,

Thank you for your reply.
For some reason my application is still not working.
The LM3526-L IC (overcurrent monitor)Pin-1 when I start the application is LOW which is okay so that the USB in powered, but as soon as I connect the USB device (keyboard) goes HIGH and stays HIGH.

I am using the Keil USB library and unfortunately I do not have a way to monitor the state of those pins.

Please let me know if you have any ideas.

Thanks again,

Carolina

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.