Reinstall bootloader for an Arduino Pro Micro? - Page 1
Forum section: electronics / general

author: ledtester
author_rank: Super Contributor
timestamp: June 09, 2019, 06:33:55 am
content: Using the Arduino IDE I accidentally uploaded the Blink sketch to an Arduino Pro Micro with the Board set to "Arduino Leonardo". It uploaded, but now the Pro Micro doesn't register its USB serial port when you plug it in.Can I reset the device back to its standard bootloader? I have a USBASP and an STK-500, and I've comfortable using avrdude.Thanks!And another question... what board setting should I use within the Arduino IDE for this device? In the Port menu it shows up as "/dev/ttyACM (Arduino/Genuino Micro)" so I guess I should select "Arduino/Genuino Micro", right?

author: ebastler
author_rank: Super Contributor
timestamp: June 09, 2019, 06:44:10 am
content: Have you tried the "reset twice" procedure already?https://arduino.stackexchange.com/questions/6702/arduino-pro-micro-clone-not-recognized-flickering-rx-ledhttps://arduino.stackexchange.com/questions/57651/arduino-pro-micro-bricked

author: lollandster
author_rank: Contributor
timestamp: June 09, 2019, 07:58:37 am
content: The pro micro doesn't have a ISP header so that makes it a bit trickier. But once you have successfully connected the ISP, use Arduino IDE to burn the bootloader (In Tools, select correct board, select correct programmer and press Burn Bootloader.)For avrdude you'll find the bootloaders in Arduino\hardware\arduino\avr\bootloadersImage source:https://www.coreforge.com/blog/2014/09/recovering-arduino-pro-micro-atmega32u4/EDIT: Yes, Arduino/Genuino Micro is the correct one for Pro Micro. The Pro Micro is essentially a Arduino Micro with fewer pins.

author: cv007
author_rank: Frequent Contributor
timestamp: June 09, 2019, 11:35:35 am
content: I would go to the bootloader source to figure out what is happening, as no bootloader (correctly done) would make you reflash the firmware just because you made a programming/coding mistake-https://github.com/arduino/ArduinoCore-avr/blob/7a2e1cd815266fef3012a5c9b48f88d78551f838/bootloaders/caterina/Caterina.c#L124Now, your board may be a variation of his bootloader, but I would bet most are at least similar and getting the source for it should be easy enough.If using the above 'original' bootloader, it only requires a setting of the external reset flag to make the bootloader run. To set the external reset flag of course, you pull the reset pin low. Then it looks like you have 8 seconds before the bootloader tries to run the app (this version simply jumps to 0 without checking if location 0 is an erased word).Others variations may do something different (press reset twice, etc.), but when you figure it out you will not have to get out the programmer to flash the bootloader every time you make a mistake.

author: ledtester
author_rank: Super Contributor
timestamp: June 09, 2019, 04:01:35 pm
content: Thanks everyone I finally got it working.The double reset trick worked - how it works on the Pro Micro is described here:https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/troubleshooting-and-faq#faq-reinstallBut then I had to fight Ubuntu's ModemManager which would grab the Pro MIcro's serial port and prevent the Arduino IDE from using it for the 8 seconds that it existed.I then found and tried the solution described in:https://defproc.co.uk/blog/sparkfun-pro-micro-device-busy/but couldn't get it to work. (Note you need to look at your syslog because the vendor id I was seeing was different (2341) from Spark Fun's vendor id 1b4f.) So I just ended up killing the ModemManager process and then I was able to upload the blink sketch.For the Board setting I used "Arduino/Genuino Micro". I did install the Spark Fun board library through the Board Manager preferences, but setting the Board to "Spark Fun Pro Micro" did not work.

author: cv007
author_rank: Frequent Contributor
timestamp: June 09, 2019, 04:19:11 pm
content: systemctl stop ModemManager.servicesystemctl disable ModemManager.serviceI doubt many need to put up with ModemManager's lengthy interrogation each time a serial device is plugged in. Took me a while to figure out what was happening when I wrote my usb driver, and makes for some confusing usb troubleshooting.

author: Nominal Animal
author_rank: Super Contributor
timestamp: June 10, 2019, 09:53:33 pm
content: Create49-pro-micro.rulesusing your favourite text editor. In Ubuntu, you can use e.g.gedit(in the Accessories menu) ornano(on the command line):Code:ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="920", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1", ENV{MTP_NO_PROBE}="1"SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="920", GROUP:="lp", MODE:="0660"KERNEL=="ttyACM*", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="920", GROUP:="lp", MODE:="0660"ATTRS{idVendor}=="2341", ATTRS{idProduct}=="920", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1", ENV{MTP_NO_PROBE}="1"SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="920", GROUP:="lp", MODE:="0660"KERNEL=="ttyACM*", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="920", GROUP:="lp", MODE:="0660"You can replacelpwith any other group name that should have full access to the microcontroller. TheENV{}parts tell ModemManager to keep its mitts off these devices.Install the rules file usingCode:sudo install -o root -g root -m 0664 49-pro-micro.rules /lib/udev/rules.d/sudo udevadm control -RThe first command copies it to the/lib/udev/rules.d/directory, setting proper ownership and mode, and the second command tellsudevto reload the rules. Existing devices are not affected; the new settings are only applied when a device is connected.