Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 10 months ago.
Can I run the sample USB Keyboard programs on an LPC2368?
I guess not because I get: "Undefined SymbolUSBHAL::" Can I change libraries or something...?
Regards,
2 Answers
11 years, 10 months ago.
Hi Sam,
Yeahh..... That compiles.
But it won't run?? Dho......
Steps taken so far to isolate problem. However, being a complete newbie to mBed'ing please don't trust my work!
- 1. Import the bog standard "Hello World", compile, download & run. LED's flash as expected.
- 2. Import the USBDevice (15 NOv 2012). When compiling, get "Undefined Symbol.." error messages.
- 3. Edit the USBHAL_LPC17.cpp as recommended.
//#ifdef TARGET_LPC1768 #if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
... It compiles, and runs.
- 4. Back in "Hello World" main.cpp, include USBKeyboard.h
#include "mbed.h" #include "USBKeyboard.h" USBKeyboard keyboard; DigitalOut myled(LED1); int main() { while(1) { myled = 1; wait(0.2); myled = 0; wait(0.2); } }
... it compiles. But when downloaded to the LCP2368, nothing! By which I mean, the led between the mUSB socket and the reset button flickers, but no activity in LED1.
Any advice you can offer would be most welcome.
Regards, Martin PS - Sorry for spraying questions all over your web site, but being a newbie and not seeing them in the lists, assumed that I had posted the questions in the wrong way or the wrong place. Sorry...
Hi, the constructor (USBKeyboard) waits until the USB device is connected. This means that you have to connect a USB cable from the mbed to your computer to check if it works or not: http://mbed.org/handbook/USBDevice.
posted by 02 Jan 201311 years, 10 months ago.
Hi Martin,
I quickly checked the user manual of the lpc2368. The USB device controller should be the same as the lpc1768. Can you try to replace in USBHAL_LPC17.cpp:
#ifdef TARGET_LPC1768
by:
#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
By doing that, the code should compile. If the code does not work, it means that the two USB controllers are not exactly the same and some minor modification have to be done in USBHAL_LPC17.cpp.
Let me know if it works.
Cheers, Sam