import { _ as _export_sfc, c as createElementBlock, I as createVNode, w as withCtx, a8 as createStaticVNode, D as resolveComponent, o as openBlock, l as createBaseVNode } from "./chunks/framework.B9AX-CPi.js";
const __pageData = JSON.parse('{"title":"Flashing Your Keyboard","description":"","frontmatter":{},"headers":[],"relativePath":"newbs_flashing.md","filePath":"newbs_flashing.md","lastUpdated":null}');
const _sfc_main = { name: "newbs_flashing.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="flashing-your-keyboard" tabindex="-1">Flashing Your Keyboard <a class="header-anchor" href="#flashing-your-keyboard" aria-label="Permalink to &quot;Flashing Your Keyboard&quot;">​</a></h1><p>Now that you&#39;ve built a custom firmware file you&#39;ll want to flash your keyboard.</p><h2 id="put-your-keyboard-into-dfu-bootloader-mode" tabindex="-1">Put Your Keyboard into DFU (Bootloader) Mode <a class="header-anchor" href="#put-your-keyboard-into-dfu-bootloader-mode" aria-label="Permalink to &quot;Put Your Keyboard into DFU (Bootloader) Mode&quot;">​</a></h2><p>In order to flash your custom firmware you must first put your keyboard into a special flashing mode. While it is in this mode you will not be able to type or otherwise use your keyboard. It is very important that you do not unplug the keyboard or otherwise interrupt the flashing process while the firmware is being written.</p><p>Different keyboards have different ways to enter this special mode. If your PCB currently runs QMK, TMK, or PS2AVRGB (Bootmapper Client) and you have not been given specific instructions, try the following, in order:</p><ul><li>Hold down both shift keys and press <code>Pause</code></li><li>Hold down both shift keys and press <code>B</code></li><li>Unplug your keyboard, hold down the Spacebar and <code>B</code> at the same time, plug in your keyboard and wait a second before releasing the keys</li><li>Unplug your keyboard, hold down the top or bottom left key (usually Escape or Left Control) and plug in your keyboard</li><li>Press the physical <code>RESET</code> button, usually located on the underside of the PCB</li><li>Locate header pins on the PCB labeled <code>RESET</code> and <code>GND</code>, and short them together while plugging your PCB in</li></ul><p>If you&#39;ve attempted all of the above to no avail, and the main chip on the board says <code>STM32</code> or <code>RP2-B1</code> on it, this may be a bit more complicated. Generally your best bet is to ask on <a href="https://discord.gg/qmk" target="_blank" rel="noreferrer">Discord</a> for assistance. It&#39;s likely some photos of the board will be asked for -- if you can get them ready beforehand it&#39;ll help move things along!</p><p>Otherwise, you should see a message in yellow, similar to this in QMK Toolbox:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span>*** DFU device connected: Atmel Corp. ATmega32U4 (03EB:2FF4:0000)</span></span></code></pre></div><p>and this bootloader device will also be present in Device Manager, System Information.app, or <code>lsusb</code>.</p><h2 id="flashing-your-keyboard-with-qmk-toolbox" tabindex="-1">Flashing Your Keyboard with QMK Toolbox <a class="header-anchor" href="#flashing-your-keyboard-with-qmk-toolbox" aria-label="Permalink to &quot;Flashing Your Keyboard with QMK Toolbox&quot;">​</a></h2><p>The simplest way to flash your keyboard will be with the <a href="https://github.com/qmk/qmk_toolbox/releases" target="_blank" rel="noreferrer">QMK Toolbox</a>.</p><p>However, the Toolbox is currently only available for Windows and macOS. If you&#39;re using Linux (or just wish to flash the firmware from the command line), skip to the <a href="#flash-your-keyboard-from-the-command-line">Flash your Keyboard from the Command Line</a> section.</p><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>QMK Toolbox is not necessary for flashing <a href="./flashing#raspberry-pi-rp2040-uf2">RP2040 devices</a>.</p></div><h3 id="load-the-file-into-qmk-toolbox" tabindex="-1">Load the File into QMK Toolbox <a class="header-anchor" href="#load-the-file-into-qmk-toolbox" aria-label="Permalink to &quot;Load the File into QMK Toolbox&quot;">​</a></h3><p>Begin by opening the QMK Toolbox application. You&#39;ll want to locate the firmware file in Finder or Explorer. Your keyboard firmware may be in one of two formats- <code>.hex</code> or <code>.bin</code>. QMK tries to copy the appropriate one for your keyboard into the root <code>qmk_firmware</code> directory.</p><p>If you are on Windows or macOS, there are commands you can use to easily open the current folder in Explorer or Finder.</p>', 17);
const _hoisted_18 = /* @__PURE__ */ createBaseVNode("div", { class: "language- vp-adaptive-theme" }, [
  /* @__PURE__ */ createBaseVNode("button", {
    title: "Copy Code",
    class: "copy"
  }),
  /* @__PURE__ */ createBaseVNode("span", { class: "lang" }),
  /* @__PURE__ */ createBaseVNode("pre", { class: "shiki shiki-themes github-light github-dark vp-code" }, [
    /* @__PURE__ */ createBaseVNode("code", null, [
      /* @__PURE__ */ createBaseVNode("span", { class: "line" }, [
        /* @__PURE__ */ createBaseVNode("span", null, "start .")
      ])
    ])
  ])
], -1);
const _hoisted_19 = /* @__PURE__ */ createBaseVNode("div", { class: "language- vp-adaptive-theme" }, [
  /* @__PURE__ */ createBaseVNode("button", {
    title: "Copy Code",
    class: "copy"
  }),
  /* @__PURE__ */ createBaseVNode("span", { class: "lang" }),
  /* @__PURE__ */ createBaseVNode("pre", { class: "shiki shiki-themes github-light github-dark vp-code" }, [
    /* @__PURE__ */ createBaseVNode("code", null, [
      /* @__PURE__ */ createBaseVNode("span", { class: "line" }, [
        /* @__PURE__ */ createBaseVNode("span", null, "open .")
      ])
    ])
  ])
], -1);
const _hoisted_20 = /* @__PURE__ */ createStaticVNode('<p>The firmware file always follows this naming format:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span>&lt;keyboard_name&gt;_&lt;keymap_name&gt;.{bin,hex}</span></span></code></pre></div><p>For example, the <code>planck/rev5</code> with a <code>default</code> keymap will have this filename:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span>planck_rev5_default.hex</span></span></code></pre></div><p>Once you have located your firmware file, drag it into the &quot;Local file&quot; box in QMK Toolbox, or click &quot;Open&quot; and navigate to where your firmware file is stored.</p><h3 id="flash-your-keyboard" tabindex="-1">Flash Your Keyboard <a class="header-anchor" href="#flash-your-keyboard" aria-label="Permalink to &quot;Flash Your Keyboard&quot;">​</a></h3><p>Click the <code>Flash</code> button in QMK Toolbox. You will see output similar to the following:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span>*** DFU device connected: Atmel Corp. ATmega32U4 (03EB:2FF4:0000)</span></span>\n<span class="line"><span>*** Attempting to flash, please don&#39;t remove device</span></span>\n<span class="line"><span>&gt;&gt;&gt; dfu-programmer.exe atmega32u4 erase --force</span></span>\n<span class="line"><span>    Erasing flash...  Success</span></span>\n<span class="line"><span>    Checking memory from 0x0 to 0x6FFF...  Empty.</span></span>\n<span class="line"><span>&gt;&gt;&gt; dfu-programmer.exe atmega32u4 flash &quot;D:\\Git\\qmk_firmware\\gh60_satan_default.hex&quot;</span></span>\n<span class="line"><span>    Checking memory from 0x0 to 0x3F7F...  Empty.</span></span>\n<span class="line"><span>    0%                            100%  Programming 0x3F80 bytes...</span></span>\n<span class="line"><span>    [&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;]  Success</span></span>\n<span class="line"><span>    0%                            100%  Reading 0x7000 bytes...</span></span>\n<span class="line"><span>    [&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;]  Success</span></span>\n<span class="line"><span>    Validating...  Success</span></span>\n<span class="line"><span>    0x3F80 bytes written into 0x7000 bytes memory (56.70%).</span></span>\n<span class="line"><span>&gt;&gt;&gt; dfu-programmer.exe atmega32u4 reset</span></span>\n<span class="line"><span>    </span></span>\n<span class="line"><span>*** DFU device disconnected: Atmel Corp: ATmega32U4 (03EB:2FF4:0000)</span></span></code></pre></div><h2 id="flash-your-keyboard-from-the-command-line" tabindex="-1">Flash your Keyboard from the Command Line <a class="header-anchor" href="#flash-your-keyboard-from-the-command-line" aria-label="Permalink to &quot;Flash your Keyboard from the Command Line&quot;">​</a></h2><p>This has been made pretty simple compared to what it used to be. When you are ready to compile and flash your firmware, open up your terminal window and run the flash command:</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">qmk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> flash</span></span></code></pre></div><p>If you did not configure your keyboard/keymap name in the CLI according to the <a href="./newbs_getting_started">Configure your build environment</a> section, or you have multiple keyboards, you can specify the keyboard and keymap:</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">qmk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> flash</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -kb</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">my_keyboar</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">d</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">&gt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -km</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">my_keyma</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">p</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">&gt;</span></span></code></pre></div><p>This will check the keyboard&#39;s configuration, and then attempt to flash it based on the specified bootloader. This means that you don&#39;t need to know which bootloader that your keyboard uses. Just run the command, and let the command do the heavy lifting.</p><p>However, this does rely on the bootloader being set by the keyboard. If this information is not configured, or you&#39;re using a board that doesn&#39;t have a supported target to flash it, you will see this error:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span>WARNING: This board&#39;s bootloader is not specified or is not supported by the &quot;:flash&quot; target at this time.</span></span></code></pre></div><p>In this case, you&#39;ll have to fall back on specifying the bootloader. See the <a href="./flashing">Flashing Firmware</a> Guide for more details.</p><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>If your bootloader is not detected by <code>qmk flash</code>, try running <code>qmk doctor</code> for suggestions on how to fix common problems.</p></div><h2 id="test-it-out" tabindex="-1">Test It Out! <a class="header-anchor" href="#test-it-out" aria-label="Permalink to &quot;Test It Out!&quot;">​</a></h2><p>Congrats! Your custom firmware has been programmed to your keyboard and you&#39;re ready to test it out!</p><p>With a little bit of luck everything will work perfectly, but if not there are steps that will help you figure out what&#39;s wrong. Testing your keyboard is usually pretty straightforward. Press every single key and make sure it sends the keys you expect. You can use <a href="https://config.qmk.fm/#/test/" target="_blank" rel="noreferrer">QMK Configurator</a>&#39;s test mode to check your keyboard, even if it doesn&#39;t run QMK.</p><p>Still not working? Browse the FAQ topics for more information, or <a href="https://discord.gg/qmk" target="_blank" rel="noreferrer">chat with us on Discord</a>.</p>', 22);
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  const _component_PluginTabsTab = resolveComponent("PluginTabsTab");
  const _component_PluginTabs = resolveComponent("PluginTabs");
  return openBlock(), createElementBlock("div", null, [
    _hoisted_1,
    createVNode(_component_PluginTabs, null, {
      default: withCtx(() => [
        createVNode(_component_PluginTabsTab, { label: "Windows" }, {
          default: withCtx(() => [
            _hoisted_18
          ]),
          _: 1
        }),
        createVNode(_component_PluginTabsTab, { label: "macOS" }, {
          default: withCtx(() => [
            _hoisted_19
          ]),
          _: 1
        })
      ]),
      _: 1
    }),
    _hoisted_20
  ]);
}
const newbs_flashing = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
  __pageData,
  newbs_flashing as default
};
