A Linux Kernel Wizard’s Adventures in Embedded Hardware

526

Sometimes the best tutorials come not from experts, but from proficient newcomers who are up to date on the latest entry-level technologies and can remember what it’s like to be a newbie. It also helps if, like Grant Likely, the teacher is a major figure in embedded Linux who understands how hardware is ignited by software.

At the Embedded Linux Conference, Likely — who is a Linux kernel engineer, and maintainer of the Linux Device Tree subsystem used by many embedded systems — described his embedded hardware journey in a presentation called “Hardware Design for Linux Engineers” — or as he put it, “explaining stuff I only learned six months ago.”

Likely dove into the embedded deep end when Linaro launched an open source hacker community called 96Boards.org. The 96Boards spec is used by a growing number of 64-bit ARM boards such as the DragonBoard 410c, HiKey, Andromeda Box Edge, and Bubblegum-96.

Linaro, an ARM-backed tools company dedicated to improving Linux and Android code for ARM SoCs, launched 96Boards to provide a consistent test platform. “We built the hardware because it allows us to solve our software goals,” Likely told the ELC audience. “We want Linux on ARM to behave in a consistent way across platforms.”

When Likely saw that 96Boards users craved a USB-to-UART adapter board, and “being foolish and optimistic,” he decided to build one himself. He was inspired by the Alan Kay quote: “People who are really serious about software should make their own hardware.”

Although Likely has an electrical engineering degree, he long ago turned to software, so he was more or less starting out fresh. “It was really intimidating,” he related. “There was a whole bunch of terminology and technology that I found very opaque.”

It’s Never Been Easier

Likely quickly found, however, that a maturing open source hardware ecosystem would make his journey easier. “It’s never been easier to do this,” he said. “We have free software, we have prototype services, and we have manufacturers who will do small runs.” Also helpful are hacker-friendly distribution companies like SparkFun, Adafruit, and SeeedStudio, which “sell a lot of hardware hacker educational materials, ” as well as local hackerspaces, open hardware projects, and hacker how-to sites such as Hackaday said Likely.

Likely recommended starting with one of the many I/O kits with breadboards and solderless components, most of which expand upon Arduino boards. SeeedStudio’s various kits featuring its Grove I/O and sensor modules “make it easy to play with pre-made modules and wire them up without having to know how to build a circuit.”

Likely used one of these kits with his kids to build a lightsaber, but because the USB-to-UART board was heading for production, he needed to dispense with the training wheels. To prep for prototyping a board, he learned how to use tools such as soldering iron, a multimeter, helping hands, and an oscilloscope.

“It took me a long time to figure out how to solder,” said Likely, repeating a complaint voiced by Linus Torvalds at ELC 2016. Said Likely: “I am not responsible for burnt fingers or blown up boards. Proceed at your own risk.”

Because he wanted a run of 10 boards for testing, Likely used an affordable assembly service offered by his prototyping production house, SeeedStudio. “I could have soldered them myself, although I would have had some trouble with the service mounts,” he said.

Likely also began exploring open source embedded design software. “I needed proper design tools to capture a schematic of the circuits, convert that to a layout of where the components are going, and send that off to manufacturing.”

He settled on KiCad, a package for simple two-PCB layer boards that he had tried and abandoned a few years ago. The open source software has now “improved in stability and usability while gaining some high-end features,” said Likely. “KiCad does differential pair routing so the traces are exactly the same length, and it does push/pull of traces so when you draw your traces, it will push the other ones out of the way.”

He also recommended the open source fritzing tool. “What’s cool about fritzing is once your breadboard is sorted out. you can flip over to schematic mode, and all your components and wires are already there,” said Likely. “Once the schematic is done, you flip to the PCB tab and you can lay-out the physical board with the traces and components. You can even submit the design to have a prototype board mastered.”

Deciding on Components

One of the biggest challenges was deciding on components. “You go to DigiKey and you’re confronted with a huge catalog of components with a crazy array of footprints,” said Likely. He suggested the “0603” footprint for two-pin components like resistors and diodes. “It’s big enough to do rework, but small enough so that you’re not taking up much board space.”

Other gnarly issues include choosing the height of connectors and standoffs and whether to use surface or through-hole mounting. “Through-hole has been preferred for hobbyist hardware — it’s easy to solder and replace components, and many people are scared of surface mount,” said Likely. But because manufacturers prefer surface mount, he tried it, and it was “not that bad.”

Likely also described the challenges of level shifting, which he says can usually be avoided by extensive breadboard prototyping. “I didn’t appreciate how difficult IO voltage levels were when I first started,” said Likely. Working with I2C buses and determining “how strong the I2C signals should be pulled up” is very tricky. (For more on debugging I2C, see the video, as well as Likely’s blog post on the subject.)

For PCB printing for prototyping, Likely recommended DirtyPCBs and OSHPark, in addition to the Seeed Fusion PCB service he chose. “They source the components, and build and assemble the boards,” said Likely. “With Seeed, you can submit your entire order online, including Gerber files and BOM, and they’ll give you an online quote.”

When looking for a manufacturing partner, choose one that can review your design before starting and that offers a testing service, recommended Likely. “Once you’re into production, you will want to document everything,” he said. “I spent as much time figuring out the manufacturing details as I did doing the design itself.”

In the end, the hard work paid off. The 96Boards UART Adapter Board is now available from SeeedStudio for $15.

https://www.youtube.com/watch?v=kCH5QkmKArg

linux-com_ctas_may2016_v2_elc.png?itok=QQNwiljU