splitkb.com

Remapping pins

If a pin on your controller broken, it can be remapped.

When to use

You should use this document when you're using and/or experiencing the following.

Products

This page applies to the following products:

  • Any DIY kit where you have to solder the switches, or where you have to solder sockets to mount switches into.
  • You're using QMK, Vial or ZMK firmware.

Situations

Use this page when:

  • Pressing any key in a row or column does not output anything when pressed.

Expected outcome

After following the instructions on this page:

  • All keys perform only their configured action when pressed.

When to avoid

Do not use this page when:

  • Your kit came presoldered.
    • Warranty may apply to your product. Please contact us instead.
    • If you are confident, you may of course attempt a repair yourself. Please do discuss this with support beforehand.

You've just soldered your keyboard and ran into an issue: a row or column doesn't work. You've followed the steps over at Troubleshooting switches and ended up poking at your keyboard with a multimeter. You discovered that the pins that should have continuity indeed do have continuity, so your soldering isn't the issue here.

Alternatively, you've been using your keyboard for a while now, and suddenly a row or column stopped working. You've followed the troubleshooting guide here too, with the same result. You might've experienced a static shock when using your keyboard prior to the row or column not working, though this doesn't have to be the case.

In both cases, it's likely that a pin on your microcontroller has become defective. Before replacing it, it can be worthwhile to use another pin instead and remap the pin in the firmware, before replacing the entire controller.

This can be pretty technical. You'll need to change some values in firmware files and compile your own firmware. If you've been using Vial firmware, then you can still compile your own Vial-compatible firmware, too. Changing the pins does mean you won't be able to use the default firmware provided through the Firmware Finder anymore.

Rewiring the pin

Before dealing with the firmware, we need to add a wire. And before we can do that, we'll want to decide which defective pin to wire to which replacement pin.

Determining the defective pin

You've followed the Troubleshooting switches guide, and discovered the non-working pin. In this example, let's assume that you've discovered that the second column (that would usually output WSX) stopped working on your Aurora Corne's left half. Using the schematics found in the Product Guides section, we can see that that column is COL1, and that the column corresponds with pin B6 on the microcontroller, or the bottom right pin.

The numbers in the schematics don't always line up with the numbers on your controller, so the position can be important. You can look at the position of the two ground pins (GND) to see how your controller is oriented, and then look at the pinout of your controller to check which pin it is:

In our example, pin B6 or the bottom right pin, corresponds with pin 21 or B6 on a Liatris, and with pin 009 or D10 on a nice!nano.

Determining the replacement pin

Next up, we'll want to choose an unused pin on the microcontroller to which we can map the previously defective pin.

In the schematics, unused pins are marked with a blue x. For the Aurora Corne, that's pin F5 on the left controller, which corresponds with pin 28 or F5 on a Liatris, and with pin P0.29 or D20 on a nice!nano.

If your controller does not have unused pins on the sides, there may be extra pins you can use instead. For the Liatris and Elite-C, there are five pins on the bottom. On the nice!nano, there are three extra pins in the middle of the controller board. Those extra pins are never used on Aurora DIY keyboard kits and so they're safe to use as replacement pins.

Wiring it up

Solder a wire between the defective pin and the replacement pin. Most any wire will do, even if it's a salvaged strand of wire from a torn down USB cable. If it's relatively thin and otherwise insulated (you don't want accidental shorts with other pins), it'll work just fine.

Redefining the pin

Now that we know the original pin and the replacement pin we'd like to use, we can redefine it in the firmware.

QMK and Vial

For QMK and Vial, you'll first want to set up your local environment if you hadn't already. This allows you to compile your own firmware.

If you're using Vial, you'll still want to set up your local QMK environment. But instead of digging through the QMK directory, you'll instead want to clone our vial-qmk repository. The relative paths and build steps are almost the same for both QMK and Vial - the only difference is that you'll want to specify using the vial keymap when using Vial, instead of the default one or a custom keymap.

Then, in your local QMK or Vial directory, go to the /keyboards/splitkb folder and find the matching folder for your keyboard. In our example, the Aurora Corne is located under /keyboards/splitkb/aurora/corne. We're looking for a keyboard.json file, so we'll navigate to the revision for your keyboard (/rev1) and we can find the file there.

Within that file, only a few lines matter to us. You can search for "matrix_pins", in which the pins of your microcontroller are mapped to the rows and columns. That section looks like this:

"matrix_pins": {
    "rows": ["D7", "E6", "B4", "B5"],
    "cols": ["B2", "B6", "B3", "B1", "F7", "F6"]
},

Since we already know pin B6 is the one that broke for us, we can find that and replace its value with the replacement pin F5.

Last, you'll want to compile and flash your new firmware, and you'll be good to go once more!

ZMK

The ZMK contributors have written a nice guide on pin remapping at Electrical Net Connections - Resolving Issues. The rest of this section provides additional detail for their guide.

Our defective pin is column 1, which we looked up in the pinout diagram to be pin P0.09 or D10. In your kscan declaration, that same column pin is listed similar to <&pro_micro 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - it takes the 10 from D10.

You'll want to find the matching line for your defective pin, and replace the number with the number of your replacement pin. In this example, we're going with pin P0.29, or D20, which means the line we found should be modified to become <&pro_micro 20 GPIO_ACTIVE_HIGH>.

If the replacement pin isn't part of the pro_micro overlay, you can refer to it directly using the gpio0 overlay and the pin number, which for P0.29 would be 29.

About nodes: Nodes are a way to refer to pins that are common to a form-factor of a controller, which makes it easy for the keyboard to refer to a pin without having to know the exact controller that's used. This is why you'll need to refer to pins by one of their names when using the pro_micro node, and another name when using the gpio0 node.

Last, you'll want to recompile and flash your firmware, and you'll be good to go once more!


Questions? Help us improve!
Do you have questions after reading the documentation? Do you have feedback about this page, or about the documentation in general? Please send us an email. You can use the buttons below which will open your mail client or app with a template, or send your mail to support@splitkb.com.