LPC11U37 very first USB connection by a HW guy

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC11U37 very first USB connection by a HW guy

2,445 Views
jeanvaljean
Contributor II

Ladies and gentlemen,

I'd like to create my very fist USB connection between my Linux laptop and LPC11U37H Xpresso V2 board. My development environment is MCUXpresso 11.2.0

I've read a ton of literature and the result is just confusion. I know, that there's a ROM code for USB communication (CDC class were just good), but I haven't found a simple C code example which explains how to do it, what shall I include i my code and so on.

At the moment, 3 ADC channels are working, I see their results in the MCUXpresso's console,  LEDs are turning On and Off.

I know, I have to enable power to the USB module, I have to set the USB PLL up for 48MHz USB clock, have to configure the D+ and D- pins for USB, and, how towards? (OK, the cable between laptop and J4, it's obvious )

Any kind of help is appreciated.

0 Kudos
Reply
5 Replies

2,425 Views
jeanvaljean
Contributor II

Hallo Sebastian,

 

thank You for Your answer.

I have found the LPCOpen structure. There are also example projects. I tried to open one, but unfortunately it doesn't compile.

I've got the OM13074 board. My own code runs well on this, I can control all the LEDs and ADCs.

When I try the examples, I do it in a new project, in a separate sub-folder.

Here are the error messages:

13:04:41 **** Incremental Build of configuration Debug for project nxp_lpcxpresso_11u37_usbd_rom_cdc ****
make -r -j4 all
Building file: ../example/src/cdc_desc.c
Building file: ../example/src/cdc_main.c
Building file: ../example/src/cdc_vcom.c
Building file: ../example/src/cr_startup_lpc11xx.c
Invoking: MCU C Compiler
Invoking: MCU C Compiler
Invoking: MCU C Compiler
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_LPCOPEN -DCORE_M0 -I"/home/bela/mcuxpresso/Proba10USB/nxp_lpcxpresso_11u37_usbd_rom_cdc/example/inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fmerge-constants -fmacro-prefix-map="../example/src/"=. -mcpu=cortex-m0 -mthumb -D__REDLIB__ -fstack-usage -specs=redlib.specs -MMD -MP -MF"example/src/cdc_desc.d" -MT"example/src/cdc_desc.o" -MT"example/src/cdc_desc.d" -o "example/src/cdc_desc.o" "../example/src/cdc_desc.c"
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_LPCOPEN -DCORE_M0 -I"/home/bela/mcuxpresso/Proba10USB/nxp_lpcxpresso_11u37_usbd_rom_cdc/example/inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fmerge-constants -fmacro-prefix-map="../example/src/"=. -mcpu=cortex-m0 -mthumb -D__REDLIB__ -fstack-usage -specs=redlib.specs -MMD -MP -MF"example/src/cdc_main.d" -MT"example/src/cdc_main.o" -MT"example/src/cdc_main.d" -o "example/src/cdc_main.o" "../example/src/cdc_main.c"
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_LPCOPEN -DCORE_M0 -I"/home/bela/mcuxpresso/Proba10USB/nxp_lpcxpresso_11u37_usbd_rom_cdc/example/inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fmerge-constants -fmacro-prefix-map="../example/src/"=. -mcpu=cortex-m0 -mthumb -D__REDLIB__ -fstack-usage -specs=redlib.specs -MMD -MP -MF"example/src/cdc_vcom.d" -MT"example/src/cdc_vcom.o" -MT"example/src/cdc_vcom.d" -o "example/src/cdc_vcom.o" "../example/src/cdc_vcom.c"
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_LPCOPEN -DCORE_M0 -I"/home/bela/mcuxpresso/Proba10USB/nxp_lpcxpresso_11u37_usbd_rom_cdc/example/inc" -Os -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fmerge-constants -fmacro-prefix-map="../example/src/"=. -mcpu=cortex-m0 -mthumb -D__REDLIB__ -fstack-usage -specs=redlib.specs -MMD -MP -MF"example/src/cr_startup_lpc11xx.d" -MT"example/src/cr_startup_lpc11xx.d" -o "example/src/cr_startup_lpc11xx.o" "../example/src/cr_startup_lpc11xx.c"
In file included from ../example/src/cdc_main.c:32:
/home/bela/mcuxpresso/Proba10USB/nxp_lpcxpresso_11u37_usbd_rom_cdc/example/inc/board.h:35:10: fatal error: chip.h: No such file or directory
35 | #include "chip.h"
| ^~~~~~~~
../example/src/cr_startup_lpc11xx.c:48:10: fatal error: sys_config.h: No such file or directory
48 | #include "sys_config.h"
| ^~~~~~~~~~~~~~
compilation terminated.
compilation terminated.
In file included from ../example/src/cdc_desc.c:32:
/home/bela/mcuxpresso/Proba10USB/nxp_lpcxpresso_11u37_usbd_rom_cdc/example/inc/app_usbd_cfg.h:31:10: fatal error: lpc_types.h: No such file or directory
31 | #include "lpc_types.h"
| ^~~~~~~~~~~~~
compilation terminated.
make: *** [example/src/subdir.mk:30: example/src/cdc_desc.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [example/src/subdir.mk:30: example/src/cdc_main.o] Error 1
In file included from ../example/src/cdc_vcom.c:32:
/home/bela/mcuxpresso/Proba10USB/nxp_lpcxpresso_11u37_usbd_rom_cdc/example/inc/app_usbd_cfg.h:31:10: fatal error: lpc_types.h: No such file or directory
31 | #include "lpc_types.h"
| ^~~~~~~~~~~~~
compilation terminated.
make: *** [example/src/subdir.mk:39: example/src/cr_startup_lpc11xx.o] Error 1
make: *** [example/src/subdir.mk:30: example/src/cdc_vcom.o] Error 1
"make -r -j4 all" terminated with exit code 2. Build might be incomplete.

13:04:42 Build Failed. 9 errors, 0 warnings. (took 837ms)

Since I'm not an experienced SW engineer (HW instead), I can only interpret these some header files are missing.

I couldn't find for example a board.h file for my OM13074 board. What I have found for LPC11U37, it has inside a joystick, some buttons ... they're not present on my board. Of course, it also doesn't compile, when I try to use the board.h I found.

 

What can I do now?

I also started to write my own code to use the USB module on the chip, but it seems to be a larges challange.

Regards:

Jean

ps: just another question. Does it worth the effort with this chip ? NXP doesn't promote the LPC11xx series, are they too old? I've got another board too, OM13098 with LPC54628. What is Your opinion, would it be more efficient to change to this more complex chip? Does this board better examples and better support than the LPC11U37?

0 Kudos
Reply

2,408 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Jean,

 

When importing LPCOpen SDK examples, it's necessary to change some settings, and import the corresponding libraries for your chip, could you please take a look at the following community post for more information?

About the LPC11xx series of MCUs, we currently recommend taking a look at the newer alternatives like the new LPC51xx and LPC55xx series of MCUs. These were recently released, and include support for the latest MCUXpresso SDK and IDE versions.

 

Best regards,

Sebastián

0 Kudos
Reply

2,402 Views
jeanvaljean
Contributor II

Dear Sebastian,

thank You for Your effort. Your advice guided me to here:

https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Creating-and-Linking-to-Library-Projects/m-p/469212

I followed the advices there. I've set many times the path, where the missing library files are.

Since I still couldn't compile the example project, I also copied the missing files to the subdirectory, where they're looked for: ..../Proba10USB/nxp_lpcxpresso_11u37_usbd_rom_libusb/example/inc/

This last action have reduced the error messages from 9 to 3, these new messages are somewhat different, but the project still doesn't compile.

Here are the new messages:

13:56:43 **** Incremental Build of configuration Debug for project nxp_lpcxpresso_11u37_usbd_rom_libusb ****
make -r -j4 all
Building target: nxp_lpcxpresso_11u37_usbd_rom_libusb.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -L/home/bela/mcuxpresso/Proba10USB/nxp_lpcxpresso_11u37h_board_lib/inc -L/home/bela/mcuxpresso/Proba10USB/lpc_chip_11uxx_lib/inc -Xlinker -Map="nxp_lpcxpresso_11u37_usbd_rom_libusb.map" -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "nxp_lpcxpresso_11u37_usbd_rom_libusb_Debug.ld" -o "nxp_lpcxpresso_11u37_usbd_rom_libusb.axf" ./example/src/cr_startup_lpc11xx.o ./example/src/libusbdev.o ./example/src/libusbdev_desc.o ./example/src/libusbdev_main.o ./example/src/sysinit.o -lnxp_lpcxpresso_11u37h_board_lib -llpc_chip_11uxx_lib
/usr/local/mcuxpressoide-11.2.0_4120/ide/plugins/com.nxp.mcuxpresso.tools.linux_11.2.0.202001021529/tools/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: cannot find -lnxp_lpcxpresso_11u37h_board_lib
/usr/local/mcuxpressoide-11.2.0_4120/ide/plugins/com.nxp.mcuxpresso.tools.linux_11.2.0.202001021529/tools/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: cannot find -llpc_chip_11uxx_lib
collect2: error: ld returned 1 exit status
make: *** [makefile:32: nxp_lpcxpresso_11u37_usbd_rom_libusb.axf] Error 1
"make -r -j4 all" terminated with exit code 2. Build might be incomplete.

13:56:44 Build Failed. 3 errors, 0 warnings. (took 540ms)

Also, here are a few screenshots about what I tried.

What am I doing wrong?

Regards: Jean

 
 

 

 

0 Kudos
Reply

2,433 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Jean, I hope you're doing well!

 

For learning USB peripheral and Stack configuration, could you please take a look at the USB examples available in the LPC11U37's LPCOpen package, which can be downloaded from here.

 

Depending on the functionality that you wish to implement, there're examples that show HID, CDC, or composite functionality.

 

Please let me know if you need any more information.

 

Best regards,

Sebastián

0 Kudos
Reply

2,442 Views
jeanvaljean
Contributor II

By the way, this link here:

https://community.nxp.com/t5/LPCware-Archive-Content/USB-with-NXP-Microcontrollers/ta-p/1129055 

it is just full with broken links.

0 Kudos
Reply