Register not getting set

I have the sample KEIL USB HID project for the LPC2148 and I have a project I started in which I am going through the KEIL code section by section attempting to thouroughly understand its function and tune the code for my needs.

In the KEIl project it runs this line of code fine, but in mine it freezes:

while((USBDevIntSt & 0x00000100) == 0);

Thanks for any help in advance!
Wesley

Parents
  • In the USBHID of current MDK-ARM (v4.72a), equivalent line appears on USB_ConfigEP() subroutine.

    C:\Keil\ARM\Boards\Keil\MCB2140\USBHID\usbhw.c
    
    /*
     *  Configure USB Endpoint according to Descriptor
     *    Parameters:      pEPD:  Pointer to Endpoint Descriptor
     *    Return Value:    None
     */
    
    void USB_ConfigEP (USB_ENDPOINT_DESCRIPTOR *pEPD) {
      U32 num;
    
      num = EPAdr(pEPD->bEndpointAddress);
      REALIZE_EP |= (1 << num);
      EP_INDEX = num;
      MAXPACKET_SIZE = pEPD->wMaxPacketSize;
      while ((DEV_INT_STAT & EP_RLZED_INT) == 0);    // <----
      DEV_INT_CLR = EP_RLZED_INT;
    }
    

    Above code lines exactly follow the example on the LPC2148 User Manual, chapter 9.7.12
    If the "while" clause wouldn't finish, you should pass bad parameter(s) to the USB registers, just before this line,
    - REALIZE_EP (USBReEp)
    - EP_INDEX (USBEpIn)
    - MAXPACKET_SIZE (USBMaxPSize)

    Tsuneo

Reply
  • In the USBHID of current MDK-ARM (v4.72a), equivalent line appears on USB_ConfigEP() subroutine.

    C:\Keil\ARM\Boards\Keil\MCB2140\USBHID\usbhw.c
    
    /*
     *  Configure USB Endpoint according to Descriptor
     *    Parameters:      pEPD:  Pointer to Endpoint Descriptor
     *    Return Value:    None
     */
    
    void USB_ConfigEP (USB_ENDPOINT_DESCRIPTOR *pEPD) {
      U32 num;
    
      num = EPAdr(pEPD->bEndpointAddress);
      REALIZE_EP |= (1 << num);
      EP_INDEX = num;
      MAXPACKET_SIZE = pEPD->wMaxPacketSize;
      while ((DEV_INT_STAT & EP_RLZED_INT) == 0);    // <----
      DEV_INT_CLR = EP_RLZED_INT;
    }
    

    Above code lines exactly follow the example on the LPC2148 User Manual, chapter 9.7.12
    If the "while" clause wouldn't finish, you should pass bad parameter(s) to the USB registers, just before this line,
    - REALIZE_EP (USBReEp)
    - EP_INDEX (USBEpIn)
    - MAXPACKET_SIZE (USBMaxPSize)

    Tsuneo

Children
More questions in this forum