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 www.keil.com/.../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
I didn't change this define. I will try when I have acces to the board again. Thanks a lot!!
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
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 */
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
> 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. www.nxp.com/.../UM10211.pdf
Tsuneo
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,