5.2. Getting into bootloader mode
The P-Star comes with a USB bootloader that allows you to load new programs onto the P-Star over USB without using an external programmer. To use the bootloader, you will first need to get the P-Star into bootloader mode.
When the P-Star is in bootloader mode, the yellow LED should be on and the green LED should be blinking. If the P-Star has never been programmed, or if the user application has been erased, then the P-Star will automatically go into bootloader mode when it is powered on. Otherwise, you will have to use one of the procedures below to get it into bootloader mode.
Starting the bootloader with a wire or button
The P-Star will go into bootloader mode if the RB6 line is high immediately after a reset. This will work no matter what type of application is loaded on the P-Star.
For example, if your P-Star is only powered from USB, you could hold a wire between VDD and RB6 while you are plugging the P-Star into USB in order to get it into bootloader mode.
Another option is to connect a bootloader button between VDD and RB6 and a reset button between GND and MCLR as shown in the picture below, and reset the P-Star while you are holding down the bootloader button. The picture below shows one way to hook up those two buttons to a P-Star 25K50 Micro on a breadboard, using our two of our mini pushbutton switches. If you have a P-Star 45K50 Mini, you can do the same thing, except it is probably more convenient to use the reset button on the board instead of connecting an external one.
P-Star 25K50 Micro on a breadboard with a reset button (left) and a bootloader button (on-board).
The bootloader button can be used for other purposes while your application is running. However, be careful to never drive the RB6 line low, or else pressing the button could cause a short circuit.
Starting the bootloader from your application
The bootloader can also be started by the application without requiring a reset. To do this, the application can simply jump to address 4 using the assembly instruction
goto 4. If the application uses USB, it should disable the USB module by clearing USBEN and then wait for at least 100 ms before starting the bootloader in order to give the computer time to detect that the application has disconnected.
For convenience, we recommend that any P-Star applications with a USB interface implement a USB command for starting the bootloader. This would allow you to get into bootloader mode, upload the new firmware, and run it, entirely using USB and not needing any physical interaction with the board. For example, an application with a USB virtual COM port could listen for a special baud rate to be set by the computer.