5. The A-Star 328PB Serial Bootloader

The A-Star 328PB comes with a TTL serial bootloader that you can use to upload programs to the board, as described in Section 4.3. This section documents some technical details of the bootloader for advanced users who want to better understand how it works, and it describes how to check if the bootloader is present and how to reload the bootloader if it has been overwritten by ISP programming.

The A-Star 328PB Bootloader is based on the Optiboot bootloader, which is the bootloader used on the Arduino Uno and several other ATmega328 boards. The bootloader is open source and its source code is available on GitHub. The bootloader occupies the upper 512 bytes of the ATmega328PB’s program memory, leaving 31.5 KB for the user program. The bootloader always runs first immediately after the AVR is reset.

The A-Star 328PB Bootloader behaves differently from the Optiboot bootloader on official Arduino boards in a few ways:

  • It reports the correct signature (device ID) for the ATmega328PB.
  • It enables the internal pull-up resistor on RX (digital pin 0, or PD0) to prevent the pin from floating. (Otherwise, noise on RX could appear to be serial data and keep the microcontroller in bootloader mode.)
  • On the 3.3 V, 8 MHz version, the bootloader uses a serial baud rate of 57600 bps, as the ATmega328PB’s USART cannot accurately use a 115200 bps baud rate when running at 8 MHz. (The other versions all use the typical 115200 bps baud rate.)

Brown-out detection

The A-Star 328PB has brown-out detection enabled. The brown-out threshold is 4.3 V on the 5 V versions and 2.7 V on the 3.3 V versions, and if the voltage on VCC goes below this then the AVR will reset.

Checking if the bootloader is present

The bootloader allows programs to be uploaded to the A* through its 6-pin TTL serial programming header. However, when you program the board using the 2×3 ISP header, the bootloader is typically erased.

To verify whether the bootloader is on the microcontroller, reset the A-Star (e.g. by pressing the reset button) and look for three quick flashes of the yellow LED performed by the bootloader, followed by a second of inactivity with the LED off. If you do not see these flashes, the bootloader might have been erased or there might be a problem with your power supply. (Note that if you have a custom program loaded on A-Star that blinks the LED in a similar pattern, it might be hard to tell it apart from the bootloader.)

Burning the bootloader

Follow the instructions below if you want to load the bootloader back onto the board using an ISP programmer such as the Pololu USB AVR Programmer v2.1.

  1. First, follow the instructions in Section 4.3 up to the point where you would press “Upload” to upload a sketch.
  2. Open the Tools > Programmer menu in the Arduino IDE and select the appropriate entry for your programmer. If you are using the Pololu USB AVR Programmer v2.1 to burn the bootloader, the correct entry is “Atmel STK500 development board”.
  3. Open the Tools > Port menu in the Arduino IDE, and change the port to be your programmer’s programming port. This will typically be a different port than the one you would use for uploading sketches via the serial bootloader. If you are using the Pololu USB AVR Programmer v2 to burn the bootloader, the correct port name is the one identified as “Programming port” in the programmer’s configuration software.
  4. Make sure you have selected the right board in the Tools > Board menu.
  5. In the Tools menu, select Burn Bootloader. If everything goes correctly, you will see the message “Done burning bootloader.” appear near the bottom of the window.

When you later try to upload programs using the bootloader, don’t forget to select the right port in the Port menu, which will most likely be different than the one you used to burn the bootloader.

If you want to burn the bootloader yourself by directly invoking AVRDUDE, you can get the HEX files for the bootloader in the bootloaders/optiboot folder of the A-Star repository, and you can look in boards.txt in the A-Star repository to find our recommended fuse and lock bit values.

Related Products

A-Star 328PB Micro - 5V, 16MHz
A-Star 328PB Micro - 5V, 20MHz
A-Star 328PB Micro - 3.3V, 8MHz
A-Star 328PB Micro - 3.3V, 12MHz
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Menu
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors