USB Secondary bootloader LPC1768 Cortex-M3 is cool trick one can use to program Microcontroller over USB without a use of any JTAG Programmer/hardware adapter. NXP has provided a USB secondary bootloader as a sample program along with its application note on how to use mass storage device class. We’ll focus on its application. You’ll need Keil µVision4 to compile the code. You can download entire project from here USB Secondary Bootloader LPC1768 Cortex-M3.
What is Bootloader?
A bootloader is an application whose primary purpose is to allow a systems software to be updated without use of any specialized hardware such as a JTAG Programmer. In certain cases, It can also be the earliest point at which the integrity of an embedded system can be checked. The bootloader manages the system images. They can communicate over a variety of protocols such as USART, USB, CAN, SPI, I2C and list goes on for as many protocols that exist. Systems with bootloader have at least two program images coexisting on the same microcontroller. It must include branch code that performs a check to see if an attempt to update software is in progress.
Why would you use USB Bootloader?
Bootloader is not a new idea; in fact bootloading & bootstrapping are very commonly used techniques in embedded systems from 1950’s. As a embedded software developer you’ll often use this technique to update firmware when your device is situated into end product. As JTAG Debugger has been working quite well but it needs a parallel port which most laptops including my own lacks. Also loading code into the LPC1768 ARM Cortex-M3 over serial port is painfully slow process. Instead LPC17xx conveniently support USB device interface which can be used for bootloading.
How do you use USB Secondary Bootloader?
First of all we need to program hex file from USB Secondary Bootloader project. We can do this using either JTAG Programmer or serial port (UART0 ISP Mode). The bootloader code will upon RESET check the status of certain pin and decide whether to enter into bootloader mode or execute the user code. If you have development board then you have to press RESET switch followed by ISP switch (connected to pin P2.10). And you’ll quickly notice that your board will detect as a USB mass storage device. The idea is to capture status of pin P2.10 (not immediately after RESET but after a gap of a second or two). Now just copy your binary image of latest microcontroller firmware(.bin file) onto newly detected drive. Then you only have to press RESET switch and you’re done. You’ll find that your microcontroller execute latest firmware on the device. This is how you can press few buttons and update your firmware or bug fixes in your application/project.
Please watch this video demonstration. We have shown step-by-step, how to update firmware of microcontroller using USB Secondary Bootloader LPC1768 Cortex-M3.
Now you know everything about USB Secondary Bootloader in LPC1768 Cortex-M3 Microcontroller. Feel free to experiment with code and have a fun. I hope you’ll find this post educational and entertaining.[amazon_link asins=’B01K7TAOV8,B01M11YQXS’ template=’ProductCarousel’ store=’wwwbinaryupda-21′ marketplace=’IN’ link_id=’b7dde2f8-2ab1-11e8-9b86-ad4ec36b73ab’]