Turn $1.5 Blue Pill STM32 board into a Sigrok compatible logic analyzer

Blue Pill” is a popular STM32 development board thanks to its low cost – now as low as $1.50 on Aliexpress – and Arduino compatibility via the STM32duino project.

People have created all sorts of projects around the tiny STM32 board, but I find Mark (aka thanks4opensource) buck50 test and measurement firmware very interesting as it turns the Blue Pill board into a logic analyzer compatible with the open-source Sigrok command-line tool and PulseView GUI.

Blue pill STM32 logic analyzer sigrokMark explains the firmware is still at the beta stage, so bugs will most likely have to be fixed. Nevertheless, Buck50 firmware should enable the following key features on the Blue Pill board:

  • 8 channel, 6+ MHz logic analyzer
    • Approx. 5K sample buffer depth
    • Samples stored only at signal edges for efficient memory usage
    • Complex triggering via user-defined state machine supporting combinations of sequential (“A then B then C”) and logical-OR (“A or B or C”) conditionals
    • Output to VCD and other file formats for export to waveform viewing programs that include Pulseview, but also gnuplot, gtkwave, and Saleae Logic
    • Live monitoring and logging of digital, analog, USART (sync/async), SPI (MOSI/MISO), and I2C (master/slave/TX/RX) data
  • Dual-channel approx. 1 MHz digital storage oscilloscope, approx. 5K sample buffer depth (10K if single channel)
  • Triple-channel digital pulse train generator with user-defined frequency and per-channel duty cycle and polarity
  • Bidirectional bridge/converter from USART/UART (async/synchro), SPI (master/slave), or I2C … to USB … to host terminal, UNIX socket, or UNIX pty device file
  • 8-bit parallel output counter (binary or gray code)
  • Host terminal ASCII or binary input data to 8-bit parallel output
Blue pill Buck50 connection diagram
Connection diagram for Buck50 test and measurement firmware

The firmware is written in C++ and ARM Thumb-2 assembly code, and a Python host driver program is also provided to control the board. There’s amazingly detailed documentation on Github, and the developer invites people to submit bug reports on the issue tracker as well.

I found the project announced on Sigrok mailing list, where some discussed the potential for STM32 fakes, and that using more recent STM32 chips may deliver better solutions without going into details (yet(.  This made me think about the NXP Cortex-M7 powered Teensy 4.1 board, but there’s already a logic analyzer firmware for that board: TeensyLogicAnalyzer, also compatible with Sigrok.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX RK3588 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
22 Comments
oldest
newest
geokon
4 years ago

Thanks for this! I coincidentally I just restarted working with bluepills! I’m going to need to try it out I think it’s amusing how you can use bluepills to flash bluepills and now bluepills to debug bluepills 🙂 I originally wanted to try something out with a Longan Nano, but setting up the tools ended up being a bit onerous.. so I came back to the venerable these. A couple of things I’ve found: 1 – There are some “improved” bluepill that has USB-C: https://github.com/WeActTC/BluePill-Plus I just ordered a couple and I’m waiting for them to arrive. Though it’s my… Read more »

David Willmore
David Willmore
4 years ago

I just got a few Longan Nano boards and followed: https://longan.sipeed.com/en/get_started/pio.html

It was super easy to do. I found some examples: https://github.com/linusreM/Longan-RISC-V-examples

Maybe give those a try?

I just got some STM32F401 and 411 boards to try out. Looks like I got upgraded 401 boards with more memory and ram. Yay!

geokon
4 years ago

Oh yes, sorry – I was being a bit pedantic and yak-shave-y. To be more precise I was trying to get things working with libopencm3 and without platformio. But that’s my own hangup.. I’m not a fan of platformio. Obviously their devs put in a lot of work b/c the whole premise is wrong.. and it’s intentionally reinventing the wheel to create lock-in for their platform. It doesn’t do anything that you can’t accomplish with cmake/gcc/gdb/openocd I’d really recommend giving the cmake/openocd workflow a try. It’s a breath of fresh air. Using a knock off STLink and a bluepill git… Read more »

Jeroen
Jeroen
4 years ago

Teensy 4.1 is actualy powerd by a nxp M7, not a STM.

itchy n scratchy
itchy n scratchy
4 years ago

Found that one a while back, while desperately needing a logic analyser. Never got to try it yet.

Just ordered a couple of black pills with STM32 M4F cores, sounds like the perfect starting point for a DSO 😉

David Willmore
David Willmore
4 years ago

Which ones? I just (finally) received my:
https://stm32-base.org/boards/STM32F411CEU6-WeAct-Black-Pill-V2.0
https://stm32-base.org/boards/STM32F401CCU6-WeAct-Black-Pill-V1.2

The v1.2 came with the CEU6 chips, so they have more flash and ram. Maybe there’s a V1.x with that change. I’m pretty new to these. I’m pretty familiar with the blue pill type boards, but I’ve never used any of the F4 chips.

itchy n scratchy
itchy n scratchy
4 years ago

Same here, waiting for shipment.

I ordered the 411 variant, not sure which chip exactly, as I never got into M4f so far. But with 10$ for 2 incl. tracked shipping can’t complain ?

David Willmore
David Willmore
4 years ago

I ended up with four of each variant F411 and F401 for around $28 shipped to the USA. Took two goes at it because it seems the first order got flagged by customs for some strange reason. Had to dispute the order and reorder (and wait). It appears the boards are clones, not actual WeAct boards, FWIW.

itchy n scratchy
itchy n scratchy
4 years ago

Definitely hard to know who are clones and who are not.

Here customs are pretty reasonable, up to about 60 -65$ its free, if they don’t trust the declaration they send a letter asking for cc statement. If it’s above you pay sales tax and around 20$ postal fees. Never anything didn’t make it. Except if our FCC counterpart has something on their list, but not sure what would happen then.

geokon
4 years ago

As I linked above – they have a github with links to what I expect to be legit online stores

(or maybe I’m naive..)

itchy n scratchy
itchy n scratchy
4 years ago

Well to be honest I don’t think the pills have enough engineering into them to whine over IP. In pre Arduino times we would do such minimal boards over n over again by ourselves…

ben
4 years ago

Anyone familiar with Sigrok/Pulseview? I understand it’s an open source GUI for various logic analyzers / oscilloscopes… I’ve got a DMM that can transmit its readings to a PC via a (usb) serial port. I was thinking I could write a serial driver that gets the dmm samples and plots.. is it possible to integrate this with Sigrok? I imagine, Pulseview would have to repeatedly poll my driver for data and plot. I’ve looked at the Sigrok files, but don’t see the big picture on how it works, or more specifically, where I would need to tap into it to… Read more »

Jean-Luc Aufranc (CNXSoft)

I’ve not written any drivers, but I did test it with a digital multimeter in the past:https://www.cnx-software.com/2015/03/07/sigrok-and-pulseview-in-ubuntu-14-04-with-uni-t-ut61e-digital-multimeter/

So that’s definitely a use case. It’s also possible your DMM is already supported.

David
David
4 years ago

Yes, I use Sigrok/Pulseview sometimes. The simplest/cheapest way to get started is to first do some reading on the Sigrok/Pulseview pages. The next step is to get a Logic Analyzer (hardware). Most people start with one of the cheap Saleae/USBee-AX-Pro 8 channel 24 MHz logic analyzer clones that cost between ~$5.00 and ~$13.00 USD depending on where you buy it (e.g. AliExpress/Ebay/Amazon) and whether shipping is included. For example, this logic analyzer costs $12.49 on Amazon, it is sold by a fairly reputable seller, it has a warranty, is returnable, and it comes with “free” trackable 2-day ConUS shipping if… Read more »

Marcin Dąbrowski
4 years ago

Now I wonder how much better would it work with GD32V

itchy n scratchy
itchy n scratchy
4 years ago

Is the GD32V expected to be better? Never got even knee deep into the matter so far…

David Willmore
David Willmore
4 years ago

I feel compelled to point out that if someone wants to skip all the building, you can get the Salee clones very inexpensively and that gives you 8 channels at 24MS/s. Looks like I paid $5 (USD) for the last ones I bought–shipping included.

itchy n scratchy
itchy n scratchy
4 years ago

The appeal of the blue pill solution is just I’m having one in my drawer, as opposed to waiting for weeks for a chinese parcel to arrive once I need a LA ?

David Willmore
David Willmore
4 years ago

I agree that it’s not a bad solution if you have some urgency, but this thread is now talking about trying out boards they don’t have for this application. In that context, just buy the little logic analyzer boards. Heck, everyone go out and order one now so that you have it should you need it. Once you have a tool, you’ll be surprised at how often you end up using it. We work around problems because we don’t have the right tool. But once we have the tool, all that working around is no longer necessary and we really… Read more »

itchy n scratchy
itchy n scratchy
4 years ago

Well true.

As a hobbyist sometimes we just do work arounds because we can, as a (semi) professional, I would probably get something slightly more capable, i.e. more channels etc.

And a uC never makes a decent DSO, or specan, so once you have to deal with CE, FCC, UL, IC and other similar things you better be equipped.

Boardcon Rockchip and Allwinner SoM and SBC products