PCB redesign and firmware progress

PCB redesign and firmware progress

Hey there! It’s February, and we have a new UHK update for you. A lot has been happening, and, barring unforeseen delays, we’re on track for April keyboard delivery. Let’s delve into the gory details!

Rubber feet and caps

There are small rubber feet and rubber caps on the ends of the flip-out feet of the UHK. Up until this point, we only had 3D printed versions of these caps, but the tooling has finally been created for them, so we got a couple samples.

Rubber samples

Rubber samples. The final rubber parts will be black.

Feet mounted

Feet mounted

The samples are surprisingly good for a first run. There’s only a very slight modification to be done to the tool to make it fit perfectly, which will completely eliminate the parting lines that are now slightly visible.

Steel guides

The steel guides are currently being manufactured. Here are some samples before vibration grinding them.

Force measurements

András has made a number of measurements with our new force measurement gauge.

To find the optimal pull force between the keyboard halves, András has made measurements using various magnets. They must not be too strong, but strong enough to prevent the accidental separation of the halves while carrying or during a fall. Some final tests still have to be made in the coming days, then the chosen magnets will be ordered.

Right-half bootloader completed

Even though the bootloader for the right keyboard half was already working, it wasn’t secured. That means that if we transferred a firmware image whose memory region overlapped with the bootloader memory region, the bootloader would have been overwritten by the firmware image.

Luckily, Kinetis devices offer hardware level memory region protection for such cases, which Santiago made a good use of. Now, with the memory protection in place, even if the bootloader would want to overwrite itself, it couldn’t.

But this isn’t the only safety measure that KBOOT, the Kinetis bootloader, provides. Let’s say that the firmware transfer gets aborted due to a power outage or for whatever reason. In such a case, the CRC checksum of the firmware doesn’t get updated and when plugging in the UHK the next time, KBOOT detects the CRC mismatch, and instead of jumping to the corrupted firmware, it stays active, waiting for a new, valid firmware transfer.

With the above protections in place, we believe that the right keyboard half is unbrickable via USB. I’m delighted that NXP offers such a comprehensive bootloader. It makes things so much easier and safer.

Santiago will make the bootloader for the left keyboard half work, too, but there’s something else to be done before then.

Firmware progress

The UHK firmware has already been working for quite some time, but some things weren’t exactly rock solid and optimized. This is about to change.

The reliable and resilient communication of the UHK parts is the core concern. If you think of the left and right keyboard halves, and the left and right add-on modules, these are all separate computers, and some of them contain multiple processors. The bus via which they’re interconnected offers a limited (although sufficient) bandwidth which must be utilized as efficiently as possible. To make things even more complex, any module can be disconnected, or connected any time, so hot-plugging must be seamlessly handled.

The main I2C bus of the UHK

First up, the communication should be made fully asynchronous. Synchronous communication was easy to implement because it’s just a sequence of instructions, but it’s highly suboptimal because it uses inefficient busy loops instead of interrupt handlers, and it’s hard to do robust error handling with it.

I was aware of these problems from the get-go, but I wasn’t concerned because I wanted to implement a working firmware as quickly as possible and improve it later. Now that we’re marching towards release, it’s time to solve these problems properly.

When changing sync code to async, the application logic changes quite a bit because instead of using a sequence of sync calls, an async callback gets fired whenever a communication event occurs, and a state machine has to be implemented inside of the callback.

I will end up implementing a scheduler state machine, so that the I2C master (the blue rectangle in the diagram above) will talk to I2C slaves (yellow rectangles) in a round-robin fashion. The purpose of these inter-module messages is to propagate state between the modules.

This will result in a very clear programming model in which the scheduler will sync the state of the modules in the background all the time, and the rest of the application logic of the master will be able to deal with the various module-specific data structures as if they were local.

I recently hit a related problem that I was unable to resolve, so in my true style, I summoned Santiago. The problem was that communication did not resume between the halves when I disconnected then reconnected them, even despite using async I2C calls. Santiago looked into the issue and concluded that the KSDK I2C driver is not very robust.

As it turns out, I2C drivers typically assume that I2C devices don’t get hot plugged, but are permanently soldered onto a PCB. Obviously, our situation is different, which calls for a more robust I2C driver on which Santiago is working right now.

PCB redesign

In our previous update, we told you that the UHK prototype has failed the EMC test and that I will find a professional PCB designer who (unlike me) does know what he’s doing.

I’m happy to introduce István Pánti, PCB designer extraordinaire!

István Pánti

István has been using Altium Designer over the years, a commercial PCB designer application which happens to be the number one industry standard worldwide. Luckily, he was willing, and even excited to learn KiCad, and according to his opinion it’s a surprisingly powerful tool for a Free Software package.

Then he cleaned up all of my traces and most components of the right UHK board, and started to reroute the tracks, beginning with the D+, D- differential pairs of USB, which are supposed to be the most problematic according to the EMC test measurements. His design turned out to be a lot cleaner than mine.

The redesigned right side PCB

The redesigned right side PCB

Routing PCBs is not black magic, but it may seem like it to the outsider, especially when dealing with EMC issues. There are a lot of layout rules to follow. Lucky for us, István has routed his fair share of PCBs before, including a USB hub, and read plenty of USB PCB design guidelines which now he puts to good use.

He’s been making great progress recently, and the end of the redesign is near. You can see his progress on GitHub.

I asked him to also create a 4 layer version of the PCBs after he finishes with the 2 layer version. Then we’ll prototype both versions and put them to the test. The 4 layer PCB should perform significantly better in the EMC department, but we’ll only pick it if necessary because it’s also significantly more expensive. This way, we can progress as quickly as possible.

Manufacturing progress

A short overview:

  • 2,000 LED displays are being manufactured.
  • 16,000 steel guides are being manufactured.
  • 4,000 magnet counterparts are being manufactured.
  • 2,000 FFC cables are being manufactured.
  • We will order 10,000 pogo pins, 126,000 keyswitches, and 126,000 keycaps in a few days.
  • 140,000 screws are on their way to us.

Lots of stuff are about to flow in pretty soon. Expect pictures of big boxes filled with goodies!

Thank you for reading the February installment of UHKzine. Talk to you on 2017-03-16!

By | 2017-02-16T18:16:12+00:00 2017-02-16 18:16|electronics, manufacturing, news, tech talk|24 Comments

24 Comments

  1. EdbO February 16, 2017 at 6:55 pm - Reply

    Woohooo … keep going ;-) As always, it's a joy to read the update and as it seems after two months it will be over :-( But never mind ….. Are we still able to put around 2.5 meter cable between the two halves? Any more news about the addons, or will you start working on them after the UHK is released?

    • László Monda February 16, 2017 at 7:42 pm - Reply

      Nice to see you again, EdbO! A little while ago, I tested a UHK prototype with a 20 meter long cable and it worked well, so things are looking good in that department. Recently, Santiago and I investiagated whether it's possible to use the same processor, the MKL03Z32VFK4 in every one of the add-ons and the answer seems to be positive. In the meantime, András is looking to delegate the mechanical design of the add-ons soon. Other than that, no major news about the add-ons yet, but we'll push them hard once we deliver the keyboards and palm rests. Cheers!

  2. Petr Kulich February 16, 2017 at 7:41 pm - Reply

    Great work guys! I am waiting each month on this blog as small boy on christmas but, I have one question. I probably miss that, but which brand of keyswitches you will order

    • László Monda February 16, 2017 at 7:50 pm - Reply

      Hi there, Petr! Kailh has been choosen for blue, brown, red, black, and Cherry will be used for green and clear. According to the science, we've made a good choice.

  3. Joel February 17, 2017 at 10:36 am - Reply

    That PCB picture actually looks like the mirror image of the left PCB rather than the right PCB.

    • László Monda February 17, 2017 at 10:39 am - Reply

      It is the right PCB, I can assure you. The shape of the left PCB is a bit different.

      • Joel February 17, 2017 at 3:37 pm - Reply

        If that is the case, they are miss labeled in the post from 2016-07-14 16:12

        • László Monda February 17, 2017 at 3:54 pm - Reply

          You're totally right! Just fixed the 2016-07 post. Thanks for noticing!

  4. WeZzy February 17, 2017 at 8:58 pm - Reply

    It looks like I actually skipped last months monthly cheer! OH THE NOES! Here they are: WOOHOOOO. WOOOOHOOOOOO. And one extra for good luck: WOOOOOHOOOOO.

    Thanks for the updates though, I really love reading them. And please, oh please, could you snap a picture of a big bag of 126k of keyswitches? Now that would be a poster I'd hang in my office for sure!

    Have a good one guys, keep up the good work.

    • László Monda February 17, 2017 at 9:30 pm - Reply

      Hi again, WeZzy! Thanks for rooting for us! We'll make sure to shoot a couple of hi-res pictures of the big bags for your viewing, and decorating pleasure. :)

  5. G.Y. February 18, 2017 at 3:14 pm - Reply

    Just a curiosity question, the pins of the left keyboard seem to be more exposed and so more likely to come in contact with other objects, I assume it is not harmful for the keyboard if two or more pins are short circuited due to an external conductor such as a metallic object or a wet thumb?

    • László Monda February 18, 2017 at 4:36 pm - Reply

      This is a great point. The polyfuse inside the UHK should already protect against such cases, but we'll further test it before certification.

  6. Joel February 20, 2017 at 11:15 pm - Reply

    What is vibration grinding?

    • László Monda February 20, 2017 at 11:36 pm - Reply

      The technology that will make the guides baby skin smooth. Here's a video of the process.

      • Joel February 22, 2017 at 4:21 pm - Reply

        Ah, I think the common name for that may be a vibratory tumbler.

  7. Adam March 3, 2017 at 7:15 am - Reply

    About the release date: is there still a possibility for more delays (and is crowdsupply flexible with delays)? A PCB redesign and testing should take a lot of time from the re-design phase, to testing prototypes, to mass production, right? I'm more concerned with getting a quality, finished product with all the bugs and kinks worked through, but at the same time, I am very enthusiastically looking forward to this keyboard. I just hope to have a realistic idea of the production timeline to keep my enthusiasm levels properly regulated / rationed for the oncoming months.

    • László Monda March 3, 2017 at 12:22 pm - Reply

      Hi Adam, Until we deliver the keyboards, there is always a possibility for more delays. The reason is that even if a single part gets delayed for some reason, that can affect the delivery schedule. Crowd Supply is flexible with these delays because they know how challenging it is to bring a complicated product like the UHK to the market. Even though PCB redesign does take time, our schematic and BOM is solid, so it should mostly be a matter of rerouting tracks, and possibly adding/changing some passive components. In any case, we will certainly not rush the project at the expense of quality. Thank you for your support, and should you have any further questions, feel free to ask!

  8. Domas March 4, 2017 at 9:16 am - Reply

    Have you finished PCB redesign and started prototype manufacturing? There was no activity on it @GitHub for quite some time.

    • László Monda March 4, 2017 at 10:01 pm - Reply

      The PCB of the right keyboard half has been redesigned which features the USB that we suspect is the problematic part. The last modification was made to the electronics repo 10 days ago when the design was sent to manufacturing. Since then, new prototypes were made, now they're being checked by EMC experts, and a new EMC test is scheduled for the next Friday in the lab.

      • Domas March 5, 2017 at 12:21 pm - Reply

        That's good news to hear!

      • Jean March 10, 2017 at 8:03 am - Reply

        Break a leg !
        It is friday and there is light at the end of the tunnel.

        Keep us posted.

        • László Monda March 11, 2017 at 11:23 pm - Reply

          Hi Jean! Just posted a small update on social media. Gonna post a big update on 2017-03-16 as promised.

      • G.Y. March 14, 2017 at 11:39 pm - Reply

        Uhh, what's up with the latest EMC tests data?

        If the labels are correct, I put the "Only laptop and USB cable" control measurements together and they are completely off: http://i.imgur.com/fOZfizs.png

        Are the EMC tests really "failing" before you even plug the UHK in?

        • László Monda March 15, 2017 at 12:55 am - Reply

          Yes, you're completely right. Quite crazy, isn't it? Please make sure to read our upcoming update. We'll talk about this.

Leave A Comment