OpenOCD with the ST-Link v2

There is an issue when trying to program a SAMD21 like in the Arduino Zero using OpenOCD with a ST-Link v2 which gives errors like this: ** Programming Started ** auto erase enabled Info : SAMD MCU: SAMD21E18A (256KB Flash, 32KB RAM) Error: Failed to erase row containing 00000000 Error: SAMD: failed to erase sector 0 Error: failed erasing sectors 0 to 0 The issue is that NVMCTRL_CTRLA is a half-word register and the ST-Link v2 emulates the half word write using two single byte writes.


In follow up to my build, I’ve always wanted to design PCB and try my hand at SMD soldering. I normally use veroboard on a 0.1” pitch but the time to cut and solder wires makes for a slow build. Here’s the result: It has: An AT91SAMD21E18 (256 KiB flash, 32 pins, 0.8 mm pitch) USB, regulator, Cortex SWD debug header, LED, and pullups on I2C Footprint for a RFM69CW radio Adafruit Feather form factor Two layer PCB with 0603 passives The soldering turned out well.


It gets warm and humid here in the summer and feels too dry in the winter. To measure this I built up two MySensors Sensebender Micro boards and designed a 3D printed a case to go with them: The holes in the case are to save on print time and let the air flow. The battery is far oversized and probably self discharges faster than the board draws current. I ended up using a Raspberry Pi Zero with a RFM69HW as the gateway.

Adventures in making PCBs

As part of adding MySensors based sensors around the house, I want to make an integrated version of the Sensebender Micro upgraded with a SAMD21 and a RFM69HCW radio. I’ve never had much success with making PCBs at home, so I thought I’d give it another try and record the experiments. Try 1: HP M252dw, laminator @ 10 mm, 4 times through, Migros-brand T-Shirt transfer paper. Some transfer but lots left behind. on IPFS

The short story is that this blog is now available on IPFS at and This is done by generating the blog a second time with ipfs/ as the basepath, changing to relative links, and then adding and updating the name as part of the buildbot script. Hugo has relative and canonical link support but it seems inconsistent, and it’s hard to resist a sed script… I quite like how you can map ownership across DNS and IPFS using a TXT record.

Raspberry Pi Zero boot speed

I enjoy working on embedded systems, but there’s a significant amount of work you have to do in getting the platform ready before getting to the more interesting business logic. The Raspberry Pi Zero W solves most of these problems: it’s small, has decent I/O, a decent price ($10 + $6 for storage + $4 for shipping) and runs full Linux so I can use my current language of choice.

cxx17: working through Cracking the Coding Interview

I’m working my way through Cracking the Coding Interview as a way of learning the new features and tool ecosystem of C++17. Q1.9 reminded me of those games where you need to make a shape by drawing straight lines through dots. The trick with those games is to realise that you can draw outside the (implicit) bounds of the dots themselves. For Q1.9, the trick is to realise that you can concat the test string as any rotation will be a substring of the repeated string.

go packages on your own domain

go get has a nice feature where it will fetch the package URL and, based on a meta tag, redirect to the actual location. Here’s the nginx config I use to redirect go get to either my private repo (for unreleased stuff) or my cgit instance for everything else. This is similar to how… and… operate. server { … location ~ /x/(.*) { if (-d /home/juju/p/git/$1.git) { return 200 ‘<meta name="go-import" content="$host$uri git ssh://juju@$host/~juju/p/git/$1.

DFRobot FIT0441 pinout

I ordered two FIT0441 brushless motors for use in v2 of my balancing robot. The DFRobot wiki page on the motor is incorrect so I thought I’d blog about it so someone else can find it 🙂 The motor comes with a 5 pin JST-SH cable with a white end and a black end. The white end goes to the motor. When looking from the back of the motor with the socket at the 6 o’clock position, the wires are:

ESP8266 IO bridge looks cool – it exposes the I/O of a ESP8266 wifi module including the GPIO, I2C, PWM, ADC, and UART via a line based telnet interface.