<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-CA">
  <title>Ferrite blog</title>
  <subtitle>News from Ferrite, free radio firmware with its source public.</subtitle>
  <link href="https://blog.ferritefw.dev/feed.xml" rel="self"/>
  <link href="https://blog.ferritefw.dev/"/>
  <updated>2026-11-17T00:00:00Z</updated>
  <id>https://blog.ferritefw.dev/</id>
  <author><name>Alex Harvey</name></author>
  <entry>
    <title>Because mAh count</title>
    <link href="https://blog.ferritefw.dev/because-mah-count/"/>
    <updated>2026-11-17T00:00:00Z</updated>
    <id>https://blog.ferritefw.dev/because-mah-count/</id>
    <summary>At rest, stock draws about 130 mA. Ferrite draws 18.6. Here&#39;s where the other 111 went.</summary>
    <content type="html">&lt;p&gt;A handheld spends most of its life waiting: squelch closed, nobody talking. Sitting idle like that, the RT-950 Pro on
stock firmware draws about 130 mA. On Ferrite it draws 18.6 mA. Same radio, same battery, about 15 hours against 107.&lt;/p&gt;
&lt;p&gt;No single trick does that. It&#39;s a lot of small ones, and one big one I haven&#39;t seen in radio firmware before.&lt;/p&gt;
&lt;h2&gt;The big one: 24 MHz until something needs it&lt;/h2&gt;
&lt;p&gt;Your phone changes its processor speed all the time. Handheld radios don&#39;t: stock sets the radio&#39;s AT32F403A (an ARM
Cortex-M4) to 120 MHz at power-on and leaves it there, decoding a packet or sitting on a dead channel at 3 a.m.&lt;/p&gt;
&lt;p&gt;Ferrite runs it at 24 MHz at rest and goes to 120 MHz only while something asks: a key or the knob, a scan or the band
scope, transmit, a decoder hearing a signal, a live link to Ferrite Console, audio playing. A second after the last
request, it drops back. The rule for anything we weren&#39;t sure about was &amp;quot;if unsure, high&amp;quot;. A slow menu is annoying; a
missed packet is a bug.&lt;/p&gt;
&lt;p&gt;The hard part is everything hanging off the clock. Serial rates, GPS, the backlight timers and the system clock all
divide down from it, so every driver asks for the current speed, and the clock is corrected across each switch so it
never drifts. That one change took the resting current from 64.7 mA to 18.6, about 71 % off.&lt;/p&gt;
&lt;h2&gt;The small ones&lt;/h2&gt;
&lt;p&gt;The other 65 mA came from going through the board one part at a time and asking &amp;quot;does this need to be on?&amp;quot;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;The keypad light dims.&lt;/strong&gt; Stock&#39;s is on or off at full brightness. Ferrite drives it with PWM (switching it on and
off 25,000 times a second, faster than you can see) at half the screen&#39;s brightness, and turns it off with the
screen unless you ask otherwise.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The screen controller sleeps&lt;/strong&gt; when the backlight goes dark: about 7 mA on its own.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GPS is really off when it&#39;s off.&lt;/strong&gt; The module&#39;s power was cut, but one of the processor&#39;s pins still sat high and
fed it through its receive line. That pin now goes quiet too.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unused parts are unclocked:&lt;/strong&gt; serial ports, the audio timers, the broadcast receiver chip (held in reset), the
processor&#39;s own temperature sensor (powered only for its reading every 10 seconds).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No input pin floats.&lt;/strong&gt; A floating pin wanders and burns current; every one is pulled or parked.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The keys and knob are read less often&lt;/strong&gt; while the screen is dark, and the screen redraws live meters at most
four times a second at rest.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Battery Save&lt;/strong&gt; naps the receive chips between checks for a signal, as stock does.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;None of these is dramatic alone. Together they halved stock&#39;s figure before the clock change.&lt;/p&gt;
&lt;h2&gt;The numbers&lt;/h2&gt;
&lt;p&gt;Ferrite on my black test radio, with the bench supply (a FNIRSI DPS-150P at 7.6 V) counting the charge itself over
15 minutes a run: squelch closed on a quiet channel, screen dark, GPS and Bluetooth off.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Firmware&lt;/th&gt;
&lt;th&gt;At rest&lt;/th&gt;
&lt;th&gt;On a 2000 mAh pack&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Stock&lt;/td&gt;
&lt;td&gt;about 130 mA&lt;/td&gt;
&lt;td&gt;about 15 h&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ferrite, clock fixed at 120 MHz&lt;/td&gt;
&lt;td&gt;64.7 mA&lt;/td&gt;
&lt;td&gt;31 h&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ferrite, 24 MHz until needed&lt;/td&gt;
&lt;td&gt;18.6 mA&lt;/td&gt;
&lt;td&gt;107 h&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;That&#39;s the best case. A lit screen, keys and scanning cost what they cost, so real use sits above it, and we haven&#39;t
measured typical use yet. It&#39;s all on by default; MENU 0 9 9 4 (MCU clock) pins full speed if you&#39;d rather.&lt;/p&gt;
&lt;p&gt;Ferrite is free, with its source public. &lt;a href=&quot;https://ferritefw.dev/download/&quot;&gt;Get it here&lt;/a&gt;, and if your battery lasts longer
than you expected, tell us on the &lt;a href=&quot;https://discord.gg/fYygBVD2Kx&quot;&gt;Discord&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Why Ferrite is Rust(ing)</title>
    <link href="https://blog.ferritefw.dev/why-rust/"/>
    <updated>2026-11-15T00:00:00Z</updated>
    <id>https://blog.ferritefw.dev/why-rust/</id>
    <summary>Almost every radio firmware on Earth is C. Ferrite is Rust. Here&#39;s why.</summary>
    <content type="html">&lt;p&gt;Almost every radio firmware on Earth is written in C. The chip vendors ship C. The examples are C. The forum posts from
2011 that you end up reading at midnight are C. When you&#39;ve got 96 KB of RAM and no operating system, C is what you
reach for without thinking.&lt;/p&gt;
&lt;p&gt;So naturally, I wrote Ferrite in Rust.&lt;/p&gt;
&lt;p&gt;Before you close the tab: this isn&#39;t a &amp;quot;rewrite it in Rust&amp;quot; sermon. I picked it before a single line of Ferrite
ran on the radio, for boring, practical reasons. They just happen to be very good boring, practical reasons.&lt;/p&gt;
&lt;h2&gt;It&#39;s a computer. With a transmitter.&lt;/h2&gt;
&lt;p&gt;Pop the back off a Radtel RT-950 Pro and you&#39;ll find an Artery AT32F403A (a Cortex-M4 rated for 240 MHz; Ferrite
runs it at up to 120), 96 KB of RAM, two Beken BK4829 transceiver chips and an SI4732 for broadcast and shortwave.
That little M4 decides what frequency the transmitter keys up on, how hard, and for how long.&lt;/p&gt;
&lt;p&gt;Most software bugs give you a crash dialog. Radio firmware bugs give you a carrier on the wrong frequency, and
possibly a polite email from someone with a direction-finding antenna.&lt;/p&gt;
&lt;p&gt;So I wanted the meanest compiler I could find. Rust&#39;s will flat out refuse to build a whole family of classic
firmware bugs: memory used after it&#39;s gone, two tasks scribbling on the same thing at once, the &lt;code&gt;match&lt;/code&gt; that forgot
a case. Every one of those is a bug I never had to hunt down.&lt;/p&gt;
&lt;h2&gt;The bench is a time suck&lt;/h2&gt;
&lt;p&gt;Here&#39;s the loop for radio firmware: build an image, flash it through the stock bootloader over the programming
cable, then go test it on a real radio with a real signal. Minutes, every single time. The flash alone is about 85
seconds of staring at a progress bar, which is exactly one cup of coffee if you don&#39;t stop to let it cool.&lt;/p&gt;
&lt;p&gt;A bug the compiler catches costs seconds. A bug the bench catches costs another coffee. A bug the bench &lt;em&gt;doesn&#39;t&lt;/em&gt;
catch costs a lot more than that. So a strict compiler is worth its weight in gold: it&#39;s the grumpiest code
reviewer I&#39;ve ever had, it reviews every line, and if it compiles, a lot of things are already true.&lt;/p&gt;
&lt;h2&gt;A third heavier, and worth it&lt;/h2&gt;
&lt;p&gt;Before I committed to it, I ported my first C test image to Rust, feature for feature. The Rust build came out about a
third bigger. The radio has the room, and I&#39;ll trade bytes for bugs-that-can&#39;t-happen any day.&lt;/p&gt;
&lt;p&gt;Size still bites, though. One innocent extra branch in a drawing routine got copied into every screen that draws,
and fixing it gave back 19,312 bytes. Nineteen thousand, three hundred and twelve bytes. For an if-statement. How
we keep Ferrite lean is a post of its own: the Rust diet.&lt;/p&gt;
&lt;h2&gt;Ferrite runs everywhere&lt;/h2&gt;
&lt;p&gt;Being able to test and simulate the radio on my desk was one of the big reasons for Rust. Everything above the
registers builds for a PC as well as for the radio, so thousands of tests run before anything gets flashed, the
screen recordings on this site are the firmware&#39;s own drawing code, and Ferrite Console runs the radio&#39;s own code
in your browser. More on this in a future blog post.&lt;/p&gt;
&lt;h2&gt;Naps are free&lt;/h2&gt;
&lt;p&gt;Under the hood it&#39;s &lt;a href=&quot;https://embassy.dev/&quot;&gt;Embassy&lt;/a&gt;, an async framework built for exactly this kind of chip. The radio,
the screen, the keys, APRS and GPS are each a task that naps until there&#39;s work to do. And when everything&#39;s
napping, Ferrite drops the core from 120 MHz all the way down to 24 MHz.&lt;/p&gt;
&lt;p&gt;Sitting on a quiet channel, the stock firmware draws over 100 mA. Ferrite was built around power from the start,
switching off everything it isn&#39;t using, and that alone gets it to 64.7 mA with the clock pinned at full speed. Let
the core nap at 24 MHz and it&#39;s 18.6 mA. That&#39;s about 107 hours on the stock battery pack. My exact words when the
number came in were &amp;quot;this is massive&amp;quot;, and I&#39;m sticking with them. (Fair warning: resting is the best case.
Scanning, mashing keys and APRS bring the clock back up while they run.)&lt;/p&gt;
&lt;h2&gt;Out now&lt;/h2&gt;
&lt;p&gt;Ferrite 0.9 is out: free, with its source public. &lt;a href=&quot;https://ferritefw.dev/download/&quot;&gt;Get it here&lt;/a&gt;, &lt;a href=&quot;https://ferritefw.dev/features/&quot;&gt;go see what it does&lt;/a&gt;, and stick
around here. There&#39;s a lot more bench work to write up, and some of it involves a bladeRF and questionable life
choices.&lt;/p&gt;
</content>
  </entry>
</feed>
