Blue Pill As A Nerdy Swiss Army Knife

Not everyone can afford an oscilloscope, and some of us can’t find a USB logic analyzer half the time. But we can usually get our hands on a microcontroller kit, which can be turned into a makeshift instrument if given the appropriate code. A perfect example is buck50 developed by [Mark Rubin], an open source firmware to turn a STM32 “Blue Pill” into a multi-purpose test and measurement instrument.

buck50 comes with a plethora of functionality built in which includes an oscilloscope, logic analyzer, and bus monitor. The device is a two way street and also comes with GPIO control as well as PWM output. There’s really a remarkable amount of functionality crammed into the project. [Mark] provides a Python application that exposes a text based UI for configuring and using the device though commands and lots of commands which makes this really nerdy. There are a number of options to visualize the data captured which includes gnuplot, gtk wave and PulseView to name a few.

[Mark] does a fantastic job not only with the firmware but also with the documentation, and we really think this makes the project stand out. Commands are well documented and everything is available on [GitHub] for your hacking pleasure. And if you are about to order a Blue Pill online, you might want to check out the nitty-gritty of the clones that are floating around.

Thanks [JohnU] for the tip!

15 thoughts on “Blue Pill As A Nerdy Swiss Army Knife

  1. No, with the endless supply of Chinese clones costing next to nothing, this is only valid as a learning experience. Dave Jones has reviewed quite a few clones. And if you cannot find your tools then clean up!

    1. Really. Those Chinese $5 Sigrok/PulseView compatible 8-bit Saleae/USBee AX Pro logic analyzer clones run at 24 MHz using just an 8051 copycat processor. So why does this Blue Pill thing max out at just 6 MHz with an STM32F103C8T6 Cortex-M3 running at 72 MHz? Both use RLE. The 8051 uses more clock ticks per instruction than the Cortex-M3. Maybe it’s the driver written in slowpoke Python?

      1. AFAIR the Cypress chips are _designed_ to push data between USB and parallel interfaces, so they feature dedicated hardware FIFOs that talk to USB. The 8051 is there to configure some registers, handle USB control requests and that’s about it.

      2. >Both use RLE

        No RLE in FX2. 8051 in FX2 doesnt touch the data, its there to manage FIFO buffers/GPIF state machine.

        The busiest 8051 can get is in manual mode:
        “8051 receives an interrupt on the buffer being filled with USB data and connection of the buffer to the endpoint is under 8051’s control. This mode is better known as the manual mode. In this mode the 8051 is in charge of “committing” the data when the number of bytes in the buffer meets the value set in EPxAUTOINLEN register.”

        think ancient times ISA Sound Blaster Single-cycle DMA Mode

        FX2 USB limits are dependent on Host controller its plugged into, most likely:
        “receive 10 bulk packets/microframe (40.96 MB/s) or
        send 8 bulk packets/microframe (32.768 MB/s)”

        while theoretical USB 2.0 max is 13 bulk packets/microframe. 1 millisecond frames divided by 8 micro-frames and 512bytes per packet:
        1000 * 8 * 512 * 13 = 53248000 ~= 53 MB/s

        FX2 GPIF interface itself can transfer at up to 96MB/s in 16bit mode.

        Cortex-M3 problems lie in the bus GPIO is connected to and its speed. According to docs
        “I/Os on APB2 with up to 18 MHz toggling speed”

  2. “buck50 comes with a plethora of functionality built in which includes an oscilloscope, logic analyzer, and bus monitor.”

    Add a signal generator, specifically a DDS AWG running on inline assembler code. Carefully coded, an 8-bit DDS AWG via an R2R DAC should get you nice sinusoids at up to 500+ kHz without a LPF on a 72 MHz STM32F103C8T6 (Cortex M3) Blue/Black Pill.

    1. I agree, particular when a reasonable clone logic analyser is under $10. I bought a few about 5 years ago (a few for spares etc) and the first one is still working and I’ve given the spares to friends…

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.