1
votes

This is the same question that I've posted on the Arduino Forums, as there could be someone here who could help me :) I'm using an Arduino Pro Micro 3.3V/8MHz from SparkFun for a project. I've installed the drivers, added support for the board on the IDE and tried uploading a sketch to it - it worked okay. I realize that the bootloader shipped with the board emulates a distinct serial port for uploading, as the normal port is COM5 and the upload port is COM6. Though for this project, code optimization is paramount, so I moved on to the Atmel Studio which I had already used successfully with the UNO. I constructed a simple blinky code for the Micro using the registers and functions:

#define ledpin PC6

#include <avr/io.h>
#include <util/delay.h>

int main(void)
{       
    DDRC |= (1 << ledpin);

    while(1)
    {
        PORTC |= (1 << ledpin);
        _delay_ms(1000);
        PORTC &= ~(1 << ledpin);
        _delay_ms(1000);
    }
}

I can upload it okay through Atmel Studio with the following command in avrdude:

C:\Program Files (x86)\Arduino\hardware/tools/avr/bin/avrdude -C"C:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf" -v -v -patmega32u4 -cavr109 -P\\.\COM6 -b57600 -D -Uflash:w:"$(ProjectDir)Debug\$(ItemFileName).hex":i

To be able to do this, I have to press the reset button twice in less than 750 ms, as the hookup guide sugests (https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/troubleshooting-and-faq#ts-reset).

The code works, but now I notice that the normal serial port (COM5) never comes back. What could be the cause? I can still upload new code to the Micro, so the bootloader should be okay right?

Thanks for the help in advance :)

1

1 Answers

1
votes

I have sort of found the solution. As I posted on the Arduino forums:

I was able to revert the pro micro to the state it was delivered to me by SparkFun.

To do that, I used an Arduino Uno as ISP (with the ArduinoISP example) connected to the MISO, MOSI, SCLK and RST pins of the Micro and uploaded the bootloader through the Arduino IDE. At first, I got an error that read:

avrdude: verification error, first mismatch at byte 0x0000 0xfe != 0xce

Then, I went looking into how to set the fuse bits on the Pro Micro when I realized the boards.txt specifies the fuse bits to be used. All I had to do was change the "extended_fuses=0xfe" to "extended_fuses=0xce", restart the IDE and retry the bootloader upload. At last, success! To test it, I wrote a simple UART "Hello world" application in the IDE, which worked flawlessly.

When uploading the bootloader, make sure you have the correct board selected (SparkFun 3.3V/8MHz) and select the COM port of the ISP Arduino.