http://stuge.se/lpc-p1343_buttons.tar.bz2

This is a small code example for the NXP LPC1342 and LPC1343 family of ARM
Cortex-M3 microcontrollers with built-in USB peripheral, specifically for
the Olimex LPC-P1343 development board:

http://olimex.com/dev/lpc-p1343.html

The code builds upon the reference code made available by NXP and later
ported to gcc by 32bitmicro.com.

The code in firmware/Common/ should be very close to what NXP have released.


Building the firmware
---
The firmware requires a cross toolchain to build. It is assumed that an
arm-none-eabi toolchain is available in your PATH. You can download one
for Linux or Windows at:

http://www.codesourcery.com/sgpp/lite/arm/portal/release1592

(The Linux Installer seems not to work reliably so I recommend the TAR.)

Unfortunately CodeSourcery do not make a toolchain available for Mac OS X,
but you can download a pre-built toolchain from me:

http://stuge.se/macos-arm-none-eabi.tar.bz2


You will also need to compile and make available in your PATH the utility
lpcrc, which is used to write the correct CRC for the interrupt vectors into
the firmware binary. This CRC is checked by the ARM core before starting the
firmware and if the lpcrc step is skipped the firmware will never run.

Once you have included the toolchain bin/ directory and the lpcrc/ directory
in your PATH, simply cd into the firmware directory and run make, and you
should now have a buttons.bin file which you can write to the LPC1343.


Building the host software
---
The host software uses libusb-1.0 to communicate with the device, and the
Makefile tries to look up the correct compiler and linker flags on your
system using pkgconfig. If you do not have pkgconfig installed you will have
to fix up Makefile manually. Compiler flags should be -I to the libusb-1.0
folder where libusb.h has been installed, and linker flags -L to the folder
where libusb-1.0.so is installed. Also add -lusb-1.0 to the linker flags.

If libusb-1.0 and pkgconfig has been installed in your system, then simply
cd into the libusb_host_software/ directory and run make, and you should get
a buttons program which you can run to read the status of buttons on your
Olimex LPC-P1343 board.


Getting in touch
---
Please feel free to contact me at Peter Stuge <peter@stuge.se> if you have
questions.
