As the topic states, my A-Star 32u4 was able to be programmed through the Arduino IDE when I first purchased. Since then I have programmed in Atmel Studio with an ICE programmer, but now I can no longer program in Arduino IDE since the port is missing. As the port is missing, I cannot reset the chip in any way as I cannot connect to any bootloaders. How can I get it so that my chip works in Arduino again?
The Arduino IDE has an option to burn the bootloader to the microcontroller using a programmer (under the “Tools” menu in the IDE). Be sure to select your programmer (also in the “Tools” menu) before doing that.
Alternatively, you can burn the HEX file (with the appropriate fuse settings) to the microcontroller using Atmel Studio. You can find the HEX file of our modified version of the Arduino Caterina bootloader in our A-Star repository on GitHub (the file is /bootloaders/caterina/Caterina-A-Star.hex). If you modified the fuse settings, you might need to change those back to their factory values, which you can find in the A-Star’s boards.txt.
Burning the HEX from Atmel appears to allow Arduino connection now, however the COM port that is detected by my Arduino (10 in this case) is not found and it uploads my sketches to COM12 (which there is nothing attached to). The sketch still runs on the A-Star fine, however I cannot get an Serial connection from the board since Arduino uploaded to COM12. I am curious though how programming through Atmel affects the ability for the board to be seen as a COM port by a computer. Is there a specific configuration in the HEX file that defines the COM port?
Please note that the COM port of the A-Star 32U4 bootloader is usually different from the COM port of the sketch because the A-Star’s bootloader has a different USB product ID. If you watch the Device Manager closely while the upload is happening, you can probably see the A-Star’s bootloader appear on COM12 temporarily.
I am not sure what kind of serial connection trouble you are having. It is unclear if you are trying to use the Arduino IDE’s serial monitor or some other serial program, and I am not sure what port you have selected, what error message you are getting, or why you think your problems are related to COM12. After you upload a sketch successfully, I recommend looking in the Device Manager to see what COM port the sketch has been assigned to, and then make sure that is the port you are trying to connect to in your serial software. If you continue to have trouble using serial, please send screenshots so we can see the COM ports listed in your Device Manager, the port you have selected in your serial software, and any relevant error messages you are getting.
To answer your question, the sketch loaded onto an A-Star can contain a USB serial number. Two sketches with different USB serial numbers will be seen as different devices by Windows, so they would be assigned to different COM ports. The USB serial number is part of the USB specification, and usually it is a unique string of characters that identifies a particular device. The Arduino environment uses the USB serial number a little bit differently; the Arduino USB serial numbers aren’t actually unique, and different versions of the Arduino software can produce different serial numbers.
The sketch embedded in our Caterina-A-Star.hex file was made by an older version of the Arduino IDE and has a different USB serial number than sketches generated by modern versions. Therefore, when you load that HEX file onto your board, the COM port of the sketch will probably change from what you are used to, because Windows sees that sketch as a new device. Then when you program the board from your Arduino IDE using the bootloader, the COM port of the sketch will probably change back. Whenever the COM port changes, you need to remember to check your Device Manager and select the appropriate COM port in the “Port” menu of the Arduino IDE.
Device manager reads the A-Star as COM10, however both Terra Term and Arduino serial do not read anything from that port. I assume what you described about differing serial numbers per IDE is likely the cause of the issue, as it still successfully uploads the sketch. Thanks for the information!
Since your A-Star is recognized by the computer and you are able to open its virtual serial port, it seems like it is mostly working. There might be a problem in your code that prevents it from sending any data to the USB virtual serial port. I recommend simplifying your code to the simplest thing that should work but does not. If that does not result in you finding the problem and you want help troubleshooting, please post all the relevant details about your code and how you tested it, including:
- The version number of your Arduino IDE.
- The entire code.
- A screenshot of the Device Manager so we can see what COM ports are available.
- The name of the COM port you connected to in your serial terminal.
- The details of how you tested your code and how it behaved.
I have since resolved the issue by moving to a new computer that I have not connected the A-Star to, which assigns and recognizes the new COM port correctly.