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

USB hid examples don't work on LPC2387

Hello.

I have a SK-MLPC2387 board with LPC2387 processor and here some problem with it. I downloaded Keil HidUsb examples for LPC2378 and loaded it (hex file) in LPC2387 using latest version of FlashMagic utility (ISP). The loading was sucessfully finished and veryfied, then I disconnected board. When I connected the board again (after ~ 20 sec), operation system (Win 7) didn't find new device looks like USB cable was disconnected. The power LED is on, and I don't know where source of problem..

  • > operation system (Win 7) didn't find new device looks like USB cable was disconnected.

    As you are working on a different board from the original which the example firmware is made for, compare schematics of these boards.

    starterkit.ru SK_MLPC2368
    starterkit.ru/.../SK_MLPC2368.pdf

    KEIL MCB2300
    http://www.keil.com/mcb2300/mcb2300-schematics.pdf

    Crystal - 12MHz on both boards - fine

    D+ pull-up - controlled through P2.9 on both board - fine
    But
    - SK_MLPC2368 -- NPN transistor (BC817-40)
    - MCB2300 -- PNP transistor (PMBTA92)

    Required P2.9 polarity is reversed.
    That is, D+ pull-up is [b]disabled[/b] by the KEIL firmware - This fact matches to your above finding.

    Replace it to a PNP transistor, make R2 as a pull-up - recommended

    OR

    Modify the source code

    usbhw.c

    void USB_Init (void) { ... ... /* The SoftConnect pin for LPC2300 on USB_U1 doesn't work for now, make it GPIO and make it low to turn off pull-up on D+. Once it's fixed, make #if 1 and set it as SoftConn Pin. */
    //#if 1 /* MCB2300 V4.0 */
    #if 0 /* MCB2300 V4.0 */ PINSEL4 &= ~0x000C0000; /* P2.9 USB1 SoftConnect */ PINSEL4 |= 0x00040000; /* PINSEl4 18.19 */
    #else /* MCB2300 V3.0 */ PINSEL4 &= ~0x000C0000; FIO2DIR |= (1 << 9); FIO2CLR = (1 << 9);
    #endif ... ...

    void USB_Connect (BOOL con) {
    // WrCmdDat(CMD_SET_DEV_STAT, DAT_WR_BYTE(con ? DEV_CON : 0)); if ( con ) FIO2SET = (1 << 9); else FIO2CLR = (1 << 9);
    }

    Tsuneo

  • Aha, forget to format the code

    usbhw.c

    void USB_Init (void) {
       ...
       ...
      /* The SoftConnect pin for LPC2300 on USB_U1 doesn't work for now,
         make it GPIO and make it low to turn off pull-up on D+.
             Once it's fixed, make #if 1 and set it as SoftConn Pin. */
    //#if 1                                     /* MCB2300 V4.0                 */
    #if 0                                     /* MCB2300 V4.0                 */
      PINSEL4 &= ~0x000C0000;                 /* P2.9 USB1 SoftConnect        */
      PINSEL4 |=  0x00040000;                 /* PINSEl4 18.19                */
    #else                                     /* MCB2300 V3.0                 */
      PINSEL4 &= ~0x000C0000;
      FIO2DIR |= (1 << 9);
      FIO2CLR  = (1 << 9);
    #endif
       ...
       ...
    
    
    void USB_Connect (BOOL con) {
    //  WrCmdDat(CMD_SET_DEV_STAT, DAT_WR_BYTE(con ? DEV_CON : 0));
      if ( con )
         FIO2SET  = (1 << 9);
      else
         FIO2CLR  = (1 << 9);
    }
    

    Tsuneo

  • Thank you very much, now it is working. =)