Test Your ‘Blue Pill’ Board For A Genuine STM32F103C8 MCU

With the market for STM32F103C8-based ‘Blue Pill’ boards slowly being overrun with boards that contain either a cloned, fake or outright broken chip, [Terry Porter] really wanted to have an easy, automated way to quickly detect whether a new board contains genuine STM32 silicon, or some fake that tries to look the part. After more than a year of work, the Blue Pill Diagnostics project is now ready for prime time.

We have covered those clone MCUs previously. It’s clear that some of those ‘Blue Pill’ boards obviously do not have a genuine STM32 MCU on them, as they do not have the STM32 markings on them, while others fake those markings on the package and identifying can be hard to impossible. Often only testing the MCU’s actual functionality can give clarity on whether it’s a real STM32 MCU.

These diagnostics allow one to test not only the 64 kB of Flash, but also the 64 kB of ‘hidden’ Flash that’s often found on these MCUs (rebadged 128 kB STM32F103 cores). It further checks the manufacturer JDEC code and uses a silicon bug in genuine STM32F1xx MCUs where the BGMCU_IDCODE cannot be read without either SWD or JTAG connected.

Another interesting feature of Blue Pill Diagnostics is using Mecrisp-Stellaris Forth as its foundation, which allows for easy access to a Forth shell via this firmware as well, not unlike MicroPython and Lua, only in a fraction of the Flash required by those. We have previously written about using Mecrisp-Stellaris in your projects.

Blue Pill Vs Black Pill: Transitioning From STM32F103 To STM32F411

For many years now, the so-called ‘Blue Pill’ STM32 MCU development board has been a staple in the hobbyist community. Finding its origins as an apparent Maple Mini clone, the diminutive board is easily to use in breadboard projects thanks to its dual rows of 0.1″ pin sockets. Best of all, it only costs a few bucks, even if you can only really buy it via sellers on AliExpress and EBay.

Starting last year, boards with a black soldermask and an STM32F4 Access (entry-level) series MCUs including the F401 and F411 began to appear. These boards with the nickname ‘Black Pill’ or ‘Black Pill 2’. F103 boards also existed with black soldermask for a while, so it’s confusing. The F4xx Black Pills are available via the same sources as the F103-based Blue Pill ones, for a similar price, but feature an MCU that’s considerably newer and more powerful. This raises the question of whether it makes sense at this point to switch to these new boards.

Our answer is yes, but it’s not entirely clearcut. The newer hardware is better for most purposes, really lacking only the F103’s dual ADCs. But hardware isn’t the only consideration; depending on one’s preferred framework, support may be lacking or incomplete. So let’s take a look at what it takes to switch. Continue reading “Blue Pill Vs Black Pill: Transitioning From STM32F103 To STM32F411”

Whither The Chip Shortage?

Do you remember the global chip shortage? Somehow it seems so long ago, but it’s not even really been three years yet. Somehow, I had entirely forgotten about it, until two random mentions about it popped up in short succession, and brought it all flooding back like a repressed bad dream.

Playing the role of the ghost-of-chip-shortage-past was a module for a pair of FPV goggles. There are three versions of the firmware available for download at the manufacturer’s website, and I had to figure out which I needed. I knew it wasn’t V1, because that was the buggy receiver PCB that I had just ordered the replacement for. So it was V2 or V3, but which?

Digging into it, V2 was the version that fixed the bug, and V3 was the redesign around a different microcontroller chip, because they couldn’t get the V2 one during the chip shortage.

I saw visions of desperate hackers learning new toolchains, searching for alternative parts, finding that they could get that one chip, but that there were only 20 of them left and they were selling for $30 instead of $1.30. I know a lot of you out there were designing through these tough couple years, and you’ve all probably got war stories.

And yet here we are, definitively post-chip-shortage. How can you be sure? A $30 vape pen includes a processor that we would have killed for just three years ago. The vape includes a touchscreen, just because. And it even has a Bluetooth LE chip that it’s not even using. My guess is that the hardware designers just put it in there hoping that the firmware team would get around to using it for something.

This vape has 16 MB of external SPI Flash! During the chip shortage, we couldn’t even get 4 MB SPI flash.

It’s nice to be on the other side of the chip shortage. Just order whatever parts you want and you get them, but don’t take for granted how luxurious that feels. Breathe easy, and design confidently. You can finally use that last genuine STM32F103 blue pill board without fear of it being the last one on earth.

(Featured image is not an actual photo of the author, although he does sometimes have that energy.)

Bare Metal STM32: The Various Real Time Clock Flavors

Keeping track of time is essential, even for microcontrollers, which is why a real-time clock (RTC) peripheral is a common feature in MCUs. In the case of the STM32 family there are three varieties of RTC peripherals, with the newest two creatively called ‘RTC2′ and RTC3’, to contrast them from the very basic and barebones RTC that debuted with the STM32F1 series.

Commonly experienced in the ubiquitous and often cloned STM32F103 MCU, this ‘RTC1’ features little more than a basic 32-bit counter alongside an alarm feature and a collection of battery-backed registers that requires you to do all of the heavy lifting of time and date keeping yourself. This is quite a contrast with the two rather similar successor RTC peripherals, which seem to insist on doing everything possible themselves – except offer you that basic counter – including giving you a full-blown calendar and today’s time with consideration for 12/24 hour format, DST and much more.

With such a wide gulf between RTC1 and its successors, this raises the question of how to best approach these from a low-level perspective.

Continue reading “Bare Metal STM32: The Various Real Time Clock Flavors”

It’s MIDI For The TRS-80!

The Radio Shack TRS-80 was a much-loved machine across America. However, one thing it lacked was MIDI. That’s not so strange given the era it was released in, of course. Nevertheless, [Michael Wessel] has seen fit to correct this by creating the MIDI/80—a soundcard and MIDI interface for this old-school beast.

The core of the build is a BluePill STM32F103C8T6 microcontroller, running at a mighty 75 MHz. Plugged into the TRS-80s expansion port, the microcontroller is responsible for talking to the computer and translating incoming and outgoing MIDI signals as needed. Naturally, you can equip it with full-size classic DIN sockets for MIDI IN and MIDI OUT using an Adafruit breakout module. None of that MIDI Thru nonsense, though, that just makes people uncomfortable. The card is fully capable of reproducing General MIDI sounds, too, either via plugging in a Waveblaster sound module to the relevant header, or by hooking up a Roland Sound Canvas or similar to the MIDI/80s MIDI Out socket. Software-wise, there’s already a whole MIDI ecosystem developing around this new hardware. There’s a TRS-80 drum tracker and a synthesizer program, all with demo songs included. Compatibility wise, The MIDI/80 works with the TRS-80 Model I, III, and 4.

Does this mean the TRS-80 will become a new darling of the tracker and chiptune communities? We can only hope so! Meanwhile, if you want more background on this famous machine, we’ve looked into that, too. Video after the break.

Continue reading “It’s MIDI For The TRS-80!”

It’s SSB, But Maybe Not Quite As You Know It

Single Sideband, or SSB, has been the predominant amateur radio voice mode for many decades now. It has bee traditionally generated by analogue means, generating a double sideband and filtering away the unwanted side, or generating 90 degree phase shifted quadrature signals and mixing them. More recent software-defined radios have taken this into the CPU, but here’s [Georg DG6RS] with another method. It uses SDR techniques and a combination of AM and FM to achieve polar modulation and generate SSB. He’s provided a fascinating in-depth technical explanation to help understand how it works.

The hardware is relatively straightforward; an SI5351 clock generator provides the reference for an ADF4351 PLL and VCO, which in turn feeds a PE4302 digital attenuator. It’s all driven from an STM32F103 microcontroller which handles the signal processing. Internally this means conventionally creating I and Q streams from the incoming audio, then an algorithm to generate the phase and amplitude for polar modulation. These are fed to the PLL and attenuator in turn for FM and AM modulation, and the result is SSB. It’s only suitable for narrow bandwidths, but it’s a novel and surprisingly simple deign.

We like being presented with new (to us at least) techniques, as it never pays to stand still. Meanwhile for more conventional designs, we’ve got you covered.

A Digital Replacement For Your Magic Eye

Magic Eye tubes were popular as tuning guides on old-school radio gear. However, the tubes, the 6U5 model in particular, have become rare and remarkably hard to come by of late. When the supply dried up, [Bjørner Sandom] decided to build a digital alternative instead.

The build relies on a small round IPS display, measuring an inch in diameter and with a resolution of 128×115 pixels. One can only presume it’s round but not perfectly so. It was then fitted with a 25mm glass lens in order to give it a richer, deeper look more akin to a real Magic Eye tube. In any case, a STM32F103CBT was selected to drive the display, with the 32-bit ARM processor running at a lovely 72 MHz for fast and smooth updates of the screen.

The screen, controller, and supporting circuitry are all built onto a pair of PCBs and installed in a 3D-printed housing that lives atop a tube base. The idea is that the build is a direct replacement for a real 6U5 tube. The STM32 controller receives the automatic gain control voltage from the radio set it’s installed in, and then drives the screen to behave as a real 6U5 tube would under those conditions.

By virtue of the smart design, smooth updates, and that nifty glass lens, the final product is quite a thing to behold. It really does look quite similar to the genuine article. If you’ve got a beloved old set with a beleagured magic eye, you might find this a project worth replicating. Video after the break.

Continue reading “A Digital Replacement For Your Magic Eye”