Bare Metal STM32: Increasing The System Clock And Running Dhrystone

When you start an STM32 MCU with its default configuration, its CPU will tick along at a leisurely number of cycles on the order of 8 to 16 MHz, using the high-speed internal (HSI) clock source as a safe default to bootstrap from. After this phase, we are free to go wild with the system clock, as well as the various clock sources that are available beyond the HSI.

Increasing the system clock doesn’t just affect the CPU either, but also affects the MCU’s internal buses via its prescalers and with it the peripherals like timers on that bus. Hence it’s essential to understand the clock fabric of the target MCU. This article will focus on the general case of increasing the system clock on an STM32F103 MCU from the default to the maximum rated clock speed using the relevant registers, taking into account aspects like Flash wait states and the APB and AHB prescalers.

Although the Dhrystone benchmark is rather old-fashioned now, it’ll be used to demonstrate the difference that a faster CPU makes, as well as how complex accurately benchmarking is. Plus it’s just interesting to get an idea of how a lowly Cortex-M3 based MCU compares to a once top-of-the line Intel Pentium 90 CPU.

Continue reading “Bare Metal STM32: Increasing The System Clock And Running Dhrystone”

Catching Those Old Busses

The PC has had its fair share of bus slots. What started with the ISA bus has culminated, so far, in PCI Express slots, M.2 slots, and a few other mechanisms to connect devices to your computer internally. But if the 8-bit ISA card is the first bus you can remember, you are missing out. There were practically as many bus slots in computers as there were computers. Perhaps the most famous bus in early home computers was the Altair 8800’s bus, retroactively termed the S-100 bus, but that wasn’t the oldest standard.

There are more buses than we can cover in a single post, but to narrow it down, we’ll assume a bus is a standard that allows uniform cards to plug into the system in some meaningful way. A typical bus will provide power and access to the computer’s data bus, or at least to its I/O system. Some bus connectors also allow access to the computer’s memory. In a way, the term is overloaded. Not all buses are created equal. Since we are talking about old bus connectors, we’ll exclude new-fangled high speed serial buses, for the most part.

Tradeoffs

There are several trade-offs to consider when designing a bus. For example, it is tempting to provide regulated power via the bus connector. However, that also may limit the amount of power-hungry electronics you can put on a card and — even worse — on all the cards at one time. That’s why the S-100 bus, for example, provided unregulated power and expected each card to regulate it.

On the other hand, later buses, such as VME, will typically have regulated power supplies available. Switching power supplies were a big driver of this. Providing, for example, 100 W of 5 V power using a linear power supply was a headache and wasteful. With a switching power supply, you can easily and efficiently deliver regulated power on demand.

Some bus standards provide access to just the CPU’s I/O space. Others allow adding memory, and, of course, some processors only allow memory-mapped I/O. Depending on the CPU and the complexity of the bus, cards may be able to interrupt the processor or engage in direct memory access independent of the CPU.

In addition to power, there are several things that tend to differentiate traditional parallel buses. Of course, power is one of them, as well as the number of bits available for data or addresses. Many bus structures are synchronous. They operate at a fixed speed, and in general, devices need to keep up. This is simple, but it can impose tight requirements on devices.

Continue reading “Catching Those Old Busses”

Illustrated Kristina with an IBM Model M keyboard floating between her hands.

Keebin’ With Kristina: The One With The Curious Keyboards

I love first builds! They say so much about a person, because you see what’s paramount to them in a keyboard. You can almost feel their frustration at other keyboards come through their design choices. And the Lobo by [no-restarts] is no exception to any of this.

There’s just something about this Corne-like object with its custom case and highly-tappable and variously tilted keycaps. The list of reasons for being begins innocently enough with [no-restarts] wanting a picture of their dog on the case.

A nicely-tented split keyboard with really interesting, 3D-printed keycap profiles.
Image by [no-restarts] via reddit
From there, things get really personal. You may notice the thumb cluster is slightly different — [no-restarts] doesn’t like the thumb tuck required by the Corne to reach the innermost keys. I really dig the homing bumps on the middle thumb keys. Another difference is the splayed layout, as [no-restarts] is especially prone to pinky splay. Finally, there are a pair of OLEDs hiding on the inner sides of the case, which are designed to be visible when tented.

Overall, [no-restarts] is happy with it, but has some ideas for revision. Yep, that sounds about right. The Lobo is all hand-wired, and there’s a PCB with hot swap sockets in its future. If you’re interested in the case files, GitHub is your friend.

Continue reading “Keebin’ With Kristina: The One With The Curious Keyboards”

Thorium-Metal Alloys And Radioactive Jet Engines

Although metal alloys is not among the most exciting topics for most people, the moment you add the word ‘radioactive’, it does tend to get their attention. So too with the once fairly common Mag-Thor alloys that combine magnesium with thorium, along with other elements, including zinc and aluminium. Its primary use is in aerospace engineering, as these alloys provide useful properties such as heat resistance, high strength and creep resistance that are very welcome in e.g. jet engines.

Most commonly found in the thorium-232 isotope form, there are no stable forms of this element. That said, Th-232 has a half-life of about 14 billion years, making it only very weakly radioactive. Like uranium-238 and uranium-235 it has the unique property of not having stable isotopes and yet still being abundantly around since the formation of the Earth. Thorium is about three times as abundant as uranium and thus rather hard to avoid contact with.

This raises the question of whether thorium alloys are such a big deal, and whether they justify removing something like historical artefacts from museums due to radiation risks, as has happened on a few occasions.

Continue reading “Thorium-Metal Alloys And Radioactive Jet Engines”

Pufferfish Venom Can Kill, Or It Can Relieve Pain

Tetrodotoxin (TTX) is best known as the neurotoxin of the puffer fish, though it also appears in a range of other marine species. You might remember it from an episode of The Simpsons involving a poorly prepared dish at a sushi restaurant. Indeed, it’s a potent thing, as ingesting even tiny amounts can lead to death in short order.

Given its fatal reputation, it might be the last thing you’d expect to be used in a therapeutic context. And yet, tetrodotoxin is proving potentially valuable as a treatment option for dealing with cancer-related pain. It’s a dangerous thing to play with, but it could yet hold promise where other pain relievers simply can’t deliver. Continue reading “Pufferfish Venom Can Kill, Or It Can Relieve Pain”

A Brief History Of The Spreadsheet

We noted that Excel turned 40 this year. That makes it seem old, and today, if you say “spreadsheet,” there’s a good chance you are talking about an Excel spreadsheet, and if not, at least a program that can read and produce Excel-compatible sheets. But we remember a time when there was no Excel. But there were still spreadsheets. How far back do they go? Continue reading “A Brief History Of The Spreadsheet”

Hackaday Links Column Banner

Hackaday Links: December 14, 2025

Fix stuff, earn big awards? Maybe, if this idea for repair bounties takes off. The group is dubbed the FULU Foundation, for “Freedom from Unethical Limitations on Users,” and was co-founded by right-to-repair activist Kevin O’Reilly and perennial Big Tech thorn-in-the-side Louis Rossman. The operating model works a bit like the bug bounty system, but in reverse: FULU posts cash bounties on consumer-hostile products, like refrigerators that DRM their water filters or bricked thermostats. The bounty starts at $10,000, but can increase based on donations from the public. FULU will match those donations up to $10,000, potentially making a very rich pot for the person or team that fixes the problem.

Continue reading “Hackaday Links: December 14, 2025”