5 years, 6 months ago.

How is USBSerial implemented for LPC13U35?

I am looking for high level information about the implementation of USBSerial for NXP LPC11U35 (already have it's hello world working on my board).

1. Which of these options (or a fourth one) is used: A. Using LPC11U35 hardware USB and calling USB functions from the bootloader's ROM. B. Using LPC11U35 hardware USB (not calling functions from the bootloader's ROM). C. Bit banging in software.

2. What resources (timers, etc) I should avoid using while using USBSerial (in case it already use them).

Thanks for your help.

1 Answer

5 years, 6 months ago.

1. Option B, it uses the peripheral, just not the ROM code. (Tbh bitbanging isn't really possible, yeah I know there are implementations which do it, but afaik they work on in slowest mode and they don't care that much about breaking half the rules regarding USB).

2. The USB peripheral ;). Everything else should be fine. I don't think it uses the mbed timer/ticker classes, but they do use one of the two 32-bit timers.

Here is the source code of the mbed library for LPC11u35 (Well most of it): https://developer.mbed.org/users/mbed_official/code/mbed-src/file/5c73c3744533/targets/hal/TARGET_NXP/TARGET_LPC11UXX. The USBDevice one is simply in the USBDevice library. The timer uses LPC_CT32B1, the other three timers are used by PWM as needed: As long as you don't use a PWM output that is connected to that timer it won't use that timer.

Accepted Answer

Thanks Erik, this is very useful. An arm/mbed newbie here, trying to find his way. Let me see if I got it correct, USBSerial, USBCdc and USBDevice are all vendor and family independent and they sit on top of this vendor dependent file http://developer.mbed.org/users/mbed_official/code/USBDevice/file/3b1c43ac045c/USBDevice/USBHAL_LPC11U.cpp , is it right? Also is it safe to assume that USBHAL is available for all mbed boards with USB or is it available for only some of the vendors or families?

posted by Zapta Z. 03 Feb 2015

Correct, there is also this file: http://developer.mbed.org/users/mbed_official/code/USBDevice/file/3b1c43ac045c/USBDevice/USBEndpoints_LPC11U.h, but it just has some defines. All other code is device independent.

You can see in the other files which targets are supported. In principle afaik (no guarantees) all NXP boards and all Freescale boards with USB are supported. STM wise it is more limitted, the F401 and F411 iirc are, but I don't know about the others.

posted by Erik - 03 Feb 2015