The rust language logo being branded onto a microcontroller housing

Esp-hal, A Stable-API ESP32 HAL Gift For Your Rust Code

Looking to write Rust on the ESP32? You’re in luck, a new challenger has entered the scene, looking to help you write code that lasts – [Scott Mabin] and the team from Espressif have brought us the esp-hal 1.0.0-beta. From a personal project to an Espressif-sponsored one to an effort under Espressif’s wing, [Scott] tells us about the arduous journey of bringing first-class Rust support to ESP32 chips, Xtensa and RISC-V alike.

In particular, esp-hal, with the hal part standing for Hardware Abstraction Layer, focuses on providing you with a stable API to access hardware, making sure your code can remain stable for years to come. For now, you get drivers for GPIO, UART, SPI and I2C, as well as a number of auxiliary features like time and SoC reset, more than enough for a large amount of projects we hackers build with a generic MCU in mind.

Next stop? WiFi and BLE support, of course, an ESP32 just doesn’t feel the same without these two. Rust is a fun and seriously promising language, and it’s a joy to use! So, if you have a wireless-less project in mind and you’re looking for a HAL, try out the esp-hal, it might just be exactly what you need.

If you’re looking for examples, here’s an STM32 touchpad project with Rust firmware, a PIC32 Rust blinky demo, and we’ve even featured larger projects like this ESP32 open-source (reverse-engineered) WiFi MAC stack being written in Rust. In case you missed it, we’ve introduced Rust to you a couple of times, even as far as 2015!

Demonstration of the multichannel design feature, being able to put identical blocks into your design, only route one of them, and have all the other blocks' routing be duplicated

KiCad 9 Moves Up In The Pro League

Do you do PCB design for a living? Has KiCad been just a tiny bit insufficient for your lightning-fast board routing demands? We’ve just been graced with the KiCad 9 release (blog post, there’s a FOSDEM talk too), and it brings features of the rank you expect from a professional-level monthly-subscription PCB design suite.

Of course, KiCad 9 has delivered a ton of polish and features for all sorts of PCB design, so everyone will have some fun new additions to work with – but if you live and breathe PCB track routing, this release is especially for you.

Continue reading “KiCad 9 Moves Up In The Pro League”

Hack On Self: One Minute Blitz

Have you yet stumbled upon the principle of “consistently applied small amounts of work can guarantee completion of large projects”? I have, and it’s worked out well for me – on days when I could pay attention to them, that is.

A couple times, I’ve successfully completed long-term projects by making sure to do only a little bit of it, but I do it every day. It helps a lot with the feeling you get when you approach a large project – say, cleaning up your desk after a few days of heavy-duty hacking. If you’re multi-discipline, and especially if you happen to use multiple desks like me, a desk can stay occupied for a while.

Can you do one minute of desk cleaning today? Sure doesn’t feel like much time, or much effort. In a week’s time, however, you might just have a clean desk. Cleaning discrete messes is where this concept applies pretty well – you couldn’t wash floors like this, but you could wipe off the dust from a few surfaces for sure.

Now, I want to make this a habit – use it on like, seven different things a day. I wrote a script to make it possible – here’s how it works for me right now.

Building Upon The Seen-Before

I relied on a few previously-discussed things for this one. Main one is the Headphone Friend project – a pocketable Linux device, streaming audio from my laptop as I walk around my room. As a reminder, the headphones also have a button that emits HID events when pressed/released, and I have a small piece of software that can map actions to combinations of short-medium-long presses of that button.

Another necessity was a bit of software – dodging my questing system “away from laptop = system breaks” mistake, I wanted to put everything into my headphones, even the task names, trying to reach a “flow” through a series of 1-minute tasks. Of course, I reused the old sound library, but I also needed TTS generation on the fly! I went for PicoTTS with a simple wrapper – it’s not the best TTS system, but it’s damn fast, and perfectly suited for a prototype.

For the button-to-action mapping script, I had to expose some sort of API, to avoid merging the button scanning code and the task switching code. After a little deliberation, I picked websockets – they work decently well, and they’re quite portable, so I could run the button monitoring itself on the Headphone Friend device, and the main software on my laptop, for prototyping purposes.

Now, the more interesting question – how do I build the algorithm?

Continue reading “Hack On Self: One Minute Blitz”

PCB Design Review: M.2 SSD Splitter

Today’s PCB design review is a board is from [Wificable]. iI’s a novel dual-SSD laptop adapter board! See, CPUs and chipsets often let you split wide PCIe links into multiple smaller width links. This board relies on a specific laptop with a specific CPU series, and a BIOS mod, to put two M.2 NVMe SSDs into a single SSD slot of a specific series’ laptop.

This board has two crucial factors – mechanical compatibility, and electrical function. Looking into mechanics, it’s a 0.8 mm thick PCB that plugs into a M.2 socket, and it has sockets for two SSDs on it – plenty of bending going on. For electronics, it has a PCIe REFCLK clock buffer, that [Wificable] found on Mouser – a must have for PCIe bifurcation, and a must-work for this board’s core! Apart from that, this is a 4-layer board, it basically has to be for diffpairs to work first-try.

Of course, the clock buffer chip is the main active component and the focus of the board, most likely mistakes will happen there – let’s look at the chip first.

Continue reading “PCB Design Review: M.2 SSD Splitter”

Hack On Self: Quest System Basics

Whenever I play an RPG, whether it’s Fallout or Cyberpunk 2077, I complete every single quest available to me. The quests grab my attention in an unprecedented way – doesn’t hurt that there’s rewards and progression markers attached. Of course, these systems are meticulously designed to grab attention, making sure you can enjoy the entirety of the game’s content.

Does quest progression in an RPG tangibly impact my life? No. Do they have control over my attention? Yes, for sure. My day-to-day existence is the opposite – my real-life decisions impact me significantly, and yet, keeping attention on them is a struggle. Puzzling, disturbing – and curious. I feel like I’ll never forgive myself if I ignore this problem any longer.

So, I wrote a simple quest system prototype. As usual, it worked, it failed, and it taught me things. Here’s how I did it.

Continue reading “Hack On Self: Quest System Basics”

Sony Vaio Revived: Power, The Second 80%

A bit ago, I’ve told you about how the Sony Vaio motherboard replacement started, and all the tricks I used to make it succeed on the first try. How do you plan out the board, what are good things to keep in mind while you’re sourcing parts, and how do you ensure you finish the design? This time, I want to tell you my insights about what it takes for your new board revision to stay on your desk until completion, whether it’s helping it not burn up, or making sure the bringup process is doable.

Uninterrupted, Granular Power

Power was generally comfortable to design, but I did have to keep some power budgets in mind. A good exercise for safeguarding your regulators is keeping a .txt file where you log consumers and their expected current consumption on each board power rail, making sure all of your power regulators, connectors, and tracks, can handle quite a bit more than that current. Guideline: increase current by 20%-50% when figuring out the specs for switching regulators and inductors, and, multiply by 10-20% when figuring out conversion losses going between downstream and upstream rails.

I did have a blunder in this department – not accounting for track current early on enough. I laid out the board using 0.5mm wide tracks for power – it looked spacious enough. Then, I put “0.5mm” into a track current calculator and saw a harrowing temperature increase for the currents I was expecting. At that point in routing, it took some time to shift tracks around to accomodate the trace width I actually needed, which is to say, I should’ve calculated it all way way earlier. Thankfully, things went well in the end.

Continue reading “Sony Vaio Revived: Power, The Second 80%”

Sony Vaio Revived: How Does One Start?

A long-term project of mine is the the Sony Vaio new mainboard project. A year ago, I used it as an example to show you the cool new feature in KiCad 8, known as “background bitmaps”.

There are a heap of cool aspects to this specific Sony Vaio. It’s outrageously cute and purse-sized, the keyboard is nice enough for typing, motherboard schematics are available (very important!), and it’s not too terribly expensive. Of course, the most motivating aspect is that I happen to own one, its mainboard is not in the best state, and I’ve been itching to make it work.

It turned out to be a pretty complicated project, and, there was plenty to learn – way more than I expected in the beginning, too. I’m happy to announce that my v1 PCB design has been working wonders so far, and there are only a few small parts of it left untested.

I know that some of you might be looking to rebuild a lovely little computer of your choice. Hell, this particular laptop has had someone else rebuild it into a Pi-powered handheld years ago, as evidenced by this majestic “mess of wires” imgur build log! In honor of every hacker who has gotten their own almost-finished piece of hardware waiting for them half-assembled on the shelf, inside a KiCad file, or just inside your mind for now, let’s go through the tricks and decisions that helped make my board real.

Continue reading “Sony Vaio Revived: How Does One Start?”