C++17’s Useful Features For Embedded Systems

Although the world of embedded software development languages seem to span somewhere between ASM and C89 all the way to MicroPython, there is a lot to be said for a happy medium between ease of development and features that makes the software more robust without adding overhead or bloat to the final firmware image.

This is where C++ has objectively many advantages over even C99, and as [Çağlayan Dökme] argues in a recent blog post C++17 adds many developer critter comforts to C++98 and the more recent C++11 C++14 standards.

First stepping back a generation (technically two, with C++20 also being a thing already), the addition of binary literals (e.g. 0b1010'1100) in C++14 and the expanded use of constexpr is addressed, with the latter foreshadowing C++17’s increased focus on compile time optimizations. A new attribute in C++17 that is part of this is [[nodiscard]], which when added before to the return type of a function or method requires the return value to be used in some manner, much like with functions in Ada (contrasted with procedures).

As [Çağlayan] notes, the biggest strength of compile-time checks is that it can save a lot of deploy-test-fix round-trips, with the total number of issues caught after deployment that could have been caught during compilation ideally being zero. Here C++17 streamlines the static_assert() mechanism and simplifies using if constexpr to instantiate code depending on compile-time conditions. Beyond compile-time optimizations there are a few other niceties, such as C++17 guaranteeing copy elision (return value optimization) when an object is returned directly, which is a welcome feature in hard real-time environments.

With today even MCUs having enough grunt to run multi-threaded applications and potentially firmware compiled from a many-thousand LoC codebase, picking a programming language that assists the developer with such an arduous task is very important, with Ada being the primary choice for high-reliability embedded platforms, but C++ along with C enjoying the most widespread (free) compiler support. Even if C++ isn’t supported on every single MCU out there (8051-based and most PIC MCUs mostly), whenever it is an option, it’s a pretty solid choice, especially with knowledge of these new language features.

The MOS CIA Lives On, In 74HCT

It’s always pleasing to see a project we covered in its early stages reach maturity, so were very happy to bring you an update on [Daniel Molina]’s 74HCT6526. It’s a long-running effort to produce in 74 logic a faithful replica of the MOS Technologies CIA, the integrated I/O and timer chip found in so many of the 1980s Commodore machines. When we first covered it there was only one PCB, now the project has grown to a stack of three, with the remaining functions intended to fit on two more boards.

It was very common at the time for chips such as the CIA to integrate a set of common 8-bit peripherals onto one piece of silicon, both in general purpose with almost all functions of the original now implemented. hips and in more manufacturer specific parts such as this one. A project like this one is valuable because it provides a dive into the now less-common  world of interfacing directly to a microprocessor data and address line. It’s unlikely that many Commodore 64s will end up with this stack of boards inside them, but it’s not impossible the design may help a few old machines when put on an FPGA.

Meanwhile, remember it’s not the only custom 1980s home computer chip replaced with 74 logic.

What Is A Schumann Resonance And Why Am I Being Offered A 7.83Hz Oscillator?

Something that probably unites many Hackaday readers is an idle pursuit of browsing AliExpress for new pieces of tech. Perhaps it’s something akin to social media doomscrolling without the induced anger, and it’s certainly entertaining to see some of the weird and wonderful products that can be had for a few dollars and a couple of weeks wait. Every now and then something pops up that deserves a second look, and it’s one of those that has caught my attention today. Why am I being offered planar PCB coils with some electronics, described as “Schumann resonators”? What on earth is Schumann resonance, anyway? Continue reading “What Is A Schumann Resonance And Why Am I Being Offered A 7.83Hz Oscillator?”

Hackaday Podcast 218: Open Source AI, The Rescue Of Salyut 7, The Homework Machine

This week, Editor-in-Chief Elliot Williams and Kristina Panos have much in the way of Hackaday news — the Op Amp Challenge is about halfway over, and there are roughly three weeks left in the Assistive Tech challenge of the 2023 Hackaday Prize. Show us what you’ve got on the analog front, and then see what you can do to help people with disabilities to live better lives!

Kristina is still striking out on What’s That Sound, which this week honestly sounded much more horrendous and mechanical than the thing it actually is. Then it’s on to the hacks, beginning with the we-told-you-so that even Google believes that open source AI will out-compete both Google’s own AI and the questionably-named OpenAI.

From there we take a look at a light-up breadboard, listen to some magnetite music, and look inside a pair of smart sunglasses. Finally, we talk cars, beginning with the bleeding edge of driver-less. Then we go back in time to discuss in-vehicle record players of the late 1950s.

Check out the links below if you want to follow along, and as always, tell us what you think about this episode in  the comments!

Download and savor at your leisure.

Continue reading “Hackaday Podcast 218: Open Source AI, The Rescue Of Salyut 7, The Homework Machine”

OScope Advert From 1987 Rocks It

We can’t remember ever seeing a late-night TV ad for oscilloscopes before but, for some reason, Tektronix did produce a video ad in 1987. You can see it below and enjoy the glorious music and video production standards of the 1980s.

We assume this was made to show at some trade show or the like. Even if there was a Home Shopping Network in 1987, we doubt many of these would have been sold despite the assertion they were “low cost” — clearly a relative term in this case.

You’ve got to wonder if the narrator understood what he was saying or if he was just reading from a script. Pretty impressive either way. We loved these old scopes, although we also like having very capable scopes that don’t strain our backs to lift.

On the bright side, these scopes today are pretty affordable on the used market if you can find one that doesn’t need a repair with an exotic part. For example, we found several 2221s or 2221As for under $200 without looking hard. The shipping, of course, could potentially almost double the price.

While you can get a modern scope for $200, it probably isn’t the same quality as a Tektronix. Then again, the new scope won’t have CRTs and exotic Tektronix parts to wear out, either. Picking a scope is a pretty personal affair, though, so one person’s great scope might be another person’s piece of junk.

Continue reading “OScope Advert From 1987 Rocks It”

Hackaday Links Column Banner

Hackaday Links: May 7, 2023

More fallout for SpaceX this week after their Starship launch attempt, but of the legal kind rather than concrete and rebar. A handful of environmental groups filed the suit, alleging that the launch generated “intense heat, noise, and light that adversely affects surrounding habitat areas and communities, which included designated critical habitat for federally protected species as well as National Wildlife Refuge and State Park lands,” in addition to “scatter[ing] debris and ash over a large area.”

Specifics of this energetic launch aside, we always wondered about the choice of Boca Chica for a launch facility. Yes, it has all the obvious advantages, like a large body of water directly to the east and being at a relatively low latitude. But the whole area is a wildlife sanctuary, and from what we understand there are still people living pretty close to the launch facility. Then again, you could pretty much say the same thing about the Cape Canaveral and Cape Kennedy complex, which probably couldn’t be built today. Amazing how a Space Race will grease the wheels of progress.

Continue reading “Hackaday Links: May 7, 2023”

A 7 GHz Signal Analyser Teardown And A Trivial Repair

[Shahriar] of The Signal Path is back with another fascinating video teardown and analysis for your viewing pleasure. (Embedded below.) This time the target is an Agilent E5052A 7 GHz signal Source/Analyser which is an expensive piece of kit not many of us are fortunate enough to have on the bench. This particular unit is reported as faulty, with a signal power measurement that is completely off-the-rails wrong, which leads one to not trust anything the instrument reports.

After digging into the service manual of the related E5052B unit, [Shahriar] notes that the phase noise measurement part of the instrument is totally separate from the power measurement, only connected via some internal resistive power splitters, and this simplifies debugging a lot. But first, a short segue into that first measurement subsystem, because it’s really neat.

Cross-correlating time-gated FFT (TG-FFT) subsystem at the top, dodgy power detector at the bottom

A traditional swept-mode instrument works by mixing the input signal with a locally-sourced low-noise oscillator, which when low-pass filtered, is fed into a power meter or digitizer. This simply put, down-converts the signal to something easy to measure. It then presents power or noise as a function of the local oscillator (LO) frequency, giving us the spectral view we require. All good, but this scheme has a big flaw. The noise of the LO is essentially added to that of the signal, producing a spectral noise floor below which signals cannot be resolved.

The E5052 instrument uses a cunning cross-correlation technique enabling it to measure phase noise levels below that of its own internal signal source. The instrument houses an Oven-Compensated Crystal Oscillator (OCXO) for high stability, in fact, two from two different vendors, one for each LO, and mounted perpendicular to each other. The technique splits the input signal in half with a power splitter, then feeds both halves into identical (apart from the LOs) down-converters, the outputs of which are fed into a DSP via a pair of ADCs. Having identical input signals, but different LOs (with different phase noise spectra) turns the two signals from a correlated pair to an uncorrelated pair, with the effects of chassis vibration and gravity effects also rolled in.

The DSP subtracts the uncorrelated signal from the correlated signal, therefore removing the effect of the individual LO’s effect on the phase noise spectrum. This clever technique results in a phase noise spectrum below that of the LOs themselves, and a good representation of the input signal being measured.

This is what a DC-7GHz resistive power divider looks like. Notice the inductive matching section before each resistor branch.

Handily for [Shahriar] this complex subsystem is totally separate from the dodgy power measurement. This second system is much simpler, being fed with another copy of the input signal, via the main resistive power splitter. This second feed is then split again with a custom power divider, which upon visual inspection of the input SMA connector was clearly defective. It should not wobble. The root cause of the issue was a cold solder joint of a single SMA footprint, which worked loose over time. A little reflow and reassembly and the unit was fit for recalibration, and back into service.

We’ve seen phase noise measurements a few times on these pages, like debugging this STM32 PLL issue.

Continue reading “A 7 GHz Signal Analyser Teardown And A Trivial Repair”