USB Device all programs hang.

04 Dec 2017

I'm trying to work up a program to use a USB HID device. I'm using the latest mbed official USBDevice library. Platform is LPC1768 with a mbed application board. Both switches on the application board are flipped to USB Host. LPC1768 is using the latest firmware (141212).

I've got a simple program:

#include "mbed.h"
#include "C12832.h"
#include "USBHID.h"

USBHID hid;
HID_REPORT recv;

C12832 lcd(p5, p7, p6, p8, p11);

int main(void)
{
    int j=0;
    lcd.cls();
    lcd.locate(0,3);
    lcd.printf("mbed application board!");

    while (1) {

        lcd.locate(0,15);
        lcd.printf("Counting : %d",j);
        printf("Counting : %d\r\n",j);
        j++;

        wait(1);
    }
}

As written above it hangs, nothing prints on the LCD or via the console. If I comment out the USBHID and HID_REPORT lines then it runs fine, counts up as expected.

Program compiles fine, no errors/warnings/etc. Hangs if keyboard is plugged in or not. I had the same results when I used USBKeyboard.h too. Keyboard I'm testing with is an old basic dell keyboard.

I really don't think I'm doing anything wrong here. The program is super simple. I've wasted way too much time trying different libraries so I'm reaching out to see if anyone out there has any experience with this.

Thanks!