So, you want to use the USB bootloader function built into the LPC1343? Personally, I think this is one of the coolest built in functions. Why? A lot of chips have serial bootloaders. In fact, all of the NXP LPC series chip have a built in bootloader. Why is the USB bootloader so cool?
Why is the USB bootloader so cool?
Who has a serial port?
Serial bootloaders are great if you don't want to buy an expensive JTAG or programmer. However, they have some shortcomings. First, you need a serial port. In the past 10 years, serial ports have slowly disappeared from computers. Often, you need a USB to Serial converter or level shifter, which defeats the purpose of not having a JTAG or programmer.
Speed is everything
Serial is slow. If you are lucky, you get 115200 baud to work on the LPC bootloader. Usually, I'm stuck at 57600. Regardless, USB is fast. 12Mbit. Programming the device happens in the blink of an eye.
Built in goodies
Guess what? That USB bootloader implements a lot of code. Code that you can use. The LPC1343 bootloader resides in ROM and contains all the code necessary for a USB Mass Storage Device. All you have to do is fill out the necessary USB device info, call an init function, and then a connect function. The ROM saves you around 8K memory space, and a lot of headaches (if you know some stuff about it).
Great! How do I use it?
If you want to implement the USB bootloader functionality into a new design using the LPC1343, you need to know the following.
The USB bootloader code expects a 12Mhz external clock source. Why does this matter? The bootloader must set up the USB PLL in order to generate the 48MHz clock used in USB. The PLL settings are hard coded into the ROM. Any other frequency other than 12MHz will cause the the bootloader to crash and not function.
It took some digging to figure out what 'Soft Connect' does. In short, the Soft Connect feature allows you to control when the host device detects that a new end device becomes available. It does this by connecting a 1.5K pull-up resistor to 3.3V. What does that mean for you? The device now can control when it must respond to host commands, allowing it to execute any initiation code without time constraints. Additionally, you can disconnect and reconnect the device without physically removing the device.
Most reference designs use a PNP BJT. A P-channel FET works just as well, reduces current consumption, and is available in ridiculously tiny packages.
Here is my reference design which is known to work