Bootloader

Bootloader

Most PIC® series of microcontrollers have the ability to write to their own program memory, without the need of a hardware programmer. A small piece of software (normally called a bootloader or loader) resides on the target microcontroller, which allows user code and EEPROM data to be transmitted over a serial cable and written to the device. The loader application is the software which resides on the computer. Together, these two components enable a user to program, verify and read their program and EEPROM data all in circuit.

The Bootloader Software

Before using a bootloader, you need to ensure that the bootloader firmware has been programmed onto the target microcontroller. This is a one off operation, after which you can start programming your target device over a serial connection.

You need to make sure that the bootloader *.hex file matches the clock speed of your target microcontroller.  If you don't do this, the loader firmware will be unable to communicate with the target microcontroller. You don't have to set the baud rate from the main loader application on the PC, as it will be detected automatically for you.

When power is first applied to the microcontroller (or it is reset), the bootloader first checks to see if the loader application has something for it to do (for example, program your code into the target device). If it does, the bootloader gives control to loader application until it is told to exit. However, if the bootloader does not receive any instructions within the first few hundred milliseconds of starting, the bootloader will exit and the code previously written to the target device will start to execute.

The bootloader software resides in upper program memory, with the rest of the microcontroller code space being available for your program. All EEPROM data memory and microcontroller registers are available for use by your program. Please note that the microcontroller ID location and configuration fuses are not programmed with the loader.  Configuration fuses must therefore be set at the time the bootloader firmware is programmed into the target microcontroller.

Hardware Requirements

The loader communicates with the target microcontroller using its hardware Universal Synchronous Asynchronous Receiver Transmitter (USART).  You will therefore need a development board that supports RS232 serial communication in order to use the loader. There are many boards available which support RS232. If the board has a 9 pin serial connector on it, the chances are it will have a MAX232 or equivalent located on the board. This is ideal for the loader to communicate with the target device using a serial cable connected to your computer.  Alternatively, you can use the circuit shown below and make your own.



The above diagram has an optional software reset circuit. This is really useful when using a bootloader.

Programming Requirements

The bootloader software resides in upper program memory, with the rest of the microcontroller code space being available for your program. Because the loader resides upper program memory, it needs a way to 'jump' to the start of the bootloader code when power is first applied, or when the microcontroller is reset. To do this, it uses the first four program words (called the reset vector) to execute a jump to the bootloader code. When you program the target microcontroller using the loader, program instructions that occupy the first four locations are automatically relocated by the bootloader. If the bootloader did not relocate these instructions, the important 'jump to bootloader' would get overwritten and the bootloader software would not start next time power was applied or the microcontroller was reset.


MicroCode Loader

MicroCode Loader

Most PIC® series of microcontrollers have the ability to write to their own program memory, without ..

£12.00 Ex VAT: £10.00

Showing 1 to 1 of 1 (1 Pages)