UController Code Profiler Debugs Your Microcontroller

When working on digital circuits that operate at high frequencies it helps to have some special tools on hand. Things like oscilloscopes and logic analyzers are priceless when something isn’t working right. Another great tool would be this hardware-based profiler that [Mike] came up with while he was working on another project.

The profiler connects to USB and shows up as a serial port. Normally [Mike] used a set of LEDs to get information about how his microcontrollers work, but for this project that wasn’t enough. The uController Code Profiler can provide the main loop running time, time functions and sections of code, keep track of variables, and a few other tasks as well, all with nanosecond resolution.

The source code isn’t provided but a hex file is available, along with a schematic and an include file, if you want to try this one out on your next project. Like this homemade logic analyzer, this could be a powerful tool in your microcontroller arsenal. Simply include the file with various pieces of your code to get it up and running!

Review: DSLogic Logic Analyzer

Logic analyzers historically have been the heavy artillery in an engineer’s arsenal. For many of us, the name invokes mental images of large HP and Tektronix iron with real CRT screens. Logic connections were made through pods, with hundreds of leads weaving their way back to the test equipment. The logic analyzer came out when all else failed, when even a four channel scope wasn’t enough to figure out your problems. Setting them up was a pain – if you were lucky, the analyzer had a PC keyboard interface. If not, you were stuck typing your signal names into the front panel keyboard. Once setup though, logic analyzers were great at finding bugs. You can see things you’d never see with another tool – like a data bus slowly settling out after the read or write strobe.

There have been a number of USB based logic analyzers introduced in recent years, but they didn’t really catch on until Saleae released their “Logic” line of devices. Low cost, high-speed, and easy to use – these devices were perfect. They also inspired an army of clone devices based upon the same Cypress Semiconductor parts. DSLogic designed by DreamSource Labs, can be thought of as an open source evolution of the original Saleae device.

DSLogic appeared in 2013 as a Kickstarter campaign for an open source logic analyzer with an optional oscilloscope extension. I think it’s safe to say that they did well, raising $111,497 USD, more than 10 times their initial goal of $10,000 USD. These days both the DSLogic and the oscilloscope extension are available at The Hackaday Store. In this review we’re focusing on the logic analyzer portion of the tool. 

Click past the break for the full story!

Continue reading “Review: DSLogic Logic Analyzer”

Hackaday Prize Entry: A BeagleBone Logic Analyzer

If you have a BeagleBone, you already have a lot of tools. We’ve seen them used in driving hundreds of LEDs at a very high frame rate, used as a video card for ancient computers, and as a software defined radio. For his entry to The Hackaday Prize, [Kumar] turned his BeagleBone into a 14-channel, 100Msps logic analyzer that’s good enough to debug just about all those hobby electronics projects you’re working on.

The BeagleBone is only able to have this sort of performance as a logic analyzer because of its PRUs, those fancy peripherals that make the Beagle great at blinking pins really, really fast. [Kumar] is using both PRUs in the BeagleBone for this project. PRU1 reads from the input probes, and PRU0 writes all the samples into DDR memory directly. From there, the samples are off to kernel modules and apps, either sigrok, dd, or something you coded up in Python.

Compared to the cheap logic analyzers we have today like the Salae Logic and the DSLogic, [Kumar]’s project is just as good as any commercial offering (provided you can live with 14 channels instead of 16), and because it’s based on a BeagleBone, the software is infinitely expandable.

UPDATE: After this post was written but before it was published, [Kumar] finished up a blog post on how he’s building a logic analyzer with the BeagleBone’s PRUs. It’s a true tutorial, with enough code demos to allow anyone to build their own 8-bit analyzer on a BeagleBone, and there are more updates coming.


The 2015 Hackaday Prize is sponsored by:

Turn Your BeagleBoneBlack In To A 14-channel, 100Msps Logic Analyzer

The BeagleBoneBlack is a SoC of choice for many hackers – and quite rightly so – given its powerful features. [abhishek] is majoring in E&E from IIT-Kharagpur, India and in 2014 applied for a project at beagleboard.org via the Google Summer of Code project (GSoC). His project, BeagleLogic aims to realize a logic analyzer using the Programmable Real-Time units on board the AM335X SoC family that powers the BeagleBone and the BeagleBone Black.

The project helps create bindings of the PRU with sigrok, and also provides a web-based front-end so that the logic analyzer can be accessed in much the same way as one would use the Cloud9 IDE on the BeagleBone/BeagleBone Black to create a new application with BoneScript.

Besides it’s obvious use as a debugging tool, the logic analyzer can also be a learning tool that can be used to understand digital signals. BeagleLogic turns the BeagleBone Black into a 14-channel, 100Msps Logic Analyzer. Once loaded, it presents itself as a character device node /dev/beaglelogic. In stand-alone mode, it can do binary captures without any special client software. And when used in conjunction with the sigrok library, BeagleLogic supports software triggers and decoding for over 30 different digital protocols.

The analyzer can sample signals from 10Hz upto 100MHz, in 8 or 16 bits and up to a maximum of 14 channels. Sample depth depends on free RAM, and upto 320MB can be reserved for BeagleLogic. There’s also a web interface, which, once installed on the BeagleBone, can be accessed from port 4000 and can be used for low-volume captures (up to 3K samples).

[abhishek] recently added the BeagleLogic Cape which can be used to debug logic circuits up to 5V safely. Source files for BeagleLogic as well as the Cape are available via his github repos. [abhishek] blogged about his project on his website where there’s a lot more information and links to be found. Catch a video of BeagleLogic after the break.

Continue reading “Turn Your BeagleBoneBlack In To A 14-channel, 100Msps Logic Analyzer”

Bathroom Scale

Reverse Engineering A Bathroom Scale For Automated Weight Tracking

[Darell] recently purchased a fancy new bathroom scale. Unlike an average bathroom scale, this one came with a wireless digital display. The user stands on the scale and the base unit transmits the weight measurement to the display using infrared signals. The idea is that you can place the display in front of your face instead of having to look down at your feet. [Darell] realized that his experience with infrared communication would likely enable him to hack this bathroom scale to automatically track his weight to a spreadsheet stored online.

[Darell] started by hooking up a 38khz infrared receiver unit to a logic analyzer. Then he recorded the one-way communication from the scale to the display. His experience told him that the scale was likely using pulse distance coding to encode the data. The scale would start each bit with a 500ms pulse. Then it would follow-up with either another 500ms pulse, or a 1000ms pulse. Each combination represented either a 1 or a 0. The problem was, [Darell] didn’t know which was which. He also wasn’t sure in which order the bits were being transmitted. He modified a software plugin for his logic analyzer to display 1’s and 0’s on top of the waveform. He then made several configurable options so he could try the various representations of the data.

Next it was time to generate some known data. He put increasing amounts of weight on the scale and recorded the resulting data along with the actual reading on the display. Then he tried various combinations of display settings until he got what appeared to be hexadecimal numbers increasing in size. Then by comparing values, he was able to determine what each of the five bytes represented. He was even able to reconstruct the checksum function used to generate the checksum byte.

Finally, [Darell] used a Raspberry Pi to hook the scale up to the cloud. He wrote a Python script to monitor an infrared receiver for the appropriate data. The script also verifies the checksum to ensure the data is not corrupted. [Darell] added a small LED light to indicate when the reading has been saved to the Google Docs spreadsheet, so he can be sure his weight is being recorded properly.

Thermal Printer Brain Transplant

Thermal Printer Brain Transplant Is Two Hacks In One

You know how sometimes you just can’t resist collecting old hardware, so you promise yourself that you will get around to working on it some day? [Danny] actually followed through on one of those promises after discovering an old Radio Shack TRS-80 TP-10 thermal printer in one of his boxes of old gear. It looks similar to a receipt printer you might see printing receipts at any brick and mortar store today. The original printer worked well enough, but [Danny] wasn’t satisfied with its 32 character per line limitation. He also wanted to be able to print more complex graphics. To accomplish this goal, he realized he was going to have to give this printer a brain transplant.

First, [Danny] wanted to find new paper for the printer. He only had one half of a roll left and it was 30 years old. He quickly realized that he could buy thermal paper for fax machines, but it would be too wide at 8.5 inches. Luckily, he was able to use a neighbor’s saw to cut the paper down to the right size. After a test run, he knew he was in business. The new fax paper actually looked better than the old stuff.

The next step was to figure out exactly how this printer works. If he was going to replace the CPU, he was going to need to know exactly how it functioned. He started by looking at the PCB to determine the various primary functions of the printer. He needed to know which functions were controlled by which CPU pins. After some Google-Fu, [Danny] was able to find the original manual for the printer. He was lucky in that the manual contained the schematic for the circuit.

Once he knew how everything was hooked up, [Danny] realized that he would need to learn how the CPU controlled all of the various functions. A logic analyzer would make his work much easier, but he didn’t happen to have one lying around. [Danny] he did what any skilled hacker would do. He built his own!

He built the analyzer around an ATMega664. It can sample eight signals every three microseconds. He claims it will fill its 64k of memory in about one fifth of a second. He got his new analyzer hooked up to the printer and then got to work coding his own logic visualization software. This visualization would provide him with a window to the inner workings of the circuit.

Now that he was able to see exactly how the printer functioned, [Danny] knew he would be able to code new software into a bigger and badder CPU. He chose to use another ATMega microcontroller. After a fair bit of trial and error, [Danny] ended up with working firmware. The new firmware can print up to 80 characters per line, which is more than double the original amount. It is also capable of printing simple black and white graphics.

[Danny] has published the source code and schematics for all of his circuits and utilities. You can find them at the bottom of his project page. Also, be sure to catch the demonstration video below. Continue reading “Thermal Printer Brain Transplant Is Two Hacks In One”

Talking BeagleBoard With [Jason Kridner]

[Jason Kridner] is a member of the i3 Detroit hackerspace and during the Hackaday meet-up we were able to spend a few minutes talking about what’s going on with BeagleBoard right now. For those of you that don’t know, BeagleBoard is a non-profit foundation which guides the open hardware initiative of the same name. This includes BeagleBone which is the third iteration of the platform. [Jason’s] a good guy to talk to about this as he co-founded the organization and has been the driving force in the community ever since.

Right now the organization is participating in the Google Summer of Code. This initiative allows students to propose open source coding projects which will help move the community forward. Students with accepted proposals were paired with mentors and are paid for the quality code which is produced. One of the projects this year is a 100 Megahertz, 14-channel Logic Analyzer which [Jason] is waving around in the video. It’s the GSoC project of [Kumar Abhishek] and you can learn more from his proposal.

Also of interest in the video is a discussion about the power of the BeagleBone’s PRUs, or Programmable Real-Time Units. They’re basically unused microcontrollers that have direct access to a lot of the processor’s features and are just waiting for you to bend them to your will. Having these is a huge boon for hardware hackers. If you haven’t played with them before, check out our earlier article on what PRUs are all about and then give it a whirl yourself.

After the break there’s a brief table of contents which maps the topics shown off in the video.

Continue reading “Talking BeagleBoard With [Jason Kridner]”