LPC1347 USB Library Part 1

In preparation for the new LPC1347 board I have compiled the USB code into a library file that can be included into a project to provide access to printf. The library includes access to the USB CDC, UART and standard IO. The code in the library includes a complete USB stack along with a subset of the standard I/O facilities provided for C programming. The code library is based on the USB ROM code that is included on the LPC1347 processor. The application interface has been made as simple as possible and is described below.

void Comport_Init(char device,int baudrate):

The port parameter can be one of BRIDGE,UART or CDC. The bridged mode connects the UART and CDC together while the other modes direct the character output to the specified I/O port. The baud rate is required when you select the UART otherwise it is optional and is ignored since the CDC sets the baud rate. This must be called prior to any other LPC USB library calls.

void putchar(char data):

Send a single byte of data.

char getchar(void):

Receive a single byte of data. This function is blocking; it will wait forever if no character arrives. Use the rx_ready() function to test if any data is available.

char rx_ready(void):

Non blocking test for receive data. If data is available the function returns true.


Standard formatted print supporting strings, characters and hex. %x, %s, %d, %c

Setup Library

I used the GCC compiler to compile the code and create a library archive. The code design consists of the source code for the USB stack along with a stdio library extracted from Newlib libc. These files can be built from the command line using a makefile or from within the Programmers Notepad project. Currently the makefile only supports the LPC1347 because it uses the ROM drivers that are part of this chip; of course it is also possible to build for other targets like the LPC11Uxx but that would require a lot more work and I don’t need the feature.

The complete library project is provided as a Programmers Notepad project. The library is already compiled so all you need to do is install it in the correct directories. Assuming you have followed my notes on installing GCC and programmers notepad you will have installed the libraries in c:\DNC_LABS


1 comment for “LPC1347 USB Library Part 1

Leave a Reply

Your email address will not be published. Required fields are marked *