or « Will my STM32F4-discovery board replace Arduino/Bus Pirate ? « …
Well I needed a logic analyzer to track some bugs in a project I am working on, but that could do more than the Bus Pirate OLS mode…
So I found this on the web : SUMP compatible logic analyzer code for Arduino.
But I also wanted a higher sampling rate.
- The code for the SUMP protocol was there from the Arduino project.
- I had the STM32F4 handy (the same I used for the MP3 – libmad port)
- The libopencm3 had a simple working example of a USB-CDC on the Discovery board
Go… Mixing everything in that code : here.
(you need libopencm3 in /opt/libopencm3)
Code update 28/04/2103 : Acquisition rate was in fact 21Mhz, there was a bug in function « cdcacm_data_rx_cb », the acquisition loop is now in an asm-inline code which should prevent different code optimization by different compiler versions. Those problems were submitted by Iosif in the comments, many thanks to him. Here is the new code.
After some tests + optimizations , here is the result :
2421Mhz sampling, 8 channels (port PE8-15).
(For the moment, there is no configurable trigger, sampling frequency / buffer size. This is just raw code for my needs.)
- Acquisition of a 1Mhz square wave generated by an Arduino
(5v to 3v3 via a Zener diode – be careful STM32F4 is not 5V tolerant)
- As it was mentioned in the comments, most STM32 pins ARE 5v tolerant, and I have confirmed this in the DM00037051 document, pages 48 & 49.
Setup (a ols.profile file is provided in the tgz)