Trouble getting MBED USB APIs to work on NXP LPC54114

26 Apr 2019

Hi,

So far I've successfully run the hello world example that makes the LED blink. I'm trying to run example code for the USB APIs, like what is shown here:

https://os.mbed.com/docs/mbed-os/v5.12/apis/usbkeyboard.html#usbkeyboard-example

It compiles, and appear to load without any errors (no fail.txt). However, when I plug in the target MCU USB port (J5) (not the debug USB port), I never see a device show up. I'm using debian 9 and running lsusb to check for USB connections.

I assume I should see "Hello World" printed into a text window, as if I typed that on the keyboard, but I don't get that either.

Any ideas what I'm doing wrong?

18 Oct 2019

Hi Kevin,

Do your board have built-in USBPhy? You might have to provide a second constructor, which takes a USBPhy as one of its parameters. You can use this to pass an off-chip USBPhy into any of the USB clases. This constructor does not connect or block, so you must do this elsewhere. Something like:

  1. include "usb_phy_api.h"
  1. include "mbed.h"
  2. include "USBKeyboard.h" USBPhy *phy = get_usb_phy(); USBKeyboard key(phy);

int main(void) { Start the USB connect sequence key.connect();

Block until ready key.wait_ready(); while (1) { key.printf("Hello World\r\n"); wait(1); } }

Regards, Pekka

05 Nov 2019

Hi Pekka,

Thanks for your reply. I have not had a chance to try yet, but I think it should work now that the newer OS versions are supported for this board.

I also replied here: https://os.mbed.com/forum/helloworld/topic/35684/

Best, Kevin