Go Down

Topic: Problem programming Arduino Micro (Read 856 times) previous topic - next topic

Oct 14, 2013, 08:31 pm Last Edit: Oct 14, 2013, 10:33 pm by Nick Gammon Reason: 1
I am having this same type of problem. I have several different SparkFun Pro Micro boards. I was developing a OneWire design on one board over several days and it was working find. Then I tried to download the same code onto another board which is part of my final design. The ports might appear for a short time, but then would disappear. I can't even go back to my original board. I have tried a few more and they do the same thing.

They might say that they are installing the software, get done and then will indicate that the device in unplugged. Sometimes it will even show that the COMM Port exists, but will disappear when I try to upload my code.

With some board the port seems to show up in the Device Manager and doesn't disappear, but  I still can't complete the whole process of uploading the code without getting an error. It looks like everything is going fine, the COM Port disappears shortly while it is re-booting the board, but it doesn't finish the process without an error.

One of the boards had not even been removed from the anti-static packing material, but it still would not work.

I am using Windows 7, but I have also tried installing everything on a Windows XP and Windows 8 machines. It might look like it is going to work, only for me to find that I come back later or the next day and it will not work at all.

I am at my wits end.

I should also mention that I have tried different cables. Re-installed my software, uninstalled unused drivers, everything I can think of, but to no avail.

UPDATE:
1. I just received some brand new boards. I cut open the package enough so that I could connect the board without removing it from the anti-static bag, connected the USB cable, observed the port appeared in Device Manager (COM13), Opened Arduino, It took two attempts, but it appeared to succeed, it said that the uploading was finished. But now when I unplug the USB cable and plug it back in the COM port doesn't appear at all. No indications of loading drivers or anything. The red LED on the Pro Mico turns on, but nothing happens in Device Manager to indicate that I have even plugged in a device.

2. I tried another USB port connection in my Hub, nothing.
3. Third USB port connection on my USB hub and now it is loading some drivers--Two unknown devices and one USB IO Board (all waiting for a driver)--Finally we end up with COM15. I try to upload the code. Uploading...3-4 minutes...5 minutes - give up. Reload Arduino - complains that COM15 already in use. I need to reboot my computer. I will report back.
4. Plugged into computer directly - nothing.
5. Used a different USB Hub (the one I had been using last week successfully) - It sees a USB IO Board, but when it has finished loading the driver it says, RED X Device Unplugged

Nick Gammon

This isn't the same problem, so I split the thread.

The other problem was someone with a Uno who damaged it with LEDs not protected by resistors.

You have a Micro (ATmega32u4 chip) which you are having trouble programming.

Quote

Sometimes it will even show that the COMM Port exists, but will disappear when I try to upload my code.


This is fairly normal for these boards, if you have a sketch that does not open a serial port. The ATmega32u4 starts emulating a mouse or something, and the serial port disappears.

To upload you need to hold down Reset, compile the sketch, and then when it starts to upload release Reset.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

There is no reset button on a Sparkfun Pro Micro. Are you saying that unless I have it built into a system that has a reset button I can't program the device?

It has been common for us to program this board in the past without any problem. Why is it having a problem now?

The heading on this topic shouldn't be "Problem with One-Wire interface" since that part is working just fine. This is ONLY a Windows driver issue.

The original thread posted that their board WAS NOT damaged and that we do indeed have the same problem.

This morning I was able to try to hook up my Arduino to a laptop running Ubuntu 12.04 and I was able to upload and run sketches as normal. Afterwards I re-connected the Arduino board to my original PC where the problems started, and everything is working fine again...I guess the board isn't damaged after all....lucky me smiley As a bonus, now I know not to connect LED's directly to my board as well.

However, I still have no explanation as to how this problem occurred nor how it resolved itself. Since I can rule out damage to the device itself and also taking into account what cachemagic said, I'm starting to think that it has something to do with the driver and Windows systems.

Could this be possible? Any other theories? Personally I'd like to know what to do if this happens again.

Nick Gammon

He has a Uno, you have a Micro. That is enough difference to warrant two threads.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon


It has been common for us to program this board in the past without any problem. Why is it having a problem now?


OK, you uploaded some code, now you can't reprogram the board. Please post this code.

How to use this forum
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

I appreciate your help. I should have posted to this forum sooner.

This isn't a matter of code that doesn't work, it is a matter of uploading and communication that doesn't work. I have several different projects of code. It doesn't matter what project I am working with. I can't get a stable COM port so that I can upload and test my code. Actually the code I am trying to upload now has already been tested and it works fine, but I can't upload it.

I am building a reset button that I can add. Hopefully your suggestion will at least get me to the point that I can get back to programming.

Nick Gammon

Once again, if programmed in a certain way, the Micro will not give a stable comm port. The bootloader will open one, and then a couple of seconds later the main sketch will run, and close it.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

I think I figured out part of the problem.

When you plug the Pro Micro board into the USB, Windows sees the VID and PID and goes searching for a driver. But the SparkFun Pro Micro board resets itself out of the bootloader in the meantime and has a different VID and PID or at last a different PID when Windows gets done searching for a driver. Since it doesn't see the same PID, it assumes that the device was removed and so it indicates "Device unplugged".

I am not sure how I can force it to load the correct driver and overcome this problem.

Which brings up another problem. I have seen where the COMxx changes after it starts to upload the program. Then of course it will not complete the upload because now it would need to be talking to a different port. Am I correct that this problem was because the Pro Micro board didn't wait long enough (it is set for one second after reset) for the uploading to start? It used to be 8 seconds, but the latest versions they changed it to one second.

A solution to this problem might be to force both COMxx ports for the Pro Micro to be the same port. I did try that, but maybe I was still having other problems.


Code: [Select]
Once again, if programmed in a certain way,
the Micro will not give a stable comm port. The bootloader will open one,
and then a couple of seconds later the main sketch will run, and close it.


But I thought that Arduino would reset the processor (by setting the COM port to 1200 baud and then closing it) and that would then reset the processor to the bootloader. If the upload process doesn't start within 1 second, THEN it will go to the program reset and execute the users code that has been programmed.

So doesn't Arduino have total control over this type of a problem?

Nick Gammon

Yes, once the code starts uploading it should not change the COM port, but perhaps the upload started a moment too late.  I  personally find it fiddly to upload to the Micro/Leonardo because of this.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

I had the wrong directory in
C:\Users\russella\Documents\Arduino\hardware
It had a directory named: ProMicro
In there the "boards.txt" file had: "Pro Micro 16MHz/5V"

I replaced that with the directory named: SF32u4_boards-master
In there the "boards.txt" file had: "Pro Micro 5V/16MHz"


Go Up