Go Down

Topic: Problem while loading an .hex into my Pro Micro (Read 383 times) previous topic - next topic

PlacaFromHell

Hi. I didn't got a satisfactory response in the spanish forum so I came here (I clarify it in case I have spelling mistakes). While Im trying to load an .hex file for a keyboard adapter on a Pro Micro using Arduino Loader, I get this error and I can't find a solution.

pert

Can you upload a sketch to your Pro Micro using the Arduino IDE?

Are you sure your Pro Micro is on COM4?

Please add a link to/from the other thread in the Spanish section so that all the relevant information can easily be found. Use the chain links icon on the toolbar to make the links clickable.

PlacaFromHell

#2
May 17, 2018, 02:09 am Last Edit: May 17, 2018, 02:20 am by PlacaFromHell
Is my first try using Arduino. Is in COM4 and Arduino drivers are instaled. Are you talking about upload a sample program? I can try it if is necessary. There isn't too much information in my original post anyway.

https://forum.arduino.cc/index.php?topic=547484.0

Edited: I tried with my second Arduino and same is happening. Examples works perfect with original Arduino software.

pert

Are you talking about upload a sample program?
I'm talking about trying to upload any program to your Pro Micro using the Arduino IDE, not Arduino Builder. If the upload is successful with the Arduino IDE then you know the problem is related to Arduino Builder. I'm have no experience with Arduino Builder and likely the same will be true for most other people on this forum.

Do this:
  • If you haven't already, download and install the Arduino IDE from http://www.arduino.cc/en/Main/Software.
  • Start the Arduino IDE.
  • File > New
  • Tools > Board > Arduino/Genuino Micro
  • Tools > Port > COM4 (or whatever port your Pro Micro is on)
  • Sketch > Upload

After that, please report your results here.

PlacaFromHell

Yeah, It goes well with "normal" methods, but I can't upload my already compiled .hex with IDE.

pert

Yeah, It goes well with "normal" methods
So you're saying if you follow my instructions in the previous reply the upload is successful?

but I can't upload my already compiled .hex with IDE.
I realize that but knowing whether the upload is successful with the Arduino IDE is very valuable information. That tells us that your Pro Micro is not damaged. It tells us that COM4 is the correct port. It tells us that the problem is with Arduino Builder. As I said before, I have no experience with Arduino Builder so I will not be able to provide further assistance with that program but the additional information may help someone else here to provide you a solution.

PlacaFromHell

Looks like the boards are working so. Okay, thanks anyway. Any advance helps a loot. I tried to found another program but a loot of them aren't suporting Pro Micro/Leonardo or ATmega32U4 based boards right now.

pert

Yes, the ATmega32U4 boards have a little bit different method for uploading that the other boards.

If you're not set on using Arduino Builder, I can provide instructions that will allow you to upload your .hex file to the Pro Micro from the command line using the same AVRDUDE tool the Arduino IDE uses to upload. Let me know if you want to try it.

PlacaFromHell

Sure, I like the idea. You'll need to be pattient, as I said is my first project using Arduino.

pert

Do this:
  • (In the Arduino IDE) File > New
  • File > Preferences > Show verbose output during: > upload (check) > OK
  • Tools > Board > Arduino/Genuino Micro
  • Tools > Port > COM4
  • Sketch > Upload
  • Wait for upload to finish
  • Scroll the black console window at the bottom of the Arduino IDE window up until you see the avrdude command the Arduino IDE used to upload. It will look something like this:

Code: [Select]
C:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino14/bin/avrdude -CC:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino14/etc/avrdude.conf -v -V -patmega32u4 -cavr109 -PCOM11 -b57600 -D -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_426050/sketch_may16b.ino.hex:i
  • Use your mouse to highlight the entire line
  • Press Ctrl + C
  • Open a text editor
  • Press Ctrl + V
  • If there are any paths with spaces in them in the command you need to put them in quotes (for example "C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude.exe").
  • Change the .hex file name in the command to the .hex file you're trying to upload to your Pro Micro. Specify the full path to the file.
  • Press Ctrl + A
  • Press Ctrl + C
  • Start the Windows command line (Start button > Run > cmd).
  • Press Ctrl + V
  • Momentarily connect a jumper wire between the RST and GND pins on your Pro Micro
  • Immediately press the "Enter" key on your keyboard to run the avrdude commmand you pasted to the Windows  command line.

AVRDUDE should now upload the .hex file to your Pro Mini.

PlacaFromHell

Oh God. I love you so much. Is the best explanation I ever had. I'm typing on my 80's IBM model F XT right now. I'll made a spanish tutorial for those who have the same problem I had while building a converter. Thanks!!!!!

pert

Glad to hear it worked! Thanks for passing on the knowledge you gained through this process to others.

In case you're curious, here's a bit of extra information on what's going on here:

In order to upload to the Arduino's microcontroller via the USB cable a program called a bootloader that is stored in a special section of memory needs to be running. This program runs on startup and waits for a short time to see if an upload will start. On Arduino boards like Uno, Nano, Mega the microcontroller is automatically reset by the serial connection being opened at the start of the upload, which causes the bootloader to run. On the ATmega32U4 boards like Pro Micro it's not possible to do that automatic reset so what the Arduino IDE does is open a serial connection at 1200 baud. There is some code added to the Pro Micro's sketch that interprets that 1200 baud connection as a special signal to to reset the board so that the bootloader will run. When the bootloader is running the board will actually show up on a different COM port so the Arduino IDE then scans for the first new COM port to appear and then starts the upload to that COM port via AVRDUDE.

Since it would be difficult to do the standard Pro Micro reset sequence from the command line I had you instead do a manual reset by momentarily connecting the RST pin to ground, which causes the bootloader to run. Then you just need to start the AVRDUDE command before the bootloader times out and exits to whatever program you had previously uploaded to the Pro Micro. Luckily the bootloader tends to be assigned the same COM port every time so that's why you could reuse the upload command generated by the Arduino IDE.

Go Up