Program the pro micro with ftdi

Hi.
I accidentally broke off the micro usb socket on my Pro Micro (leonardo compatible).

Should I just throw it away, or is there an easy way to program it with external ftdi or an Arduino?
If so, please explain how.

thanks

In the specific case of the ATmega32U4 boards like your Pro Micro, it is fairly difficult to change to using an FTDI (or other USB to TTL serial adapter) to do uploads. The reason is that the ATmega32U4 has native USB capabilities so it acts as its own USB interface. For this reason, it uses a specialized bootloader that does not support uploading over serial. You would need to use an ISP programmer to flash a serial bootloader to the board. That's fairly easy, but I'm not aware of any pre-compiled serial bootloaders available for the ATmega32U4 (since it's not something most people would want). So you'd need to compile the bootloader yourself and that can be a bit tricky.

An easier alternative is to use a spare Arduino board as an "Arduino as ISP" programmer connected to your Pro Micro and then use the Arduino IDE's Sketch > Upload Using Programmer to upload sketches to your Pro Micro.

The ISP programer won't provide the serial connection to your computer that you would usually use with Serial Monitor. For that purpose, you can connect your FTDI to the RX and TX pins of your Pro Micro as well. The only tricky thing is you need to use Serial1 instead of Serial.

That's going to end up as quite a spaghetti mess of wires so I think it would be quite annoying to use that setup on a regular basis. However, it might be worthwhile to do if you had a finished project where you just needed to upload a sketch to an Arduino board once and then leave it on the finished device for long periods of time.

You will no longer be able to use the keyboard and mouse emulation features of your Pro Micro in this configuration.

I have done the same thing to a couple of my Pro Micros. Just out of curiosity, I did a repair on one. I started by trying to hand solder the USB jack back on and had absolutely no luck with that. Next, I soldered thin magnet wires to the USB jack pads and then spliced those wires to a cut USB cable. That worked fine but it seems pretty fragile and certainly not pretty. You would definitely need some strain relief on the cable to have any chance of it lasting. On other broken Pro Micros, I found that the PCB pads had ripped off with the USB jack. In that case, you need to scrape the solder mask off those traces to get something to solder. I certainly wasn't going to that much trouble.

Easy, no, it does take effort and study. https://www.instructables.com/id/How-to-upload-sketches-to-Pro-MicroLeonardo-via-se/

Thanks for the replies.
I am not sure that I understand what is needed.
Do I need to burn the Optiboot bootloader on the Pro Micro, or is Optiboot only needed to
program with RX/TX, and Arduino as ISP with Leonardo as target board should work directly?

steing:
Arduino as ISP with Leonardo as target board should work directly?

This.

Note that you would need an external serial adapter connected to TX/RX in order to get serial output.

And mouse/keyboard emulation won't work.

The while(!Serial); construction that's fairly common (particularly in examples) to detect when it's plugged into USB and delay the sketch execution until it is will hang forever because it will never be plugged into USB (it can't detect when it's connected to an external serial adapter); so any sketch using this will need to have it removed.

Considering how cheap pro micro clones are, I would suggest buying another one (whether you keep this one for use programming via ISP is up to you) - be careful when buying arduino clones on ebay that you're actually getting what you want: look at the pictures, not the title of the listing. The listing titles include the names of a bunch of arduino boards so they show up in more searches.

I have trouble uploading sketches with Arduino as ISP.

Burning bootloader seems to work ok, though.

multivac:~> /home/sg/Arduino/arduino-1.8.9/hardware/tools/avr/bin/avrdude -C/home/sg/Arduino/arduino-1.8.9/hardware/tools/avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D -Uflash:w:/tmp/arduino_build_449952/Blink.ino.hex:i

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/home/sg/Arduino/arduino-1.8.9/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/sg/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : butterfly
         Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .avrdude: butterfly_recv(): programmer is not responding

avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
Found programmer: Id = ""; type =
    Software Version = .; Hardware Version = �.�
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: error: programmer did not respond to command: leave prog mode
avrdude: error: programmer did not respond to command: exit bootloader

avrdude done.  Thank you.

Exit 1

With optiboot bootloader installed:

multivac:~> /home/sg/Arduino/arduino-1.8.9/hardware/tools/avr/bin/avrdude -C/home/sg/Arduino/arduino-1.8.9/hardware/tools/avr/etc/avrdude.conf -v -patmega32u4 -carduino -P/dev/ttyACM0 -b57600 -D -Uflash:w:/tmp/arduino_build_449952/Blink.ino.hex:i

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/home/sg/Arduino/arduino-1.8.9/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/sg/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x1c

avrdude done.  Thank you.

Exit 1

Same thing on a non-broken pro micro.

Any more tips?

thanks.

You need to do a Sketch > Upload Using Programmer when you are uploading with your Arduino as ISP. You can't use the regular Upload button (actually you can if you hold the Shift key while you click the button, since that's a shortcut for Upload Using Programmer.

Just for your general knowledge: Note that when you do an Upload Using Programmer it erases the bootloader. So after doing an Upload Using Programmer you won't be able to go back to regular uploads over serial until you've done another Burn Bootloader to replace the bootloader.

Thanks!

That was not very difficult. It works great!

Now I can keep and continue to use the board.

You're welcome. I'm glad to hear it's working now. Great work rescuing some hardware from going to the dump!

Enjoy!
Per