Skip to content

mmahdim/STM32F4-Scope

Repository files navigation

STM32F4-Scope

7.2 MSa/s Digital Oscilloscope Using the STM32F429 Triple Interleaved ADCs

DOI

Table of Contents

Specifications

Specs Description
Sample Rate 7.2 MSa/s
Resolution 12 bits
Input Range (Without analog frontend) 0-3.3v
Channel Count 1
Buffer Size 6000 samples
UI Touchscreen, PC(through VCP)

Hardware

I used the STM32F429 discovery board.

Pins

PC3 is used as the analog input, and PE2 is used as the trigger input. (in the demo they are both connected to the same input.)

Buttons

The green button on the discovery board acts as stop/start button. You would need to stop the oscilloscope in order for the touchscreen to become responsive.

Analog Frontend

The microcontroller ADC input can only handle 0-3.3v. Therefore, there's a need for a circuit to amplify/attenuate the incoming analog signal without distorting it. Furthermore, the trigger signal needs to be generated by an external circuitry.
Because of that, I designed an analog circuit in order to condition the signal and also generate the trigger signal. The circuit that I designed is based on the DS203 oscilloscope schematic, which you can find online.
I have to note that I did not have the time to properly test this circuit and build it, and therefore it might not be functional. Therefore, use it at your own risk.
Below you can see the schematic drawn in LTspice. The circuit uses two OPA356 as amplifier, and a ADG658 as an analog switch to switch the gain setting.
The 9Meg resistor at the input is the probe's internal resistance in 10x mode. To generate the trigger signal, my original plan was to use an analog comparator which would compare the Aout signal with a voltage generated by the MCU's DAC as a reference voltage for trigger. The comparator has to be fast enough. In my original plan I ordered a LT1016 and a AD8561ARZ but did not have the time to test them.

image
Spice models for the OPA356 and ADG658 are available in their manufacturor websites.
The 0.2pF capacitors are there to model parasitic capacitance of resistors.

Software

CubeIDE & TouchGFX have made this project available.

Buffer

Just as a normal DSO, this project also utilizes circular buffers, which enables it to capture the waveform even before the trigger event. Half of the DSO buffer is dedicated to the pre-trigger and the other half to the post-trigger data samples.
The total circular buffer implemented has capacity for 6000 samples.

Interface

When the oscilloscope is stooped, you can press the arrow button to send the captured waveform through the COM port into the PC.
You can also use the zoom in and zoom out buttons by pressing the magnifier icon, and use the scroll bar to navigate through the waveform.

To Do

Needs some cleanup, and also some features like Volts/Div and Time/Div are not fully implemented yet. Sample rate is fixed to 7.2 Msps. Might do the cleanup and the complete the project if it received enough attention.
I also have written a Python application which receives the waveform from the USB VCP and displays the waveform on PC.

Installation

You need to open the .project file in the stm32cubeIDE and then program it to your chip.
In order to use the PC interface python program, change the COM port in the python source code to your desired COM port.

Demo

Here's a youtube Demo:
https://www.youtube.com/watch?v=pv_ZHL44sbU
(in the video the wires are loose and the distortion is due to that.)

Touchscreen Interface Demo

image

PC Interface Demo

image

How you can support this project

Donations are welcomed.
BTC:
3NVDwQH3wSLXiwQvm47fbM1ThZPCU62MUn

ETH (ERC20):
0xb8c32ac8c7fcaaa3b01ba43b2a8c06b507a31f2c