Go Down

Topic: Missing serial port with SparkFun's Arduino Pro Micro and Atmel Studio (Read 2807 times) previous topic - next topic

medieval_bird

Hello all,

Firstly, I'm sorry if I'm posting this in the wrong area of the Forum. I had no trouble using any of the arduinos until now, so I didn't have the need to seek help like this.
I'll get straight to the point then: I'm using an Arduino Pro Micro 3.3V/8MHz from SparkFun for a project. I've installed the drivers and added support for the board on the IDE, and tried uploading a sketch to it and 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 <util/delay.h> functions:

Code: [Select]

#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:
Quote
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).

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 :)

medieval_bird

I've found the solution. Sort of. 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 IDE. At first, I got an error that read:

Quote
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, 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.

Hope this can help someone down the road. Cheers

RichardBronosky


Hope this can help someone down the road. Cheers



medieval_bird, thank you so much for taking the time to post this. I killed an Arduino Pro Micro within 2 minutes by uploading a sketch to it with the Leonardo board selected in the IDE. Doh! I ordered a replacement then used that replacement to recover the original making the change just as you describe. I figured out the wiring, but I would have just given up with that strange error if not for this post.

By the way, for anyone else who finds this post, that wiring for using a SparkFun Pro Micro 3.3V/8MHz as an Arduino ISP to burn a bootloader to another SparkFun Pro Micro 3.3V/8MHz is:
Code: [Select]

10  -> RST
16  -> 16
14  -> 14
15  -> 15
VCC -> VCC
GND -> GND

and don't forget to change the ArduinoISP sketch to:
Code: [Select]

#define RESET     10

xubuli

medieval_bird,

I had exactly the same problem as you described and I still want to use Atmel Studio.


Q1: With the recovered Pro Micro, will the problem of losing serial port comes back if you download code from AtmelStudio once again?

Q2: What's the fix to use Pro Micro under Atmel Studio while keeping that sketch serial port?



Go Up