SWO: An ARM Printf By Any Other Name

I’ll confess. Although printf-style debugging has a bad rep, I find myself turning to it on occasion. Sure, printf is expensive and brings in a lot of code, but if you have the space and time to use it while debugging you can always remove it before you are finished. However, what if you don’t have an output device or you are using it for something else? If you are using most modern ARM chips, you have another option — a dedicated output channel that is used for several things, including debugging output. I decided I wanted to try that on the Blackpill running mbed, and found out it isn’t as easy as you might think. But it is possible, and when you are done reading, you’ll be able to do it, too.

I’m writing this using the STM32-specific ST-LINK hardware. If you use other JTAG devices like the BlackMagic probe, you probably already have this set up for you.

What You Get

I’ll start backward with the end result, then talk about the software, so you’ll be good and motivated by the time you get to the hardware requirements. Spoiler alert: your existing hardware might need a quick hack to make it work, although you can buy something off the shelf if you prefer.

Here is a very simple test program:


SWO_Channel debugport;  // requires #include "SWO.h"
int main() 
  {
  unsigned count=0;
  debugport.printf("\r\nHello World from SWO\r\n");
  debugport.printf("CPU SystemCoreClock is %d Hz\r\n", SystemCoreClock);

  while (1) 
    {
    led = !led; // flip LED if output is true
    ThisThread::sleep_for(rate); // sleepy time
    if (count % 10) debugport.putc('*'); else debugport.printf("%d\r\n",count); 
    count++;
    }
}

Continue reading “SWO: An ARM Printf By Any Other Name”

The Joy Of Broadcast Media Vs. The Paradox Of Choice

The rise of streaming services on the Internet was a revolutionary shift when it came to the world of media. No more would content be pumped in to homes in a one-way fashion, broadcast by major conglomerates and government-run organizations. Instead, individuals would be free to hunt for content suiting their own desires on an all-you-can-watch basis.

It’s led to a paradigm shift in the way we consume media. However, it’s also led to immense frustration thanks to the overwhelming amount of content on offer.  Let’s take a look at why that is, and some creative ways you can get around the problem.

The Paradox of Choice

Many find the masses of content on streaming services to be overwhelming to choose from. Credit: author screenshot

Traditionally, when it came to media, there were two major arms of delivery: broadcast, and home media. One might listen to the radio, or flick on the TV, or alternatively, spin up a record, or select a movie to watch on tape. If none of those options  sufficed, one might take a walk down to the local video store to rent something more appealing.

Fundamentally, it was an era in which choices were limited. There were a handful of TV stations to choose from, and if nothing good was on, you could go as far as finding something watchable on tape or going without. Many will remember afternoons and evenings spent watching reruns or a Friday night movie that had been on a million times before. Some shows went as far as becoming legends for their seemingly endless replay, from The Simpsons to M*A*S*H. 

As the Internet grew, though, the game started to change. Torrent websites and streaming services came along, offering up the sum total of the world’s cultural output for free, or for a nominal cost for those averse to piracy. Suddenly when it came to choosing a movie to watch, one wasn’t limited to the five or so films on at the local cinema, nor what was left on the shelves at the local video rental. Instead, virtually any movie, from the invention of the format, could be yours to watch at a moment’s notice.

With so many options on the table, many of us find it harder to choose. It’s an idea popularly known as the Paradox of Choice, a term popularized by US psychologist Barry Schwartz in 2004. When our options are limited to a select few, choice is easy. They can quickly be compared and ranked and an ideal option chosen.

Add thousands of choices to the pile, and the job escalates in complexity to the point of becoming overwhelming. With so many different choices to contrast and compare, finding the mythical right choice becomes practically impossible. Continue reading “The Joy Of Broadcast Media Vs. The Paradox Of Choice”

Put Another Dime In The Jukebox

We don’t always acknowledge it, but most people have an innate need for music. Think of all the technology that brings us music. For decades, most of the consumer radio spectrum carried music. We went from records, to tape in various forms, to CDs, to pure digital. There are entire satellites that carry — mostly — music. Piracy aside, people are willing to pay for music, too. While it isn’t very common to see “jukeboxes” these days, there was a time when they were staples at any bar or restaurant or even laundrymat you happened to be in. For the cost of a dime, you can hear the music and share it with everyone around you.

Even before we could record music, there was something like a jukebox. Coin-operated machines, as you’ll recall, are actually very old. Prior to the 1890s, you might find coin-op player pianos or music boxes. These machines actually played the music they were set up to play using a paper roll with holes in it or metal disks or cylinders.

Early Days

That changed in 1890 when a pair of inventors connected a coin acceptor to an Edison phonograph. Patrons of San Francisco’s Palais Royale Saloon could put a hard-earned nickel in the slot and sound came out of four different tubes. Keep in mind there were no electronic amplifiers as we know them in 1890. Reportedly, the box earned $1,000 in six months.

Continue reading “Put Another Dime In The Jukebox”

Show Us Your Odd Inputs And Peculiar Peripherals!

Just as the Jedi youngling would have to build their light saber, so is it a rite of passage for a true geek to build their own computer interfaces. And nothing makes a personal computer more personal than a custom keyboard, a bespoke mouse, an omnipotent macropad, a snazzy jog wheel, or a fancy flight yoke.

In this contest, we encourage you to make your strangest, fanciest, flashiest, or most custom computer peripherals, and share that work with all the rest of us. Wired or wireless, weird or wonderful, we want to see it. And Digi-Key is sponsoring this contest to offer three winners an online shopping spree for $150 each at their warehouse! More parts, more projects.

Make It Yours

Anyone can just go out an buy a keyboard, but if you want a custom ergonomic keyboard that’s exactly fit to your own two hands, you probably have to make one with your own two hands. And if you an engraved brass mouse, well, you’ve got some engraving to do — Logitech ain’t gonna make one for you. Maybe you only type in binary, or maybe you need a keyboard for some alien language that has 450 individual letters. Or maybe the tiniest keyboard ever? You’ve got this. Continue reading “Show Us Your Odd Inputs And Peculiar Peripherals!”

Handling Bulk Material: Why Does My Cat Food Get Stuck?

Bulk material is stuff handled ‘in bulk’. One LEGO piece is a brick but 1,000 poured into a bag is bulk material. Corn starch, sand, flour, powder-coat powder, gravel, cat food, Cap’n Crunch, coins, screws, Styrofoam beads, lead shot, and gummy worms are bulk materials.

Applications abound where you need to move stuff in bulk. Selective sintering 3D printers, animal feeders, DIY injection molders, toner based PCB makers, home powder coating, automatic LEGO/domino/whatever sorters or assemblers, automated gardeners, airsoft accessories – handling bulk material is part of hacking. College science classes cover solids and liquids, but rarely bulk materials.

Most hackers just pray it works and tap the bin when it doesn’t. Industry does better, but the slang term “bin rash”, the long term result of tapping a 300 ton bin with sledgehammers (video),  shows they don’t get it right all the time either. At the same time, it’s a fun area you can experiment with using kitchen items. So come along with us for a short series on the basics of bulk material handling. Continue reading “Handling Bulk Material: Why Does My Cat Food Get Stuck?”

Vintage Pro Audio Hack Chat

Join us on Wednesday, May 25 at noon Pacific for the Vintage Audio Hack Chat with Frank Olson!

There was a time, and not all that long ago on the cosmic scale, that if you wanted to hear music, you either needed to make it yourself or hire someone to do it for you. For most of history, music was very much a here and now thing, and when the song was over, that was it.

Thankfully, those days are long gone, and for better or worse, we have instant access to whatever music we’re in the mood for. The Spotify client in your pocket is a far cry from the iPod of a few years back, or the Walkman of the 80s, or even a mid-century transistor radio. But no matter how you listen to your music, it all starts with getting the live music recorded, and that’s where we’ll be going with this Hack Chat.

join-hack-chatHooking up the preamps, mixers, mics, and recorders that make modern music possible is what Frank Olson is all about. You’ll probably recognize Frank’s name from his unique niche as a maker of wooden microphones, but dig a little deeper and he’s got a lot of experience with vintage pro audio gear. As both a musician and an audio engineer, Frank brings an enthusiast’s passion for recording gear to the Hack Chat, and we’re looking forward to picking his brain on the unique ways he’s found to turn sounds into music and to get to all down on tape.

Our Hack Chats are live community events in the Hackaday.io Hack Chat group messaging. This week we’ll be sitting down on Wednesday, May 25 at 12:00 PM Pacific time. If time zones have you tied up, we have a handy time zone converter.

Continue reading “Vintage Pro Audio Hack Chat”

Hackaday Links Column Banner

Hackaday Links: May 22, 2022

It looks like it’s soon to be lights out for the Mars InSight lander. In the two years that the lander has been studying the geophysics of Mars from its lonely post on Elysium Planitia, InSight’s twin solar arrays have been collecting dust, and now are so dirty that they’re only making about 500 watt-hours per sol, barely enough to run the science packages on the lander. And that’s likely to worsen as the Martian winter begins, which will put more dust in the sky and lower the angle of the Sun, reducing the sunlight that’s incident to the panels. Barring a “cleaning event” courtesy of a well-placed whirlwind, NASA plans to shut almost everything down on the lander other than the seismometer, which has already captured thousands of marsquakes, and the internal heaters needed to survive the cold Martian nights. They’re putting a brave face on it, emphasizing the continuing science and the mission’s accomplishments. But barely two years of science and a failed high-profile experiment aren’t quite what we’ve come to expect from NASA missions, especially one with an $800 million price tag.

Closer to home, it turns out there’s a reason sailing ships have always had human crews: to fix things that go wrong. That’s the lesson learned by the Mayflower Autonomous Ship as it attempted the Atlantic crossing from England to the States, when it had to divert for repairs recently. It’s not clear what the issue was, but it seems to have been a mechanical issue, as opposed to a problem with the AI piloting system. The project dashboard says that the issue has been repaired, and the AI vessel has shoved off from the Azores and is once more beating west. There’s a long stretch of ocean ahead of it now, and few options for putting in should something else go wrong. Still, it’s a cool project, and we wish them a fair journey.

Have you ever walked past a display of wall clocks at the store and wondered why someone went to the trouble of setting the time on all of them to 10:10? We’ve certainly noticed this, and always figured it had something to do with some obscure horological tradition, like using “IIII” to mark the four o’clock hour on clocks with Roman numerals rather than the more correct “IV”. But no, it turns out that 10:10 is more visually pleasing, and least on analog timepieces, because it evokes a smile on a human face. The study cited in the article had volunteers rate how pleasurable watches are when set to different times, and 10:10 won handily based on the perception that it was smiling at them. So it’s nice to know how easily manipulated we humans can be.

If there’s anything more pathetic than geriatric pop stars trying to relive their glory days to raise a little cash off a wave of nostalgia, we’re not sure what it could be. Still, plenty of acts try to do it, and many succeed, although seeing what time and the excesses of stardom have wrought can be a bit sobering. But Swedish megastars ABBA appear to have found a way to cash in on their fame gracefully, by sending digital avatars out to do their touring for them. The “ABBA-tars,” created by a 1,000-person team at Industrial Light and Magic, will appear alongside a live backing band for a residency at London’s Queen Elizabeth Olympic Park. The avatars represent Benny, Bjorn, Agnetha, and Anni-Frid as they appeared in the 1970s, and were animated thanks to motion capture suits donned while performing 40 songs. It remains to be seen how fans will buy into the concept, but we’ll say this — the Swedish septuagenarians look pretty darn good in skin-tight Spandex.

And finally, not that it has any hacking value at all, but there’s something shamefully hilarious about watching this poor little delivery bot getting absolutely wrecked by a train. It’s one of those food delivery bots that swarm over college campuses these days; how it wandered onto the railroad tracks is anyone’s guess. The bot bounced around a bit before slipping under the train’s wheels, with predictable results once the battery pack is smooshed.