Custom BLE Services with the nRF SDK

It’s very hard to write an introduction to an article about BLE without sounding a little ridiculous. What are you going to say, that it’s all around us today? It’s been all around us for five years. It’s the #1 choice for IoT applications today, owing in no small part to the fact that you can connect to any IoT device with a phone.

Today, I’m going to “talk” you through one of the most common, but also one of the most illustrative tasks that BLE development involves: writing a custom service (or a “vendor-specific service”, in BLE jargon). We’re going to do it from scratch, and we’ll discuss all the background on why we do things as we do — a lengthy discussion but, I hope, a useful one.

Continue reading Custom BLE Services with the nRF SDK

Systemd in Embedded Systems: Don’t Listen to the Hatemob

systemd, the (init?) system that everyone loves to hate, needs no introduction. It’s pretty ubiquitous today — to the point where you can find it, for example, in Yocto.

When it comes to its use in embedded systems, the (vocal) community response is either that it’s too bloated, or that it’s probably a fringe case where systemd is actually useful because it can speed up booting. Since the notorious optimum-in-the-middle — rule 8 in my favourite set of rules ever — is pretty hard to figure out in the climate of systemd-related online discussions, I figured I’d offer my non-flamebait take on the topic.

Fresh out of the oven, from someone who really does work on embedded systems — some of them systemd-infenabled.

Continue reading Systemd in Embedded Systems: Don’t Listen to the Hatemob

The Modbus CRC Endianness Kerfuffle

Modbus is a quaint protocol. It’s one of my favourite protocols — it’s not very convenient to use, but it’s pretty convenient to implement and remarkably flexible for an otherwise pretty opinionated protocol. Its specs are very self-contained and easy to follow.

That being said, like all protocols that are a) from an entirely different era of computing and b) royalty-free, there are a lot of non-conforming devices out there. When you run into one, you quickly start to doubt the specs, your documentation, your code and eventually your sanity. My favourite stumbling block? The endianness of the CRC value.

It’s not so much that nobody gets it right — in fact, it’s the one thing that even non-conforming devices get right, because their developers end up swapping the bytes until they get the order right, otherwise the device can’t talk to anything. It’s just that a lot of people don’t understand why they got it right.

Continue reading The Modbus CRC Endianness Kerfuffle