This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC1768 and LPC1788 USB Differences

Hi all,

My USB Host Driver working fine with LPC1768 for USB HID Devices.
But I want to use this driver with LPC1788(On Embedded Artist Board) its doesnt work.
LPC1788 works fine with USB Host Lite sample.
And I use this sammple's Hardware init function but my driver didnt work.

I have a Hardware Init block.
It looks like :


#if IC == 1788

#define USBControlReg                           (LPC_USB->Control)
#define USBOTGStatusControlReg                  (LPC_USB->StCtrl)
#define USBInterruptStatusReg                   (LPC_USB->InterruptStatus)
#define USBControlHeadEDReg                     (LPC_USB->ControlHeadED)
#define USBBulkHeadEDReg                        (LPC_USB->BulkHeadED)
#define USBCommandStatusReg                     (LPC_USB->CommandStatus)
#define USBFMIntervalReg                        (LPC_USB->FmInterval)
#define USBPeriodicStartReg                     (LPC_USB->PeriodicStart)
#define USBRhStatusReg                          (LPC_USB->RhStatus)
#define USBHCCAReg                              (LPC_USB->HCCA)
#define USBInterruptEnableReg                   (LPC_USB->InterruptEnable)
#define USBRhPortStatus1Reg                     (LPC_USB->RhPortStatus1)

#elif (IC == 1768)

#define USBControlReg                           (LPC_USB->HcControl)
#define USBOTGStatusControlReg                  (LPC_USB->OTGStCtrl)
#define USBInterruptStatusReg                   (LPC_USB->HcInterruptStatus)
#define USBControlHeadEDReg                     (LPC_USB->HcControlHeadED)
#define USBBulkHeadEDReg                        (LPC_USB->HcBulkHeadED)
#define USBCommandStatusReg                     (LPC_USB->HcCommandStatus)
#define USBFMIntervalReg                        (LPC_USB->HcFmInterval)
#define USBPeriodicStartReg                     (LPC_USB->HcPeriodicStart)
#define USBRhStatusReg                          (LPC_USB->HcRhStatus)
#define USBHCCAReg                              (LPC_USB->HcHCCA)
#define USBInterruptEnableReg                   (LPC_USB->HcInterruptEnable)
#define USBRhPortStatus1Reg                     (LPC_USB->HcRhPortStatus1)

#else
#error "Undefined IC"
#endif
PRIVATE void hwInit(HCCA *cca)
{
  NVIC_DisableIRQ(USB_IRQn);

  // turn on power for USB
  CLKPWR_ConfigPPWR(CLKPWR_PCONP_PCUSB, ENABLE);

  // Enable USB host clock, port selection and AHB clock
  USBClockControlReg |= CLOCK_MASK;

  // Wait for clocks to become available
  while ((USBClockStatusReg & CLOCK_MASK) != CLOCK_MASK);

  //  We are a Host
  USBOTGStatusControlReg |= 1;

  configuratePins();

  //  Reset OHCI block
  USBControlReg = 0;
  USBControlHeadEDReg = 0;
  USBBulkHeadEDReg = 0;

  USBCommandStatusReg = HostControllerReset;
  USBFMIntervalReg = DEFAULT_FMINTERVAL;
  USBPeriodicStartReg = FRAMEINTERVAL * 90 / 100;

  USBControlReg = (USBControlReg & (~HostControllerFunctionalState)) | OperationalMask;
  USBRhStatusReg = SetGlobalPower;

  USBHCCAReg = (U32)cca;
  USBInterruptStatusReg |= USBInterruptStatusReg;
  USBInterruptEnableReg = MasterInterruptEnable |
                          WritebackDoneHead     |
                          RootHubStatusChange   |
                          FrameNumberOverflow;

  NVIC_SetPriority(USB_IRQn, 0);
  NVIC_EnableIRQ(USB_IRQn);

  // 10ms delay before diving in
  hostDelayMS(10);
}

There is All hardware dependent code.
But system not work same with LPC1768 and LPC1788.

Is there any difference between LPC1768 and LPC1788 USB unit?

Thanks.

Parents
  • Hi Tsuneo,

    Thanks for your interest.
    There is 100 ms waiting before and after bus reset when device connected.

    Additional since tomorrow I trying to apply NXP's nxpUSBLib.

    www.lpcware.com/.../nxpusblib

    In package there are some examples(HID Host) for LPC1768 and I have tried, its working.
    And I have changed "only" register names for converting 1768 project to LPC1788 project.
    Because they are defined different in lpc17xx.h and lpc177x_8x.h

    Example :

    LPC1768
    ----------------------------
    LPCUSB->HcControl
    LPCUSB->HcInterruptStatus

    LPC1788
    ----------------------
    LPCUSB->Control
    LPCUSB->InterruptStatus

    But result is same. After sending setup token, Writebackdonehead interrupt never occured.

    Is there any "extra" modification between LPC1768 and LPC1788.
    Are you develop any Host HID application on LPC1788 or anyone?

    Thanks.

Reply
  • Hi Tsuneo,

    Thanks for your interest.
    There is 100 ms waiting before and after bus reset when device connected.

    Additional since tomorrow I trying to apply NXP's nxpUSBLib.

    www.lpcware.com/.../nxpusblib

    In package there are some examples(HID Host) for LPC1768 and I have tried, its working.
    And I have changed "only" register names for converting 1768 project to LPC1788 project.
    Because they are defined different in lpc17xx.h and lpc177x_8x.h

    Example :

    LPC1768
    ----------------------------
    LPCUSB->HcControl
    LPCUSB->HcInterruptStatus

    LPC1788
    ----------------------
    LPCUSB->Control
    LPCUSB->InterruptStatus

    But result is same. After sending setup token, Writebackdonehead interrupt never occured.

    Is there any "extra" modification between LPC1768 and LPC1788.
    Are you develop any Host HID application on LPC1788 or anyone?

    Thanks.

Children
  • USB device/host uses dedicated RAM for DMA

    1.2 Features (UM10360-LPC17xx User manual, UM10470-LPC178x/7x User manual)
    Up to two 16 kB SRAM blocks with separate access paths for higher throughput.
    These SRAM blocks may be used for Ethernet, USB, LCD, and DMA memory, as
    well as for general purpose instruction and data storage.

    This peripheral RAM locates,
    LPC1768: 0x2008 0000 - 0x2008 3FFF
    LPC1788: 0x2000 4000 - 0x2000 7FFF

    Then, this macro should be modified for LPC1788

    usbhost_lpc17xx.h
    #define HOST_BASE_ADDR          0x20080000  // <--- 0x20004000
    

    Tsuneo