How to change sample code from usb1 to usb2

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by mehdi.smh24 on Mon Jan 12 10:02:43 MST 2015

I use LPC1788 and I want to run USB_Host example (IAR Systems\Embedded Workbench 6.4 Evaluation\arm\examples\NXP\LPC17xx\IAR-LPC-1788-SK\USB_Host)
But my board is not a development one and Its USB inteface is connected to usb2 pins but the example is for USB1.
I changed two lines of Host_Init as below:

while ((OTGCLKST & 0x00000001) == 0) {
    OTGSTCTRL = 0x00000003;               //usb port sel , changed from 1 to 3 for usb2                    /**/
    IOCON_P0_31 = 0x1;                    // changed 29(D+1) to 31(D+2)        /* P0[31] = USB_D+2                         */
    IOCON_P1_30 = 0x1A1;                          /* P1[30] = USB_PWRD2                       */
    IOCON_P1_31 = 0x1A1;                          /* P1[31] = USB_OVRCR2                      */
    IOCON_P0_12 = 0x1A1;                          /* P0[12] = USB_PPWR2                       */

but I still have problems in Host_EnumDev :
USB_INT32S  Host_EnumDev (void)
    USB_INT32S  rc;

    PRINT_Log("Connect a Mass Storage device\n\r");
    while (!HOST_RhscIntr);

it stays in while statement
I think USB_IRQHandler doesnt call properly and i need more changes in code because of hardware differnce but i confused ...
please let me know if hardware schematic helps