10.1. Reviving using the Arduino IDE

This section explains three special methods for programming an A-Star (or another of our 32U4 family of boards) using the Arduino IDE in case your usual method of programming is not working.

Reset button

If you have an A-Star 32U4 Micro, you should connect a momentary pushbutton between the GND and RST pins to serve as a reset button. Other boards in our 32U4 family have a reset button you can use. Alternatively, you can use a wire to temporarily connect GND and RST together instead of using a reset button.

Resetting the board twice within 750 ms makes the board go into bootloader mode. The bootloader will exit after 8 seconds and try to run the sketch again if it has not started receiving programming commands. To revive the device, you need to make sure you start sending it programming commands before the 8-second period is over.

In bootloader mode, the yellow LED (the one labeled LED 13) fades in and out. It is useful to look at this LED so you can know what mode the microcontroller is in. Also, we recommend enabling verbose output during upload using the Arduino IDE’s “Preferences” dialog. Looking at the LED and looking at the verbose output during the following procedures will help you understand what is going on.

The substitute port method

This method has been tested on Arduino 1.8.19 and Arduino 2.0.3 but requires extra hardware.

  1. Connect a substitute serial port device to your computer. This should be a device that is recognized by the Arduino IDE as a serial port, but it should not be an A-Star 32U4, Arduino Leonardo, Arduino Micro, or any other device that disappears and reappears as a new device when a piece of software like the Arduino IDE opens the port, sets the baud rate to 1200, and then closes the port. It should also be a device that will not cause any problems if it receives data from the Arduino IDE. Here are some examples of substitute serial port devices:
  2. Connect the 32U4 device to your computer via USB.
  3. In the “Tools” menu, open the “Board” sub-menu and select “Pololu A-Star 32U4”.
  4. In the “Tools” menu, open the “Port” sub-menu and select the substitute serial port.
  5. Click the Upload button. The Arduino IDE will compile your sketch and start uploading it.
  6. As soon as the box near the bottom of the IDE says “Uploading…”, reset the board twice to get into bootloader mode.

If you wait longer than 10 seconds to get the board into bootloader mode in the last step, the Arduino IDE will give up waiting for the bootloader’s serial port and instead attempt to send programming commands to the substitute serial port.

The uploading-before-bootloader method

The goal of the uploading-before-bootloader method is to select a non-existent serial port in the Arduino IDE and then make sure the Arduino IDE enters the uploading phase before the microcontroller goes into bootloader mode. This method has been tested on Arduino 1.8.19. This method does not work on Arduino 2.0.0 or 2.0.3 (and probably does not work on any 2.x versions) because those versions of the IDE give a fatal error message if the selected serial port is not present at the beginning of the uploading phase (“Failed uploading: no upload port provided”).

  1. Connect the 32U4 device to your computer via USB.
  2. In the “Tools” menu, open the “Board” sub-menu and select “Pololu A-Star 32U4”.
  3. In the “Tools” menu, open the “Port” sub-menu and check to see if any ports are selected. If the “Port” menu is grayed out or no ports in it are selected, that is good, and you can skip to step 6.
  4. Reset the board twice to get the board into bootloader mode. While the board is in bootloader mode, quickly select the new serial port that corresponds to the bootloader in the “Port” menu.
  5. After 8 seconds, the bootloader will exit and attempt to run the sketch again. Wait for the bootloader to exit. Verify that either the “Port” menu is grayed out or no ports in it are selected.
  6. Click the Upload button. The Arduino IDE will compile your sketch and start uploading it.
  7. As soon as the box near the bottom of the IDE says “Uploading…”, reset the board twice to get into bootloader mode.

The Arduino IDE will stay in the uploading phase for 10 seconds, waiting for a new serial port to appear. Once the serial port of the bootloader appears, the Arduino IDE will connect to it and send programming commands.

The bootloader-before-uploading method

This method has been tested on Arduino 2.0.3 but the timing requirements of the last step are so tight that the method might be impossible on slower computers.

  1. Connect the 32U4 device to your computer via USB.
  2. In the “Tools” menu, open the “Board” sub-menu and check to see if the “Pololu A-Star 32U4 (bootloader port)” entry is visible. If this entry is visible, you can skip to step 6.
  3. Using a text editor, open the file named boards.txt that provides the “Pololu A-Star” board entries. In Windows, you can typically find this file in %LocalAppData%\Arduino15\packages\pololu-a-star\hardware\avr\. In Linux, you can typically find this file in ~/.arduino15/packages/pololu-a-star/hardware/avr/. On macOS, you can typically find this file in ~/Library/Arduino15/packages/pololu-a-star/hardware/avr/. If you installed the boards manually instead of using the Board Manager, you can find it in [sketchbook location]/hardware/pololu/avr.
  4. In the boards.txt file that you opened, find the lines at the bottom of the file that start with #a-star32U4bp. Uncomment each of those lines by deleting the “#” character, and then save the file.
  5. Close the Arduino IDE and restart it.
  6. In the “Tools” menu, open the “Board” sub-menu and select “Pololu A-Star 32U4 (bootloader port)”. This entry is configured so that the Arduino IDE will send programming commands directly to selected serial port, instead of trying to send a special USB command to the port to get it into bootloader mode and then waiting for the new port to appear. By selecting this entry, the timing of the programming process below becomes easier, especially on Windows.
  7. Prepare the computer to show you a list of its virtual serial ports. If you are using Windows, this means you should open the Device Manager. If you are on Linux or macOS, this means you should open a Terminal and type the command ls /dev/tty* but do not press enter until the board is in bootloader mode in the next step.
  8. Reset the board twice to get the board into bootloader mode. While it is in bootloader mode, quickly look at the list of serial ports provided by your operating system in order to determine what port the bootloader is assigned to.
  9. In the Arduino IDE, click the “Verify” button to compile your sketch. This could make the timing easier during the next step.
  10. Reset the board twice to get the board into bootloader mode again. As soon as the yellow LED starts fading in and out, indicating the board is in bootloader mode, quickly select the serial port of the bootloader in the Arduino IDE (in Tools > Port) and then quickly click the Upload button.

The Arduino IDE will compile your sketch and then upload it to the selected serial port.

If the compilation of the sketch takes longer than 8 seconds, then this procedure will fail because the bootloader will time out and start trying to run the malfunctioning sketch again. If that happens, try the last two steps again using a simpler sketch such as the Blink example that can be found under File > Examples > 01.Basics > Blink. Also, make sure your computer is not too busy performing other tasks in the background, and make sure you performing the last step as fast as you can.

This method can also work in the older Arduino 1.8.19 with some modifications. You should select the correct port in the Port menu prior to the last step (e.g. by temporarily putting the board into bootloader mode and then selecting it). This makes the timing of the last step easier because you can just click the “Upload” button instead of clicking three times to select a port. Also, if the timing of the last step is still too tight, you can actually click Upload before putting the board into bootloader mode, but you need to get the board into bootloader mode while the IDE is still compiling, before the upload phase begins. (Neither of these optimizations are possible on Arduino 2.0.3 because it erases your serial port selection if the port disappears.) However, if you are using Arduino 1.8.19, the uploading-before-bootloader method documented above is probably easier.

After reviving your device, be sure to change the Board setting back to “Pololu A-Star 32U4” and select the right Port.

Related Products

3pi+ 32U4 Control Board
3pi+ 32U4 OLED Robot Kit with 30:1 MP Motors (Standard Edition Kit)
3pi+ 32U4 OLED Robot Kit with 15:1 HPCB Motors (Hyper Edition Kit)
3pi+ 32U4 OLED Robot - Turtle Edition (75:1 LP Motors), Assembled
3pi+ 32U4 OLED Robot - Standard Edition (30:1 MP Motors), Assembled
3pi+ 32U4 OLED Robot - Hyper Edition (15:1 HPCB Motors), Assembled
3pi+ 32U4 OLED Control Board
3pi+ 32U4 Robot Kit with 75:1 LP Motors (Turtle Edition Kit)
3pi+ 32U4 Robot Kit with 30:1 MP Motors (Standard Edition Kit)
3pi+ 32U4 Robot Kit with 15:1 HPCB Motors (Hyper Edition Kit)
3pi+ 32U4 Robot - Turtle Edition (75:1 LP Motors), Assembled
3pi+ 32U4 Robot - Standard Edition (30:1 MP Motors), Assembled
3pi+ 32U4 Robot - Hyper Edition (15:1 HPCB Motors), Assembled
3pi+ 32U4 OLED Robot Kit with 75:1 LP Motors (Turtle Edition Kit)
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