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”

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!”

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.

One Solution, Many Problems

You might think you’re lucky when one of your problems has multiple solutions, and you get to pick and choose, but you’re even luckier when one solution has many problems! This week I stumbled on an old solution in a new place. The project was a fantastic old MIDI guitar build, the Tryndelka by [Aleksandr Goltsov]. And the old solution? Switch matrix diodes.

You see, [Aleksandr] is making an electric guitar where the strings are pulled up to a certain voltage and then make contact with metal frets. Each fret is cut into six pieces, so that the strings can be read out individually, and the microcontroller scans each string in succession to test if it’s pressed down or not. Done, right? Wrong! The problem comes when two or more strings are pressed at once — the electrical path from the string you want will travel through the closed switch on a string that you’re not scanning. The solution is a ton of diodes.

I learned this problem the hard way in wiring up a MAME cabinet, at about 3 A.M. the night before we were going to bring it to Shmoocon. We finally got the whole USB/button code working, so we played some celebratory rounds of Street Fighter. We eventually noticed that hitting one button, or even moving the joystick in a particular direction, would block some of the other buttons from working, or change their function entirely. Quick Internet search later, and we were hand soldering 64 diodes until dawn. Good times!

But the fact that switch matrices need diodes, and exactly why, is forevermore burned in my brain. It’s fun to see it pop up in all sorts of contexts, from DIY keyboards to MIDI guitars, to Charliplexing. (It’s the “D” in LED!) It’s one of the classics — a solution to many problems.

Hackaday Podcast 169: 3D Printing In Vase Mode, Measuring Nanovolts Through Mega DIY, And The Softest Pants Are Software Pants

Join Hackaday Editor-in-Chief Elliot Williams and Assignments Editor Kristina Panos as we take a tour of our top hacks from the past week. Elliot brought some fairly nerdy fare to the table this time, and Kristina pines for physical media as we discuss the demise of the iPod Touch, the last fruit-flavored mp3-playing soldier to fall.

But first, we talk about a why-didn’t-I-think-of-that 3D printing hack that leverages vase mode into something structural. We’ll take a look inside a see-through cyberdeck made from laptop parts, marvel over the minuscule voltages that can be picked up with a bit of meticulous meter design, and chew the fat about old rotary phones.

We also put in some overtime discussing a cheap fix for an expensive time card clock part, and rock out to a guitar that can use various things for its resonant cavity. Finally, Elliot questions the difference between software and firmware when it comes to hiding your dirty secrets, and Kristina bloviates about see-through electronics and music appreciation using whatever format you can afford.

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 below!

Direct Download link

Continue reading “Hackaday Podcast 169: 3D Printing In Vase Mode, Measuring Nanovolts Through Mega DIY, And The Softest Pants Are Software Pants”