Performance events on Raspberry Pi 4: Tips

Performance measurement and tuning experiments with Raspberry Pi 4 are well-underway. Here are a few quick observations and tips.

Linux provides two entries into performance measurement: Performance Events for Linux (PERF) and the kernel performance counter interface (perf_event_open()). PERF is an easy-to-use tool suite and is the best place to start explorations. If you want to measure an application without modifying its code, this is for you.

PERF is built on the kernel performance counter interface. The interface consists of two calls: perf_event_open() and its associated ioctl() functions. The kernel interface is suitable for self-monitoring, that is, adding calls to an application in order to measure its internal operation. Performance counters provide two modes of operation: counting and sampling. Counting mode is most appropriate for self-monitoring. I’m currently writing code that makes self-monitoring a bit easier and hope to post the code when it’s ready.

In the meantime…

Installation

PERF and perf_event_open support are not usually installed with your typical Linux distribution. Originally, PERF was available solely as part of the Linux tools package. Well, it seems like somewhere along the way, Ubuntu and Debian diverged. Ubuntu installs PERF with Linux tools:

    sudo apt-get install linux-tools-common 
sudo apt-get install linux-tools-common-$(uname -r)

As PERF depends heavily upon kernel facilities and interfaces, you should install the version of PERF that matches the installed kernel.

Raspberry Pi OS (once known as Raspian) is a Debian distro. Shucks, wouldn’t you know it, Debian installs PERF differently:

    sudo apt install linux-perf

There are different packages for buster and stretch (the current versions of Raspberry Pi OS and Debian at the time of this writing).

    https://packages.debian.org/buster/linux-perf 
https://packages.debian.org/stretch/linux-perf

Installing on buster produces output like:

    XXX@raspberrypi:~ $ sudo apt install linux-perf 
password for XXX:
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
linux-perf-4.9
Suggested packages:
linux-doc-4.9
The following NEW packages will be installed:
linux-perf linux-perf-4.9
0 upgraded, 2 newly installed, 0 to remove and 107 not upgraded.
Need to get 1,275 kB of archives.
After this operation, 2,735kB of additional space will be used.
Do you want to continue? [Y/n]

Versioning gotcha

And, of course, it’s never that simple. My version of Raspberry Pi OS (buster) is expecting PERF version 5.4. When you enter “sudo perf list” or any other PERF command on the command line, the shell runs the script /usr/bin/perf. The script checks the version of PERF against the kernel and complains when versions don’t match. The Debian install pulled version 4.9, not 5.4.

Rather than sort out versioning, I’ve been entering “perf_4.9” instead of “perf“. This work-around bypasses the perf script which checks versions. Since PERF is now fairly mature, it all seems to work. At some point, I’ll sort out the versioning situation and install 5.4. In the meantime, full steam ahead!

Getting started

Here’s a few PERF commands to get you started:

    perf stat --help 
perf list sw
perf stat
perf top -a
perf top -e cpu_clock
perf record
perf report

The stat approach uses counting mode to measure software and hardware events triggered by an application program (“<cmd>”). The top approach displays event counts dynamically in real-time like the ever-popular “top” utility program. The record and report approach uses sampling to produce performance reports and profiles.

For additional usage information, check out the Linux performance analysis tutorial. There are several other fine tutorials and helpful sites on the Web. Many of the tutorials show use on x86 (Intel and AMD) systems, not Raspberry Pi and ARM. For that, I recommend my own three part tutorial:

  • Part 1 demonstrates how to use PERF to identify and analyze the hottest execution spots in a program. Part 1 covers the basic PERF commands, options and software performance events.
  • Part 2 introduces hardware performance events and demonstrates how to measure hardware events across an entire application.
    Part 3 uses hardware performance event sampling to identify and analyze hot spots within an application program.

In addition to usage, I offer information and guidance concerning ARM micro-architecture. This information is especially helpful when you get into hardware performance events. Check out my summaries of the ARM11 and ARM Cortex-A72 micro-architectures. ARM11 covers Raspberry Pi models 1, 2, and 3 (BCM2835 and BCM2836), while the Cortex-A72 summary covers the Raspberry Pi 4 (BCM2711).

Other helpful on-line resources are:

Paranoia!

Performance measurement is fraught with security issues and holes. The kernel developers implemented a control flag file, /proc/sys/kernel/perf_event_paranoid which sets the level of access and vulnerability when taking measurements. Quoting the Linux man page:

    The perf_event_paranoid file can be set to restrict access 
to the performance counters.
2 allow only user-space measurements (default since
Linux 4.6).
1 allow both kernel and user measurements (default
before Linux 4.6).
0 allow access to CPU-specific data but not raw
tracepoint samples.
-1 no restrictions.
The existence of the perf_event_paranoid file is the
official method for determining if a kernel supports
perf_event_open().

If you’re operating in a fairly closed, single-user environment, then set the content of the file to 0 or -1.

Read the perf_event_open() man page

I recommend reading the perf_event_open() man page. If you’re just starting your journey into performance measurement, you will be overwhelmed by the detail at first. However, just let the information wash over you and know that it’s there. The tutorials don’t always mention the perf_event_paranoid flag and other low-level details. Reading the man page should help you across future stumbling blocks and will enhance your understanding of events, counting and sampling.

Want to learn more about Raspberry Pi 4 (Cortex-A72 / Broadcom BCM2711) performance tuning? Please read:

Copyright © 2020 Paul J. Drongowski

Raspberry Pi 4 ARM Cortex-A72 processor

Raspberry Pi 4 (RPi4) is a big step beyond the earlier models 1, 2 and 3. Both desktop interaction and browsing are snappier and don’t have that laggy feel. I haven’t even thought (yet) about the RPi4’s music making and synthesis potential!

The Raspbeery Pi 4 is powered by a new processor from Broadcom: the BCM2711. The BCM2711 is an improvement over the BCM2835/2836 used in earlier models. Like the BCM2836, main memory is external. I’m running an RPi with 4GB of RAM (LPDDR4-3200 SDRAM, 3200Mb/s, dual channel). The old RPi2 has only 1GB of RAM. The BCM2711 supports Gigabit Ethernet (1000 BaseT) while the old RPi2 is just 100Megabit Ethernet. Faster Internet speed makes updates and browsing so much faster.

The RPi4 is a quad-core ARM Cortex-A72 processor clocking at 1.5GHz. The old RPi2 is a 900MHz quad-core ARM Cortex-A7 processor. The old BCM2835 is a member of the ARM11 family (ARM1176JZF-S, to be exact). The ARM Cortex-A72 within the BCM2711 has a much improved CPU core and memory subsystem.

The old ARM1176 is a relatively simple beast. It is a single issue machine, that is, it issues a single instruction per cycle. The ARM1176 core has eight pipeline stages and three execution pipes: 1. ALU, shift, saturation, 2. Multiply-accumulate, and 3. Load/store.

The Cortex-A72, on the other hand, performs 3-way instruction decoding and can issue as many as five operations per cycle. It is an out-of-order superscalar machine allowing speculative issue. That is waaay more sophisticated than the ARM1176, putting the Cortex-A72 on the same level as x86 superscalar machines. In fact, it translates ARM instructions into micro-ops like most modern x86 superscalar processors. It even performs micro-op fusion in some cases. The Cortex-A72 performs register renaming, letting micro-ops (instructions) execute when program data are ready (out-of-order execution, in-order retirement).

The Cortex-A72 issues micro-ops to eight execution pipelines:

  • Branch: Branch micro-ops
  • Integer 0: Integer ALU micro-ops
  • Integer 1: Integer ALU micro-ops
  • Integer Multi-Cycle: Integer shift-ALU, multiply, divide, CRC and sum-of-absolute differences micro-ops
  • FP/ASIMD 0: ASIMD ALU, ASIMD misc, ASIMD integer multiply, FP convert, FP misc, FP add, FP multiply, FP divide and crypto micro-ops
  • FP/ASIMD 1: ASIMD ALU, ASIMD misc, FP misc, FP add, FP multiply, FP square root and ASIMD shift micro-ops
  • Load: Load and register transfer micro-ops
  • Store: Store and special memory micro-ops

Up to 5-way issue and a larger number of independent execution pipelines permit more fine-grained parallelism than ARM1176. Of course, the compiler must know how to exploit all of this parallelism, but the potential is there. The ARM Cortex-A72 Software Optimization Guide specifies the number of execution cycles and pipeline units for each kind of ARM instruction. This information is incorporated into a compiler and guides the choice and scheduling of machine instructions.

ARM Cortex-A72 block diagram

The Cortex-A72 allows speculative execution. Without speculation, a CPU must wait at each conditional program branch until the direction is decided and instruction fetch can proceed along the chosen branch. The Core-A72 processor predicts branch direction (speculates) and aggressively issues instructions along predicted branches. The Cortex-A72 branch predictor is also improved over ARM1176. (I’m still digging into details.) If a branch is mispredicted, speculative results are discarded. So, it’s important to have a good branch predictor.

The Cortex-A72 can perform a load operation and a store operation every cycle because it has separate load and store pipelines. The ARMv8-A instruction set architecture (ISA) allows arbitrary data alignment and access. However, the Cortex-A72 hardware penalizes load operations that cross a cache-line (64-byte) boundary and store operations that cross a 16-byte boundary. Programmers (and compilers) should keep that in mind when laying down data structures in memory.

Like all modern high-performance computers, the Cortex-A72 organizes physical memory into a hierarchy with the fastest/smallest memory (registers) near the arithmetic/logic unit (ALU) and the slowest/largest memory (RAM) far away and off-chip. The registers and RAM are connected to intervening levels of memory — the caches:

          Register          Fast, but small 
|
Level 1 caches
|
Level 2 cache
|
RAM Big, but slow

Data and instructions are read (and written) in efficient chunks making data and instructions available when needed by the registers and ALU. The chunks are called “cache lines.” Thanks to cache memory, programs run faster when they (re)use data that are close together in memory (i.e., occupy the same cache line) and are the most recently accessed. These notions are called “spatial locality” and “temporal locality.”

The following table is a quick summary of the level 1 and level 2 cache structures of the ARM1176 and Cortex-A72.

Feature ARM1176 Cortex-A72
L1 I-cache capacity 16KB 48KB
L1 I-cache organization 4-way set associative, 32B line 3-way set associative, 64B line
L1 D-cache capacity 16KB 32KB
L1 D-cache organization 4-way set associative, 32B line 2-way set associative, 64B line
L2 cache capacity 128KB 1MB
L2 cache organization Shared, 8-way set associative, 64B line Shared, 16-way set associative, 64B line

Each core has an Instruction Cache (I-Cache) and Data Cache (D-Cache). The four cores share the Level 2 (L2) cache.

As you can see, the RPi4 (BCM2711) has larger caches and a bigger cache line size (64 bytes) than ARM11. RPi4 programs are more likely to find instructions and data in cache than earlier RPi models.

Contemporary processors have one or more memory management units (MMU) that break physical RAM into logical pages. This scheme is called “virtual memory.” The MMU translate logical program addresses (from loads, stores and instruction fetches) into physical RAM addresses. Address translation has its own memory hierarchy:

   Translation registers       Fast, but only a single mapping 
|
Level 1 TLBs
|
Level 2 TLB
|
RAM Big page tables, but slow

Page tables in RAM are maps that describe the layout of pages in the operating system and application programs. Translation lookaside buffers (TLB) are cache-like hardware structures that hold the most recently used (MRU) address translation information, i.e., where a logical page is located in physical memory. TLBs greatly speed up the translation process by keeping MRU page table information on-chip within the CPU.

Cortex-A72 has larger translation lookaside buffers (TLB) than ARM1176, as summarized in the table below. With larger TLBs, a program can touch more locations in memory without triggering a performance robbing page fault — an event which brings page translation information into the CPU from relatively slow RAM.

Feature ARM1176 Cortex-A72
D-MicroTLB capacity 10 entries 32 entries
D-MicroTLB organization Fully assoc, 1 lookup/cycle Fully assoc, 1 lookup/cycle
I-MicroTLB capacity 10 entries 48 entries
I-MicroTLB organization Fully assoc, 1 lookup/cycle Fully assoc, 1 lookup/cycle
L2 TLB capacity 256 entries 1024 entries
L2 TLB organization Unified, 2-way set assoc Unified, 4-way set assoc

Each core has a Data Micro-TLB (D-MicroTLB), Instruction Micro-TLB (I-MicroTLB), and Level 2 (L2) TLB. (In ARM1176 terminology, the L2 TLB is called the “Main TLB”).

In summary, the RPi4’s BCM2711 processor is a powerhouse even though it won’t knock that gaming machine off your desktop. 🙂 If you’ve been waiting to dive into Raspberry Pi or to upgrade, please don’t hesitate any longer.

I’m getting the itch to play with RPi4’s hardware performance counters and post results. In the meantime, check out my summary of the ARM11 micro-architecture. If you would like to know more about performance measurement and events in ARM1176-based Raspberry Pi’s, please see my Performance Events for Linux (PERF) tutorial.

Also, I have uploaded all of my teaching notes about computer design, VLSI systems and computer architecture:

These resources should help students and teachers alike!

Copyright © 2020 Paul J. Drongowski

Raspberry Pi 4 mini-review

Success with the RTL-SDR Blog V3 software defined radio (SDR) inspired me to try SDR on Raspberry Pi. I pulled out the old Raspberry Pi 2, updated to the latest Raspberry Pi OS (Buster), and installed CubicSDR and GQRX.

Both CubicSDR and GQRX ran, but performance was unacceptably slow. Audio kept breaking up, possibly due to a small audio buffer and/or insufficient CPU cycles. The poor old Raspberry Pi 2 Model B (v1.1) is a 900MHz Broadcom BCM2836 SoC, a quad-core 32-bit ARM Cortex-A7 processor. The RPi 2 has 1GB of RAM. If you would like to know more about its internals, please read about the BCM2835 micro-architecture and performance analysis with PERF (Performance Events for Linux).

Time to upgrade! I had been meaning to retire the Black Hulk — a 2011 vintage power-sucking LANbox with a Greyhound-era dual-core AMD processor. Upgrading gives me the opportunity to try the latest Raspberry Pi 4 and gain a lot of desktop space. The image below shows my office work space including the Black Hulk and the intsy RPi 4.

Raspberry Pi 4 running CubicSDR software defined radio

I decided to accessorize a little and purchased a Raspberry Pi branded keyboard and mouse. The Raspberry Pi keyboard is a small chiclet keyboard with an internal hub. The internal hub is a welcome addition and postpones the need for an external USB hub. The keyboard has a decent enough feel. It is smaller than the Logitech which it replaces, giving me more desktop space albeit with a slightly cramped hand feel. The Raspberry Pi mouse is just OK. I like the splash of color, too, a nice break from boring black and grey.

Raspberry Pi 4 is faster without question. The desktop and web browser are snappier. RPi 4 boosts the Ethernet port to 1000 BaseT (Gigabit) and you can see it.

The Raspberry Pi 4 is a 1.5GHz Broadcom BCM2711, a quad-core 64-bit ARM Cortex-A72 processor. I ran an old naive matrix multiplication program and it finished in 0.6 second versus 2.6 seconds on the Raspberry Pi 2. Naturally, I’m curious about the speed-up. I hope to dig into the BCM2711 micro-architecture.

Raspberry Pi 4 PCB (Broadcom BCM2711 and 4GB RAM)

I recommend upgrading to Raspberry Pi 4 without hesitation or reservations. I bought the Canakit PI4 Starter PRO Kit at Best Buy, not wanting to wait for delivery. The kit includes an RPi 4 with 4GB RAM, black plastic case, Canakit power supply, heat sinks, cooling fan, micro HDMI cable, USB card reader, NOOBS on a 32GB MicroSD card, and a Canakit power switch (PiSwitch). It seemed like the right combination of accessories.

By the way, you might want to consider the newly announced Raspberry Pi 400. It integrates a Raspberry Pi 4 and keyboard into one very compact unit. Its price ($70USD) is hard to beat, too.

The PiSwitch sits between the USB-C power supply and the RPi4, and is a convenient desktop power ON/OFF switch. Canakit could be a little more forthcoming about proper power up and power down sequencing. When powering down, I let the monitor go to sleep before turning power off. This should give the Raspberry Pi OS time to sync and properly shut-off.

I recommend checking the connecters on your monitor before placing any kind of web order. My HP monitor does not support HDMI, doing DisplayPort, DVI-D and VGA. The Canakit cable is micro-HDMI to HDMI. I bought a mini-HDMI to DVI-D cable on-line and wound up waiting after all! No way I’m paying Best Buy prices for a cable. 🙂

Assembly is a piece of cake. The processor and case fit together without screws or other hardware. The case fit and finish is good and holds together well just by fit alone. I installed the heat sinks, but not the fan. If I run into thermal issues, I will add the fan.

I didn’t bother with the NOOBS MicroSD card as I already had Buster installed. I see the value in NOOBS for beginners who don’t want to deal with disk images and such. I will probably repurpose the NOOBS card.

The only annoyance is due to the Raspberry Pi OS package manager. The add/remove software interface shows waaaaay too much detail. I want to install CubicSDR and GQRX, but where the heck are they? Why do I have to sort through a zillion libraries, etc. when searching on “SDR”? I installed via command line apt-get — a far more convenient and direct method.

The higher processor speed and bigger RAM pay off — no more glitchy audio. After trying both CubicSDR and GQRX, I prefer CubicSDR. I didn’t have any issues configuring for HF reception in either case. You should read the documentation (!) ahead of time, however.

I hope this quick Raspberry Pi 4 rundown is helpful.

Copyright © 2020 Paul J. Drongowski

RTL SDR Blog V3 HF reception

I wanted to spend more time experimenting with HF before posting a follow-up about the RTL-SDR Blog V3 software defined radio. Due to shifting ionospheric conditions and such, a 5 minute snap evaluation is no evaluation at all. Here’s the scoop after really working with the V3.

Yes, the V3 does HF — with limitations. What it does, it does surprisingly well for $35 USD.

I configured the V3 with a nooelec 9:1 V2 balun (unun) and a 23 foot (7 meter) long-wire antenna. I did a number of experiments in grounding and eventually just went with the simplest solution: long-wire to the antenna input and no ground. Electrical ground (wall outlet) was unsatisfactory and cold water pipe didn’t produce any improvement. [More on these experiments some day.] I compared the V3 against my old Drake R8 communication receiver using both long-wire (23 feet) and Datong DA270 active dipole antennas. The old Datong DA270 is long in the tooth and I got slightly better results with the long wire. The Drake is in terrific shape for its age (25 years). Wish I could say the same for myself. 🙂

The V3 tunes in quite a few stations! It took a bit of time to find my way around SDR#, trying this feature (noise reduction) and that (audio filtering). Reception-wise, the Drake has the edge, but not by much. I can easily tune the stronger shortwave stations out of Asia, for example.

The SDR# spectrum display makes a good companion to the Drake. I could pick out the most likely candidates on the spectrum display, then turn to the Drake and dial them in. Using the V3, I could tune in some weaker stations like a Honolulu weather station and the U.S. Air Force High Frequency Global Communications System (HFGCS). You haven’t done nothin’ till you hear an EAM. 🙂 The SDR# memory feature made it easy to follow an HFGCS simulcast through its primary stations. I may stick with this productive workflow in the future.

The RTL-SDR blog documentation states the V3’s limitations clearly and accurately. The V3 has an analog-to-digital converter (ADC) that samples the baseband radio frequency (RF) signal directly. Quoting the data sheet and user’s guide:

The result is that 500 kHz to about 24 MHz can be received in direct sampling mode.

Direct sampling could be more sensitive than using an upconverter, but dynamic won’t be as good as with an upconverter. It can overload easily if you have strong signals since there is no gain control. And you will see aliasing of signals mirrored around 14.4 MHz due to the Nyquist theorem. But, direct sampling mode should at least give the majority of users a decent taste of what’s on HF. If you then find HF interesting, then you can consider upgrading to an upconverter like the SpyVerter (the SpyVerter is the only upconverter we know of that is compatible with our bias tee for easy operation, other upconverters require external power).

Note that [the V3] makes use of direct sampling and so aliasing will occur. The RTL-SDR samples at 28.8 MHz, thus you may see mirrors of strong signals from 0 – 14.4 MHz while tuning to 14.4 – 28.8 MHz and the other way around as well. To remove these images you need to use a low pass filter for 0 – 14.4 MHz, and a high pass filter for 14.4 – 28.8 MHz, or simply filter your band of interest.

I definitely saw and heard aliases. The best example is WWV at 15.0MHz. Yep, I could tune in 15.0MHz directly. But, what’s this strong signal in the 20 meter shortwave band at 13.8MHz? It’s a WWV alias. Hmmm, 15MHz is 600kHz above 14.4MHz and 13.8MHz is 600kHz below 14.4MHz. Not a coincidence? I also found aliases of strong medium wave AM broadcast stations up around 27 to 28MHz.

SDR# spectrum display: WWV and its alias
SDR# spectrum display: AM broadcast aliased near CB radio band

So, I would say that the V3 is quite a good low-cost HF receiver, especially in the range from 2 to 15MHz, where I spent most of my time. I have an AM band-stop filter on order and hope to attenuate the strong AM broadcast stations. I did a quick survey of local transmitters and discovered three powerful stations within a few miles of my location. All transmit several thousand watts or more — enough to be troublesome. In addition to the aliasing issue, the stations may be overloading the V3 and degrading its weak signal performance. [More on this some other time.]

I find RTL-SDR’s assessment of the V3’s HF capabilities to be fair and transparent. If you’re a serious radio hobbyist, I recommend an up-converter (e.e., the nooelec Ham It Up) or an upscale SDR like the SDRplay RSP1A/RSPdx or the AirSpy HF+. The upscale models cost more, but have better HF support (no aliases, better RF front-end, etc.)

I’m good with the nooelec baluns, by the way, and have purchased a second one for the Drake R8. Rather than buy another SDR, I’m going to spend time on antennas instead. As to workflow, I like getting an overview of the spectrum via SDR and then focusing through the Drake R8. I want to try and evaluate an AM band-stop filter, too. I will post results once I get more experience under my belt. If I didn’t have the Drake R8, I would probably look into an RSPdx or an HF+ as the next step.

Want more? Check out my short review of the nooelec Nano 2+ SDR.

Copyright © 2020 Paul J. Drongowski, N2OQT

RTL SDR Blog V3 Radio

Based on my positive experience with the nooelec Nano 2+ software defined radio, I bought an RTL-SDR Blog V3 receiver bundle. I meant to write a quick review of the RTL-SDR Blog V3 (henceforth, the “V3”), but I wound up having too much fun with the new toys!

For $35USD, you get the USB receiver stick, a dipole antenna kit with telescoping elements, cables, a tripod and a suction mount. The V3 uses SMA connectors everywhere. In comparison, the nooelec Nano 2+ bundle includes a small magnetic mount telescoping antenna and uses tiny MCX connectors.

RTL SDR Blog V3 Software Defined Radio bundle

If you want to mix and match components between bundles, you will need adapters. SMA connecters thread onto each other and provide a more firm and reliable connections than MCX. On that basis, I give the V3 points.

Further points go to V3 for its build quality. The V3 is somewhat larger, but the electronics are mounted in a metal (shielded) case. The case is also the heat sink. If you want metal shielding in the nooelec line, you should purchase the nooelec Nano 3. Both the V3 and Nano 2+ run warm, so heat dissipation is important.

Both units make adequate low-cost VHF/UHF receivers when used with their respective bundled antenna system. If you’re most interested in broadcast FM or aircraft band, you can’t go wrong either way. I give the V3 points for the option of HF reception and the ability to tune antenna length for the radio band to be monitored. You can see the effect of tuning with your own eyes. Dial in a weather station, for example, and adjust the antenna elements. You’ll see the signal increase and decrease in strength as you change element length.

Tips: The V3 antenna system is a dipole, so you need to make both elements the same length. Divide the frequency (in MHz) into 468 to get the total antenna length (in feet). Then divide the total length by two to obtain the length of each element. Pop the cap on the central Y junction and find the element which is connected to the coax shield. Orient the shield-side element down towards the earth.

So far, the V3 is winning on points. Then consider HF. The V3 receiver is HF capable, but you will need to build or add an HF antenna. This is where life gets a little bit tricky. Short story — Yes, the V3 receives HF. I’ll save the longer story for a future blog post.

Bottom line. If you are only interested in VHF/UHF, then either unit will do the business. If you prefer a magnetic mount antenna, go with a nooelec Nano bundle. If you want to optimize tuning for a VHF/UHF band, then go with the V3 bundle. If you want to get your feet wet with HF and don’t want to spend a lot of money, then pick up the V3 bundle, a nooelec balun and at least 23 feet of wire.

Even though the V3 won this match-up, nooelec won my respect as a solid citizen. They make the Ham It Up HF up-converter which adds HF reception to a VHF/UHF only SDR. Based on my experience with the Nano 2+, I would give the Ham It Up a try without trepidation.

Most of all, have fun!

Copyright © 2020 Paul J. Drongowski, N2OQT

Nooelec Nano 2+ Software Defined Radio

One side-benefit of unpacking after a move is getting reacquainted with old electronic gear, in this case, a Drake R8 shortwave receiver. HF is definitely alive, but it whet my appetite for more listening, more action.

Rather than pull out the old Radio Shack 2006PRO — another old acquaintance — I decided to give software defined radio (SDR) a try.

Like everything else electronic, VLSI digital signal processing revolutionized radio design. Smart folks realized that the RTL2832U chipset could be repurposed into a wideband SDR receiver. The RTL2832U chipset was originally designed as a DVB-T TV tuner and repurposing it is a spiffy hack!

Even better, the RTL2832U SDR is dirt cheap. Why spring for a $300 ICOM when you can buy a dongle for about $25USD? There are “high end” solutions such as the Airspy R2 ($169USD) or SDRPlay RSPdx ($199USD).
The Airspy HF+ Discovery extends coverage to HF (0.5kHz to 31MHz) for $169USD. Mid-range solutions include the Airspy Mini SDR ($99USD) and SDRPlay RSP1A ($109USD) among others. If you’re interested in adding HF, the Nooelec Ham It Up up-converter ($65USD) is an option.

Cheapskate that I am, I believe in the low-end theory — how much can I do with the least amount of money. 🙂 Thus, I chose the Nooelec NESDR Nano 2+ for $24. The original Nooelec Nano had a reputation for running hot. The Nano 2+ mitigates heat dissipation; the newer Nano 3 ($30) has a metal case/heatsink.

nooelect Nano 2+ Software Defined Radio

I went cheap. Yes, the Nano 2+ gets warm to the touch, but not to the level of concern. An x86 running full tilt is HOT — not the Nano 2+. It doesn’t run much hotter than my vintage Datong AD270 active antenna.

For software, I installed SDR#. The “sharp” comes from C#, the implementation language. There are many good getting started guides on-line. I especially like:

There are several more software options out there like CubicSDR. I chose SDR# because it has a number of useful plug-ins including a frequency manager/scanner.

The Nano 2+ is the size of a USB flash drive. The low-cost Adafruit dongle is similar, but it’s out of stock. The Nano 2+ is a nice replacement. The Nano 2+ is bundled with a tiny magnetic-mount telescoping antenna which is good enough for VHF/UHF. I placed the mag-mount on a small electrical junction box cover which provides a more stable base.

FM broadcast via SDR# and Nooelec Nano 2+ software defined radio

Follow the on-line guides! RTL SDR is quite mature for “hobby” software. I tuned in FM broadcast literally within minutes.

Based on this short experience, I splurged for an RTL-SDR Blog V3 receiver and antenna bundle ($35USD). The V3 has a metal enclosure and enables HF reception through direct sampling. The bundle includes a dipole antenna with a variety of mounting options. I believe that the innards of the dipole antenna can be adapted for HF, but decided to buy a Nooelec Balun One Nine V2 ($15), too. The balun can be used as an unun in order to match impedance with a long-wire antenna.

I also recommend a set of antenna adapters. The Nooelec Nano 2+ uses an MCX antenna connector and the V3 uses an SMA connector. So, if you want to mix and match components, be prepared with adapters.

HF for $35? I can’t vouch for receiver sensitivity, etc. at this point, not having received the V3. The potential, however, is amazing. If you’re good with just VHF and UHF, then give the Nooelec Nano 2+ a try.

Copyright © 2020 Paul J. Drongowski

Review: Roland Micro Cube GX for keyboard

You’ll find plenty of rave on-line reviews for the Roland Micro Cube GX — the go-to battery-powered practice amp for guitar.You won’t find a review covering the Micro Cube GX as a portable keyboard practice amp — until now.

Here’s a quick rundown (from the Roland site):

  • Compact guitar amp with a 5 inch (12cm) custom-designed speaker
  • 3 Watt rated output power
  • Eight COSM amp tones, including the ultra-heavy EXTREME amp
  • Eight DSP effects, including HEAVY OCTAVE and dedicated DELAY/REVERB with spring emulation
  • MEMORY function for saving favorite amp and effects settings
  • i-CUBE LINK jack provides audio interfacing with Apple’s iPhone, iPad, and iPod touch
  • Free CUBE JAM app for iOS
  • Chromatic tuner built in
  • Runs on battery power (6xAA) or supplied AC adapter; carrying strap included
  • 6 pounds (2.7kg)

I haven’t tried the Roland CUBE JAM application yet, so I’ll be concentrating on the amplifier itself. The included 3.5mm cable is the usual 4 conductor affair although it’s rather short. Roland also includes the AC adapter.

I’ve been searching for a good portable, battery-powered keyboard rig for quite some time. On the keyboard side, the line-up includes Yamaha Reface YC, Yamaha SHS-500 Sonogenic and Korg MicroKorg XL+. Although the YC and Sonogenic have built-in speakers, their sound quality is decidedly inadequate and poor quality. The MicroKorg XL+ doesn’t have built-in speakers. All three keyboards have mini-keys and are battery-powered.

To this point, I’ve been using a JBL Charge 2 Bluetooth speaker.The JBL has solid bass, but its output volume is easily overwhelmed during living room jams. It’s been a good side-kick, but I found myself wanting.

Roland Micro Cube GX and Yamaha SHS-500 Sonogenic

So, the latest addition is the Roland Micro Cube GX. Without comments from fellow keyboard players, buying the GX was a risk. Guitar amps are notoriously voiced for electric (or acoustic) guitar tone. Like the GX, you’ll typically find amp and cabinet simulators that help a guitar player chase their “tone.” The GX, however, includes a “MIC” amp type in addition to the usual 3.5mm stereo AUX input. Fortunately, my intuition was correct and the “MIC” setting does not add too much coloration.

Of course, there is some compromise in sound quality. The amp puts out 3W max through a 5 inch speaker (no coaxial or separate tweeter). Needless to say, you don’t hear much high frequency “air.” The GX cabinet does have a forward-facing bass port, producing acceptable bass even with B-3 organ. No, you will not go full Keith Emerson or Jon Lord with this set-up. 🙂 I first tested the GX with Yamaha MODX and found the B-3 to be acceptable.

Volume-wise, yes, you can get loud — too loud for your bedroom or ear-health. Bass heavy sounds can get buzzy. For clean acoustic instruments, I recommend the “MIC” amp setting. The reverb is pleasant enough and adds depth to my normally dry live patches. The delay is a nice alternative to the reverb ranging from reverb-like echo to explicit (non-tempo synch’ed) repeats.

I find the Sonogenic/Micro Cube GX combination to be the most fun. The SHS-500 has DSP effects, but they are rather tentative, as if Yamaha is afraid to offend anyone. That’s where the GX makes a good companion for the Sonogenic. Feel free to dial in the Jazz Chorus amp with the jazz guitar patch or a British stack with electric guitar. Or, try any of the modulation effects on the Sonogenic’s electric piano. Working with the GX is a far more intuitive and rewarding experience than the built-in Sonogenic DSP effects. You can cover Steely Dan EP to Clapton with this rig!

I have to call out the Heavy Octave and Spring reverb effects. You’ll find them at the right-most position of the modulation (EFX) and delay/reverb knobs, respectively. You can think of them as “going up to eleven.” The spring reverb is decent and you can throw the Heavy Octave onto just about anything to thicken up the sound.

Overall build quality is good. The Micro Cube GX feels solid. A metal grill protects the speaker. The knobs have a pleasant resistance and don’t feel cheap. The only not-so-robust feature is the battery compartment and its cover. As long as you avoid heavy abuse, you should be OK.

For the money, $160USD, it’s a decent sounding, inexpensive package. Given the physical cabinet, output power and speaker size, one should adjust expectations. However, if you’re a keyboardist and need a light, portable, battery-powered amp, the Roland Micro Cube GX is worth a try.

Copyright © 2020 Paul J. Drongowski

COVID-19 Washington State August 14, 2020

Although I’m posting about music technology again, I still track the local COVID-19 situation. This disease, unfortunately, is still out there with months to go until a safe, tested vaccine.

The Washington State Department of Health web site is changing the way it counts and reports negative tests. The DOH site has left us blind about testing for over one week; they promise to have negative test results beginning August 24. I will do a major revision of my own when the new data are available.

In the meantime, here is a graph of the daily positivity rate for Washington State using data from the University of Washington (UW) Virology Lab. UW does not break down test results by county, age, etc. It’s strictly specimens in, results out.

Washington State COVID-19 daily positivity rate (UW, August 14, 2020)

The State as a whole did quite well — for a while. The positivity rate for King County, the most populous county, is around 3 percent. Not bad. UW performs tests for the entire state and reflects problem areas elsewhere, notably Yakima and a few other agricultural areas. Snohomish county, where we live, is running at 5 to 7 percent — nothing to brag about and misses the state target (2 percent).

This situation demonstrates how one populous county can make a state appear better or worse overall. People outside of King County should check their local statistics and not feel comfortable thinking that COVID-19 is in check. Don’t ride on someone else’s coat tails!

Keystep for littleBits

My last blog post took a look at the Pitch and Gate control voltages (CV) generated by the Arturia Keystep. Keystep’s Pitch and Gate behave conventionally. I also took note of how they differ from the littleBits gate CV signal, which combines pitch and gate control into a single signal. I mentioned two potential approaches for interfacing Keystep to littleBits:

  • Driving littleBits with Keystep’s Pitch and Gate, and
  • Sending MIDI to a littleBits MIDI module that handles conversion to littleBits gated CV.

I tried each approach. Here’s what I learned.

Keystep Pitch and Gate circuit

In this approach, the littleBits Oscillator is always running, always generating an audio signal. The Oscillator tracks the Gate voltage generated by the Keystep. The trick is opening up and shutting off the audio signal. For that, I put a littleBite Envelope module after the Oscillator and triggered the Envelope with the Keystep Gate voltage.

The resulting circuit is:

            Keystep Pitch                Keystep Gate 
| |
V V
Power --> CV Module --> Oscillator --> Envelope --> Speaker

The Keystep Pitch output is connected to the “CV IN” connector on the CV Module. The CV Module routes the incoming control voltage to its output, which sends the pitch control voltage to the Oscillator Module. The Keystep Gate output is connected to the Envelop’s Trigger input.

littleBits Proto Module ins and outs
littleBits Proto Module and quick-and-dirty patch cable

The Pitch output to CV IN connection is a standard 3.5mm patch cable. But, how is the 3.5mm Gate jack connected to the Trigger bitSnap? The littleBits Proto Module provides the solution. I cut a (stereo) patch cable in two and connected the shield and tip wires to the littleBits Proto Module as shown above. The Proto Module sends the incoming trigger signal (the Keystep Gate) to the output bitSnap. From the output bitSnap, the trigger signal goes to the Envelope Trigger input.

Properly, I should have used a mono patch cable, but I didn’t have one to sacrifice. I connected the TIP and SHIELD wires, leaving the RING unconnected.

That’s the entire setup! For testing purposes, I attached oscilloscope probes to the trigger (Keystep Gate) and the Envelope’s audio output. I also verified correct operation at intermediate points along the main signal path.

Oscillator audio (top) and Keystep Gate (bottom)

The screenshot above shows two oscilloscope traces. The top trace (green) is the final audio signal. Note the attack-release envelope around the oscillator signal. The bottom trace (red) is the trigger (Keystep Gate) signal. If the trigger is dropped before the entire envelop completes, the audio cuts off (i.e., it’s truncated). If the trigger is held beyond the combined attack plus release time, the audio signal merely stays at zero. The audio signal remains shut off until another trigger (the rising edge of Gate) is received.

Although this circuit gives us the desired behavior, it wasn’t easy getting things to work reliably. I seemed to suffer more than the usual loose connections and other lab-bench gremlins.

MIDI Module circuit

The MIDI Module approach is very similar to driving the littleBits Oscillator Module by MIDI over USB from a PC DAW:

           Keystep MIDI OUT 
|
V
Power --> MIDI Module --> Oscillator --> Envelope --> Speaker

MIDI arrives on the MIDI Module’s 3.5mm connector instead of the USB port. Otherwise, the main signal flow is the same.

Keystep/littleBits test rig

I monitored the gated CV signal produced by the MIDI Module and the audio signal generated by the littleBits Envelope using the oscilloscope. I played two notes in quick succession. The second note is two octaves higher than the first note.

littleBits audio triggered by MIDI Module

In the screenshot above, the top oscilloscope trace is the gated CV signal. The bottom trace is the synthesized audio. Not any different than the Pitch and Gate control volltage approach, eh?

Since the final audio is much the same, I would go with the MIDI Module circuit. It is simpler and its wiring is less touchy. The circuit uses the littleBots modules pretty much as intended by the littleBits engineers.

The MIDI Module approach makes the Keystep Pitch, Gate and MOD outputs available for other duties such as key-scaling (i.e., varying the effect of a sound modifier by keyboard pitch), modulation and user control. Don’t forget to insert littleBits Dimmer Modules (potentiometers) along control paths in order to set modulation level and so forth.

Copyright © 2020 Paul J. Drongowski

Arturia Keystep CV

My post about Arturia Keystep teardown and cleaning attracted a fair number of page views; it must have hit a common chord. 🙂

Today’s post continues with Arturia Keystep. Although the Keystep Gate and Pitch control voltage (CV) signals are conventional, I wanted to visualize them with an oscilloscope. I strongly recommend getting an oscilloscope when working in modular synthesis because pictures/graphs help understanding. [We haven’t even gotten to the audio yet!] I connected the Gabotronics Xminilab oscilloscope to the Keystep’s Gate and Pitch CV outputs and took a quick look.

First thing I noticed was a 12V positive trigger level. Holy smokes, I hope I didn’t apply that high signal to littleBits way back when! littleBits modules operate in the 0V to 5V range. Fortunately, littleBits input ports have an ON Semiconductor ESD9L5.0ST5G ESD suppressor/TVS diode, which protect against ESD and transient voltage events. Still, it’s better to configure voltages correctly ahead of time and not risk an accident.

Second thing is that Keystep CV voltages cannot be configured through its front panel. That’s somewhat understandable in a low cost product like Keystep. Control voltages are configured by Arturia’s MIDI Control Center (MCC) software — a free download for Keystep owners.

Here is the control voltage configuration that I used during testing:

  • MIDI CV output: Volt per octave
  • 0V MIDI note: C1
  • Note priority: Last
  • MOD CV source: Mod wheel
  • MOD CV max voltage: 5V
  • Pitch bend range: 2 semitones
  • Gate CV output: V-trig 5V

Keystep supports V-trigger 12V and S-trigger in addition to V-trig 5V. S-trigger is the old Moog convention that is not used very much anymore. It’s sometime called “negative trigger,” but it’s really a strange creature requiring a special connector.

Keystep Gate (green) and Pitch (red) control voltages

The screenshot above shows the Keystep in action. [Click image to enlarge.] The top trace (green) is the Gate (V-trigger 5V) output and the bottom trace (red) is the Pitch output. The Gate signal is, er, a gate. It goes high when a key is pressed, stays high while the key is held, and goes low when the key is released.

In the example, I played three notes where each note is an octave apart. The vertical oscilloscope scale is 2.56V per grid division. Each step up in the bottom trace (Pitch) is about 1V. Also, you see the Gate signal hit a maximum 5V.

In the future, I may need to tweak Keystep’s 0V MIDI note parameter if I drive the littleBits Oscillator module with the Pitch signal. One needs to find a happy operational sweet spot between Keystep octave transpose and note range versus the limited 5 octave range of the Oscillator module. Keystep’s Pitch signal ranges from 0V to 10V, and I don’t want to drive the littleBits Oscillator with more than 5V, if possible. MCC does not allow us to specify a maximum, do-not-exceed Pitch voltage.

One way around the pitch voltage issue is to control the littleBits Oscillator via the littleBits MIDI Module instead. In that case, the Keystep 5-pin MIDI OUT connects to the MIDI Module (mode switch set to IN) over a Korg convention, 5-pin to 3.5mm adapter. (The O-Coast adapter adheres to the same convention and works, too.) With the MIDI approach, we don’t need to worry about over-driving the Oscillator module with a high, out-of-range voltage. The littleBits MIDI module tops out at 5V.

I have both the littleBits MIDI module and littleBits CV module. Thus, I can drive littleBits oscillators via MIDI and send the Keystep MOD CV to the littleBits CV module for modulation duties. With the Keystep MOD CV max voltage set to 5V, I should be safe. If I need to reduce the MOD CV range further, I can always run the output from the littleBits CV module into a littleBits dimmer (potentiometer) and attenuate the level.

The MIDI module approach also produces the gated CV signal expected by littleBits oscillators. The Keystep Pitch output provides a simple, steady voltage level and doesn’t have an in-built gating function. When you hit a key, the Keystep changes the Pitch output voltage accordingly and the Keystep holds that voltage even when the key is released. If connected to a littleBits Oscillator, the Oscillator will never see a release event, that is, the Pitch voltage never drops to 0V when a the key is released. The littleBits Oscillator merrily continues to play! On the other hand in littleBits-world, the gated CV drops to zero. Thus, littleBits combines pitch control and trigger (gate) into a single signal.

One could build a simple converter from separate gate and pitch CV to the littleBits gated CV. I’m thinking of a voltage-controlled SPDT analog switch like the Texas Instruments TS5A9411 (or MAXIM MAX4544, etc.). The trigger (gate) signal controls the switch. When the trigger is low, the signal connects to ground and passes 0V. When the trigger is high, the switch passes the Pitch CV signal.

Another possible work-around is to follow the littleBits Oscillator with an Envelope module and connect the Envelope’s trigger to the Keystep Gate output through a littleBits CV module. [Whew!] The Envelope should pass and shut off the Oscillator’s sound when the gate is asserted and dropped, respectively. I’m going to give this idea a go.

Copyright © 2020 Paul J. Drongowski