Last active
February 16, 2023 13:14
-
-
Save gmmoreira/86d7f85ae9b5f737c5f8c5abfa56aef7 to your computer and use it in GitHub Desktop.
avrdude commands for Pro Micro (ATMega32U4)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using bootloader | |
# To enter bootloader, connect the board to the computer and connect briefly the GND and RST pins. | |
# Some boards may require this connection to be done twice. | |
# When the bootloader is running, a virtual serial connection is created and so we can read/write to the device | |
# Checking connection and fuses | |
avrdude -c avr109 -p m32u4 -P /dev/ttyACM0 -n | |
# It should write something like the example below | |
# Connecting to programmer: . | |
# Found programmer: Id = "CATERIN"; type = S | |
# Software Version = 1.0; No Hardware Version given. | |
# Programmer supports auto addr increment. | |
# Programmer supports buffered memory access with buffersize=128 bytes. | |
# Programmer supports the following devices: | |
# Device code: 0x44 | |
# avrdude: AVR device initialized and ready to accept instructions | |
# Reading | ################################################## | 100% 0.00s | |
# avrdude: Device signature = 0x1e9587 (probably m32u4) | |
# avrdude: safemode: Fuses OK (E:FB, H:D8, L:FF) | |
# avrdude done. Thank you. | |
# Explaining the command: | |
# -c avr109 set the programer as avr109. It's the protocol which will be used | |
# -p m32u4 set the target, which is an atmega32u4 | |
# -P /dev/ttyACM0 set the serial port. On Windows it would be something like COM1, COM7, etc... | |
# -n disables any writes, it's safe option | |
# Arduino as ISP | |
# Flasing using Arduino as ISP | |
avrdude -v -p m32u4 -P /dev/ttyUSB0 -c stk500v1 -b 19200 -U flash:w:caterina.hex:i -U lfuse:w:0xff:m -U hfuse:w:0xd8:m -U efuse:w:0xfb:m | |
# Arduino has an autoreset feature which resets the device when a serial connection is opened, so avrdude will fail because Arduino will be reseting and not ready. | |
# To prevent this, one option to use a capacitor in some pins (google it, dont remember) or cut some traces on the board. | |
# In Linux there's a simple option. It's possible to use the following command | |
stty -F /dev/ttyUSB0 -hupcl | |
# It will prevent the autoreset by not sending the hangup (something like that, I dont understand much about serial connections). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment