* [Guía completa para novatos](es/newbs.md) * [Empezando](es/newbs_getting_started.md) * [Construyendo tu primer firmare](es/newbs_building_firmware.md) * [Flasheando el firmware](es/newbs_flashing.md) * [Testeando y depurando ](es/newbs_testing_debugging.md) * [Mejores práticas](es/newbs_best_practices.md) * [Recursos de aprendizaje](es/newbs_learn_more_resources.md) * [QMK Basics](es/README.md) * [Introducción a QMK](es/getting_started_introduction.md) * [QMK CLI](es/cli.md) * [Configuración de QMK CLI](es/cli_configuration.md) * [Contribuyendo a QMK](es/contributing.md) * [Cómo usar Github](es/getting_started_github.md) * [Obtener ayuda](es/getting_started_getting_help.md) * [Cambios incompatibles](es/breaking_changes.md) * [30 Ago 2019](es/ChangeLog/20190830.md) * [Preguntas frecuentes](es/faq.md) * [General](es/faq_general.md) * [Construir/Compilar QMK](es/faq_build.md) * [Depurando/Encontrando problemas en QMK](es/faq_debug.md) * [Keymap](es/faq_keymap.md) * [Instalación de drivers con Zadig](es/driver_installation_zadig.md) * Guías detalladas * [Instalar herramientas construcción](es/getting_started_build_tools.md) * [Guía Vagrant](es/getting_started_vagrant.md) * [Instrucciones de Construcción/Compilado](es/getting_started_make_guide.md) * [Flasheando Firmware](es/flashing.md) * [Personalizando funcionalidad](es/custom_quantum_functions.md) * [Visión general del Keymap](es/keymap.md) * [Hardware](es/hardware.md) * [Procesadores AVR](es/hardware_avr.md) * [Drivers](es/hardware_drivers.md) * Referencia * [Pautas de teclados](es/hardware_keyboard_guidelines.md) * [Opciones de configuración](es/config_options.md) * [Keycodes](es/keycodes.md) * [Convenciones de código - C](es/coding_conventions_c.md) * [Convenciones de código - Python](es/coding_conventions_python.md) * [Mejores prácticas de documentación](es/documentation_best_practices.md) * [Plantillas de documentación](es/documentation_templates.md) * [Glosario](es/reference_glossary.md) * [Tests unitarios](es/unit_testing.md) * [Funciones útiles](es/ref_functions.md) * [Sporte configurador](es/reference_configurator_support.md) * [Formato info.json](es/reference_info_json.md) * [Desarrollo Python CLI](es/cli_development.md) * [Características](es/features.md) * [Keycodes Básicos](es/keycodes_basic.md) * [Teclas US ANSI Shifted](es/keycodes_us_ansi_shifted.md) * [Keycodes Quantum](es/quantum_keycodes.md) * [Keycodes Avanzados](es/feature_advanced_keycodes.md) * [Audio](es/feature_audio.md) * [Auto Shift](es/feature_auto_shift.md) * [Retroiluminación](es/feature_backlight.md) * [Bluetooth](es/feature_bluetooth.md) * [Bootmagic](es/feature_bootmagic.md) * [Combos](es/feature_combo.md) * [Comando](es/feature_command.md) * [API Debounce](es/feature_debounce_type.md) * [Switch DIP](es/feature_dip_switch.md) * [Macros Dinámicas](es/feature_dynamic_macros.md) * [Encoders](es/feature_encoders.md) * [Grave Escape](es/feature_grave_esc.md) * [Feedback Háptico](es/feature_haptic_feedback.md) * [Controlador LCD HD44780](es/feature_hd44780.md) * [Key Lock](es/feature_key_lock.md) * [Layouts](es/feature_layouts.md) * [Tecla Leader](es/feature_leader_key.md) * [Matriz LED](es/feature_led_matrix.md) * [Macros](es/feature_macros.md) * [Teclas del ratón](es/feature_mouse_keys.md) * [Driver OLED](es/feature_oled_driver.md) * [Teclas One Shot](es/one_shot_keys.md) * [Dispositivo de apuntado](es/feature_pointing_device.md) * [Ratón PS/2](es/feature_ps2_mouse.md) * [Iluminación RGB](es/feature_rgblight.md) * [Matriz RGB](es/feature_rgb_matrix.md) * [Cadete espacial](es/feature_space_cadet.md) * [Teclado dividido](es/feature_split_keyboard.md) * [Stenografía](es/feature_stenography.md) * [Swap Hands](es/feature_swap_hands.md) * [Tap Dance](es/feature_tap_dance.md) * [Terminal](es/feature_terminal.md) * [Impresora Térmica](es/feature_thermal_printer.md) * [Unicode](es/feature_unicode.md) * [Userspace](es/feature_userspace.md) * [Velocikey](es/feature_velocikey.md) * Para Makers y Modders * [Guía de cableado a mano](es/hand_wire.md) * [Guía de flasheado de ISP](es/isp_flashing_guide.md) * [Guía de depuración de ARM](es/arm_debugging.md) * [Driver I2C](es/i2c_driver.md) * [Controles GPIO](es/internals_gpio_control.md) * [Conversión Proton C](es/proton_c_conversion.md) * Para entender en profundidad * [Cómo funcionan los teclados](es/how_keyboards_work.md) * [Entendiendo QMK](es/understanding_qmk.md) * Otros temas * [Usando Eclipse con QMK](es/other_eclipse.md) * [Usando VSCode con QMK](es/other_vscode.md) * [Soporte](es/getting_started_getting_help.md) * [Cómo añadir traducciones](es/translating.md) * QMK Internals (En progreso) * [Defines](es/internals_defines.md) * [Input Callback Reg](es/internals_input_callback_reg.md) * [Dispositivo Midi](es/internals_midi_device.md) * [Proceso de configuración de un dispositivo Midi](es/internals_midi_device_setup_process.md) * [Utilidad Midi](es/internals_midi_util.md) * [Funciones Send](es/internals_send_functions.md) * [Herramientas Sysex](es/internals_sysex_tools.md) id='n74' href='#n74'>74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
# ISP Flashing Guide
ISP flashing (also known as ICSP flashing) is the process of programming a microcontroller directly. This allows you to replace the bootloader, or change the "fuses" on the controller, which control a number of hardware- and software-related functions, such as the speed of the controller, how it boots, and other options.
The main use of ISP flashing for QMK is flashing or replacing the bootloader on your AVR-based controller (Pro Micros, or V-USB chips).
?> This is only for programming AVR based boards, such as the Pro Micro or other ATmega controllers. It is not for Arm controllers, such as the Proton C.
## Dealing with Corrupted Bootloaders
If you're having trouble flashing/erasing your board, and running into cryptic error messages like any of the following for a DFU based controller:
libusb: warning [darwin_transfer_status] transfer error: timed out
dfu.c:844: -ETIMEDOUT: Transfer timed out, NAK 0xffffffc4 (-60)
atmel.c:1627: atmel_flash: flash data dfu_download failed.
atmel.c:1629: Expected message length of 1072, got -60.
atmel.c:1434: Error flashing the block: err -2.
ERROR
Memory write error, use debug for more info.
commands.c:360: Error writing memory data. (err -4)
dfu.c:844: -EPIPE: a) Babble detect or b) Endpoint stalled 0xffffffe0 (-32)
Device is write protected.
dfu.c:252: dfu_clear_status( 0x7fff4fc2ea80 )
atmel.c:1434: Error flashing the block: err -2.
ERROR
Memory write error, use debug for more info.
commands.c:360: Error writing memory data. (err -4)
Or, if you see this sort of message for a Pro Micro based controller:
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: verification error, first mismatch at byte 0x002a
0x2b != 0x75
avrdude: verification error; content mismatch
avrdude: verification error; content mismatch
You're likely going to need to ISP flash your board/device to get it working again.
## Hardware Needed
You'll need one of the following to actually perform the ISP flashing (followed by the protocol they use):
* [SparkFun PocketAVR](https://www.sparkfun.com/products/9825) - (USB Tiny)
* [USBtinyISP AVR Programmer Kit](https://www.adafruit.com/product/46) - (USB Tiny)
* [Teensy 2.0](https://www.pjrc.com/store/teensy.html) - (avrisp)
* [Pro Micro](https://www.sparkfun.com/products/12640) - (avrisp)
* [Bus Pirate](https://www.adafruit.com/product/237) - (buspirate)
There are other devices that can be used to ISP flash, but these are the main ones. Also, all product links are to the official versions. You can source them elsewhere.
You'll also need something to wire your "ISP Programmer" to the device that you're programming. Some PCBs may have ISP headers that you can use directly, but this often isn't the case, so you'll likely need to solder to the controller itself or to different switches or other components.
### The ISP Firmware
The Teensy and Pro Micro controllers will need you to flash the ISP firmware to the controllers before you can use them as an ISP programmer. The rest of the hardware should come preprogrammed. So, for these controllers, download the correct hex file, and flash it first.
* Teensy 2.0: [`util/teensy_2.0_ISP_B0.hex`](https://github.com/qmk/qmk_firmware/blob/master/util/teensy_2.0_ISP_B0.hex) (`B0`)
* Pro Micro: [`util/pro_micro_ISP_B6_10.hex`](https://github.com/qmk/qmk_firmware/blob/master/util/pro_micro_ISP_B6_10.hex) (`10/B6`)
Once you've flashed your controller, you won't need this hex file anymore.
## Software Needed
The QMK Toolbox can be used for most (all) of this.
However, you can grab the [Teensy Loader](https://www.pjrc.com/teensy/loader.html) to flash your Teensy 2.0 board, if you are using that. Or you can use `avrdude` (installed as part of `qmk_install.sh`), or [AVRDUDESS](https://blog.zakkemble.net/avrdudess-a-gui-for-avrdude/) (for Windows) to flash the Pro Micro, and the ISP flashing.
## Wiring
This is pretty straight-forward - we'll be connecting like-things to like-things in the following manner.
### SparkFun Pocket AVR
PocketAVR RST <-> Keyboard RESET
PocketAVR SCLK <-> Keyboard B1 (SCLK)
PocketAVR MOSI <-> Keyboard B2 (MOSI)
PocketAVR MISO <-> Keyboard B3 (MISO)
PocketAVR VCC <-> Keyboard VCC
PocketAVR GND <-> Keyboard GND
### Teensy 2.0
Teensy B0 <-> Keyboard RESET
Teensy B1 <-> Keyboard B1 (SCLK)
Teensy B2 <-> Keyboard B2 (MOSI)
Teensy B3 <-> Keyboard B3 (MISO)
Teensy VCC <-> Keyboard VCC
Teensy GND <-> Keyboard GND
!> Note that the B0 pin on the Teensy is wired to the RESET/RST pin on the keyboard's controller. ***DO NOT*** wire the RESET pin on the Teensy to the RESET on the keyboard.
### Pro Micro
Pro Micro 10 (B6) <-> Keyboard RESET
Pro Micro 15 (B1) <-> Keyboard B1 (SCLK)
Pro Micro 16 (B2) <-> Keyboard B2 (MOSI)
Pro Micro 14 (B3) <-> Keyboard B3 (MISO)
Pro Micro VCC <-> Keyboard VCC
Pro Micro GND <-> Keyboard GND
!> Note that the 10/B6 pin on the Pro Micro is wired to the RESET/RST pin on the keyboard's controller. ***DO NOT*** wire the RESET pin on the Pro Micro to the RESET on the keyboard.
## Flashing Your Keyboard
After you have your ISP programmer set up, and wired to your keyboard, it's time to flash your keyboard.
### The Bootloader File
The simplest and quickest way to get things back to normal is to flash only a bootloader to the keyboard. Once this is done, you can connect the keyboard normally and flash the keyboard like you normally would.
You can find the stock bootloaders in the [`util/` folder](https://github.com/qmk/qmk_firmware/tree/master/util). Be sure to flash the correct bootloader for your chip:
* [`atmega32u4`](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_atmega32u4_1_0_0.hex) - Most keyboards, Planck Rev 1-5, Preonic Rev 1-2
* [`Pro Micro`](https://github.com/sparkfun/Arduino_Boards/blob/master/sparkfun/avr/bootloaders/caterina/Caterina-promicro16.hex) - The default bootloader for Pro Micro controllers
* [`at90usb1286`](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_at90usb128x_1_0_1.hex) - Planck Light Rev 1
* [`atmega32a`](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_atmega32a_1_0_0.hex) - jj40, and other V-USB/ps2avrGB keyboards
If you're not sure what your board uses, look in the `rules.mk` file for the keyboard in QMK. The `MCU =` line will have the value you need. It may differ between different versions of the board.
### Production Techniques
If you'd like to flash both the bootloader **and** the regular firmware at the same time, there are two options to do so. Manually, or with the `:production` target when compiling.
To do this manually:
1. Open the original firmware .hex file in a text editor
2. Remove the last line (which should be `:00000001FF` - this is an EOF message)
3. Copy the entire bootloader's contents onto a new line (with no empty lines between) and paste it at the end of the original file
4. Save it as a new file by naming it `<keyboard>_<keymap>_production.hex`
?> It's possible to use other bootloaders here in the same way, but __you need a bootloader__, otherwise you'll have to use ISP again to write new firmware to your keyboard.
To do this the easy way, you can flash the board using the `:production` target when compiling. This compiles the firmware, then compiles the QMK DFU bootloader, and then creates a combined image. Once this is done, you'll see three files:
* `<keyboard>_<keymap>.hex`
* `<keyboard>_<keymap>_bootloader.hex`
* `<keyboard>_<keymap>_production.hex`
The QMK DFU bootloader has only really been tested on `atmega32u4` controllers (such as the AVR based Planck boards, and the Pro Micro), and hasn't been tested on other controllers. However, it will definitely not work on V-USB controllers, such as the `atmega32a` or `atmega328p`.
You can flash either the bootloader or the production firmware file. The production firmware file will take a lot longer to flash, since it's flashing a lot more data.
?> Note: You should stay with the same bootloader. If you're using DFU already, switching to QMK DFU is fine. But flashing QMK DFU onto a Pro Micro, for instance, has additional steps needed.
## Flashing Your Bootloader/Production File
Make sure your keyboard is unplugged from any device, and plug in your ISP Programmer.
If you want to change bootloader types, You'll need to use the command line.
### QMK Toolbox
1. `AVRISP device connected` or `USB Tiny device connected` will show up in yellow
2. Select the correct bootloader/production .hex file with the `Open` dialog (spaces can't be in the path)
3. Be sure the correct `Microcontroller` option for the keyboard you're flashing (not the ISP programmer) is selected