Devil's Canyon

MAY 18, 2019

The Devil's Canyon is an iteration of the American Kestrel, with three major design changes.

First, I really wanted to make a board with the STM32 onboard, this is the same chip used by the Planck and the Proton-C. So QMK support with no fuss. It also comes with the added benefit of not having any premade schematics available that I could cheat off of (at least in keyboard land, that I could find), meaning I had to design the circuit from scratch using only the data sheet and the Nucleo board schematic. This turned out to be an exiting challenge, there are quite a few changes from the AVR that needed to be made. The first is the most obvious, the STM32 requires [email protected], So I had to pickout a nice regulator to use. TI was my first, an only choice, of manufacturer, yet they still have quite a bit of choices. I ended up narrowing the selection down to a 5V input with 300mA output. 300mA is overkill for this application but gives me the option to power another chip later on (remember buying electronic components usually means purchasing more than you need so you try to buy parts that can be reused elsewere). I stuck with 5V even though I'm using USB-C because they are much cheaper, and I can put a buck regulator in front of it if I ever figure out how to do USB-PB. Anyway, moving on. A not so obvious change, and one I nearly missed, is that the USB D+ line requires a pull-up resistor. The AVR had this built in. The STM32 also has the correct impedance on the data lines so the termination resistors required by the AVR are not necessary. The rest of the circuit design was pretty straight forward, just selecting and configuring the crystal and bypass caps.

The second change is the most obvious. The new layout! This was a pretty inspired move on my part. I had been trying to find a way to compact the Kestrel, while allowing for three thumb keys instead of two on each side. That lead to Kestrel rev2, with the inside six keys being: shift, raise, space, enter, lower, shift. But I was still unhappy with the placement of the thumb keys, no matter where I put them or what angle I tried, it was either too awkward or caused the layout to be too tall, with a bunch of dead space below the layout (like pretty much all the splits that try to apease the thumbs). Then I had my epiphany, what if I put the shift on the inside? Then I could put one 2u horizontal, where it can be reached from both thumbs, without taking up vertical space. This leads to the five key arangement: raise, space, shift, enter, lower. And this gives me the same four key placement as on the Planck. Combine this with my desire to fit my layout into a 60% case (so I can get a fancy aluminum case), and the new layout was born. I also opted to leave out the 10 degree tilt to make PCB layout easier. I may end up adding it back in a future revision.

The third change was inspired by the Plaid kit, with all the components placed on the top edge of the board. I think that looks cool, and shows off your work, so I wanted to incoporate something similar. The best I came up with was cramming everything into the "canyon". It looks decent, but I'm not completely satisfied with how the diode placement looks, I'm gonna make a few changes for the next revision.


Build log begin. Meet the Bane of my weekend. What should have been a simple build culminating in my most awesome keyboard yet, became three days of utter hell. This thing earned its name well.

Freshly minted board, Let't take this opportunity to point out some mistakes here. You can see there are four rotary encoder footprints (bottom corners and center top), the placement of the bottom ones sucks, they cannot be used, they just get in the way of normal keyboard operation. I haven't tried the top ones, but they were placed there as an after thought, and may actually be useful. Another thing is the outer columns and the four thumb keys where we have a 1u and 1.5u combo footprint, these are setup mirrored so that when the switch is placed in the outer most spot, for 1.5u keys, the switch will be facing up. This, although seeming innocent and symmetrical, is actually wrong. It has to do with the way that the Kailh sockets fit into the holes and wrap arround the center stem. If you compare the right and left sides, you can see the alignment of the pads on top and bottom is reversed, (this is the mirroring, but it goes deeper than that, since the board is designed to be reversible, the pads on the back of the board suffer the same fate). The footprints on the right are in the proper configuration, the the left side will block the center stem when both sockets are installed, the board still works but you cant have both sockets installed to allow quick changes between 1u and 1.5u. It's just one of those things you don't notice until your trying to put the switch in and its not fitting.

Chip is almost installed. I went with the just gob on the paste and wick it off later technique. In restrospect this may have been my downfall.

All the big parts are installed, now working my way through the capacitors. Here you can see the crystal bypass caps in the botom left waiting to be soldered to their pads. These are some tiny 0603 pieces!

Everything soldered on, no shorts detected. You can see the two "giant" caps next to the regulator. I accidently ordered the wrong size (1206 instead of 0805), luckily was able to squeeze them onto the pads.

USB-C receptacle soldered on, this is a HiRose (i think) that I got from JLC, it is identical to the Sparkfun receptacle, but much cheaper. I actually found a new connector on DigiKey. It has through hole pins and cost half the price of the Sparkfun receptacle. I bought a couple and may try it on next revision.

The moment of truth came. I plugged in the board and... It didn't work. I was expecting it to enter DFU mode but all I got was same very generic USB errors that were no help at all. But that would have been too easy, right? So, how to fix this? My worst fear is that the circuit is wrong and the chip will not boot. If that is the case I am completely screwed. But how to check this? I'm going to have to use the Nucleo board to flash my board over the STLink, as I knew this may be required I added matching headers to my board (seen here) so I could interface with the Nucleo. Once I got everything setup, I was able to verify the chip was functional using the st-info utility. The next step was to try flashing something onto the board, so I flashed an old image for the Proton-C I had lying around from the Kestrel. This caused something unexpected to happen, the board entered DFU mode. So I flashed the board again through DFU and it worked!. Well sortof, every time I unplugged it for longer than a few minutes, the board would reenter DFU mode? I could unplug it for a minute or two and it would power on as HID, but leaving it unplugged for longer would cause it to reenter DFU mode. It was somewhat baffling. And actually took a long time to fix. What I haven't mentioned yet is that during all this time I was constantly fiddling with the boot0 pin, thinking it was the problem (it actually was, probably from the start). I can't tell you exactly what happened but I think mostly it comes from my missunderstanding and miscomprehension of how boot0 is configured. Let me spell it out for future reference.

boot0 pulled to VDD will cause the board to enter DFU on power up and on reset. boot0 pulled to GND will cause the board to operate normally, including after reset. boot0 left floating will cause wild the wild unpredictable behaviour I described before.

Yes, it turns out that even though I thought boot0 was being pulled low, the resistor was not fully soldered one one side leaving boot0 to float. This was not the cause of the original failure. I still have no idea what happened there. I did have boot0 pulled high at first, then low later, and neither configuration made any difference, and somepoint along the way my constant solder/desolder left one of the pads under the resistor solderless. So lesson learned, next revision add some jumpers so I can easily mess with the configuration without soldering.

So chip is working and everything is great right? Haha, this is the Devil's Canyon remember? After I got all the diodes soldered, I setup QMK and flashed a proper image onto the board to test all the keys, before soldering the Kailh sockets and finishing the install. Everything worked great, except for the bottom two rows on the right side. You can see here I had to re wire the rows to different pins. But that was only after much debugging. Here's what was happening. When triggering a keypress in row7 (I should probably mention, I have the rows doubled up so it is wired for eight rows split between the halves, sharing six columns) it would trigger every key in that column except for the key I was pressing. For example (in qwerty land) pressing m would cause rfvuj to print. This would seem to indicate a short, or a design flaw with the circuit, or maybe misconfiguration in QMK. After many hours of inspecting my circuit and QMK config I determined they were fine. So somehow there is a short in row7, except that there wasn't, continuity checks were all completely fine. Alright so maybe it's the port, I try a different port, and its still screwed up. But you can see in the picture that that eventually did work, so what is the problem? First, I wanted to further narrow down the issue. I reconfigured a few things and verified row8 works when connected to another port; however, when row7 was also connected row8 did not work. Further, when row7 was connected to another port its behaviour was changed slightly, it would trigger all rows including itself (so rfvujm). So now I know it is definitely the pin connected to row7. The only recourse I have left is to cut the trace connecting row7 to pin A4. This fixed the problem. Best I can tell there is internal damage to the chip causing a short it A4, its unlikely it was shipped that way, so it probably happened while soldering or at somepoint later while screwing with the circuit. It still doesn't explain why row8, connected to the adjoining pin A5, also didn't work. Without an occilloscope I probably won't be able to figure this out, for now I am satisfied to leave it be.

Finally I have all the switches working, but the Devil's Canyon isn't through with me yet! When inserting one of the switches, the pad broke out under the socket and took the trace with it. Sigh. Another circuit rewire and we are fully assembled. Or so I thought, you can see at the very top edge of the board, I neglected to solder the lone diode for the center key. That was a quick fix though.

Here you can see my Zealios and Box Blacks. The plate is 3D printed 3mm, with chamfer for the switches to 1.5mm on the underside. Took about 5 hours total to print.

Although this board is designed to fit inside a standard 60% case (and it does). The only 60% case I have is acheapo KBDFans acrylic hipro case, and it looks really bad, so I went ahead and designed a custom lopro case. You can see here my dimension guesswork is slightly off, but it still looks fine. For the next revision, I'll have the plate extend out on top of the case, instead of fit inside, that will help them match up perfectly.

A look down the bottom of the board, the PCB rests on a lip around the edge with four standoffs in the middle. For a standard 60% only three of the mount points could be used, the rest end up being underneath a switch. I think that would still be plenty to secure the board, but it does pose clearance issues, it is possible the standoffs would need to be ground off to avoid hitting the sockets. I don't know for sure because the KBD fans case I got had ridges (for extra support) that were definitely in the way. I had to trim down all of them, and in the process I just removed the standoffs as well. For an aluminum case that doesn't have the ridges, modifications may not be necessary. I'll have to pony up and buy one of those expensive beasts to find out.

The completed board. PMK Ice Caps, with a couple randoms from a grab bag. The cable is a 1UPKeyboards DIY USB-A to USB-C, despite being tedious it was assembled without any pain while I waited for my prints to finish.

Final layout. Nearly identical to my Planck setup, except the arrows, shift, and caps is moved to the opposite corner.

Over all this build totally sucked. But I am pleased with the outcome. I have typed this entire post on the board and it feels pretty good. I am very satisfied with the layout, the shift is a little weird but I think I can get used to it.