Miniscope v2d

Cheap low-speed dual channel PC/USB oscilloscope and arbitrary waveform generator with STM32F3 microcontroller.

Miniscope v2d is based on STM32F303CBT6 microcontroller - LQFP48 device from STM32F3 family featuring:

STM32F303CBT6
STM32F303CBT6 is pin compatible with STM32F103C8T6 used in miniscope v2c and previously designed PCB could be reused. Still few changes were made to make better use of STM32F303. USB pull-up resistor can now be controlled by software and is also disconnected when device is in reset state to allow re-enumeration without physical disconnecting and more convenient switching between bootloader and user firmware (DFU is intended to be used to upload firmware).

As a side note: it looks like DFU is not working on similar STM32F37x microcontrollers (ebrombaugh.studionebula.com).

STM32F30x ADCs are significantly faster than in STM32F1 (7.2 MSPS in 8-bit mode), but practical sampling speed is limited because of lack of input buffer. Of course PGA would help with getting optimal combination of speed/precision, sensitivity and acceptable input impedance.

miniscope v2d PCB

IDE

Since STM32F303 is still (2013.04) not officially supported by CoIDE (that was used with miniscope v2c) and latest CoIDE versions are getting enormous (1.8 GB installed) I've switched to plain Eclipse for C/C++ (Juno SR2), gcc (gcc-arm-none-eabi-4_7-2013q1-20130313-win32.zip) and build tools from MSYS for initial development and later to Keil (free version with 32 kB code limitation).

Project files

Note: using this hardware directly is not recommended - chosen analog channels set does not allow to use integrated PGA of STM32F3 (routing of opamps inputs is limited).

Schematic: miniscope_v2d.pdf

Eagle files: miniscope_v2d_20130413.zip

PCB photo:
Miniscope v2d top side
Miniscope v2d bottom side

Firmware can be also used without any changes (not even recompiling) with STM32F3DISCOVERY (thanks to Aldo for testing and reporting).

Firmware

Initial board test ("LED blink" using buzzer), Eclipse + gcc: STM32F3_test_20130505.7z.

Oscilloscope firmware, Keil: miniscope_v2d.7z and dll library: miniscope_v2d_dll_1ch.7z. This firmware is limited to single channel mode sampling and streaming data countinously at 750 kSps speed - mostly it doesn't make use of STM32F3 over STM32F1 improvements. Unless you would like to built upon or already have STM32F3DISCOVERY or similar board miniscope v2c might be currently better choice.

2013.06.09: 2-channel version (2 x 428.6kSps).
miniscope_v2d_2ch_20130609.7z
miniscope_v2d_dll_2ch_20130609.7z

2013.06.15: Changed input divider to 27k + 22k and updated sensitivity in device library. Added arbitrary waveform generator function:

Firmware: miniscope_v2d_AWF_20130615.7z
Dll for miniscope v4: miniscope_AWF_dll_20130615.7z

Updated dll: miniscope_v2d_AWF_dll_20140103.7z (added standard shapes generator - sinus, square, triangle, sawtooth, noise, added text status to drawing window giving information of current cursor position).
Miniscope v2d standard shapes waveform generator

Generator demonstration - channel A connected to own DAC output, channel B connected to 51 Hz square wave for reference:

Complementary tools

bin2dfu

While STM DFU file manager tool does the job, running it with every build gets tedious. Since DFU(Se) file format is described in STM's UM0391 note and also DFU file manager comes with source code writing its replacement is not difficult. Bin2dfu is a command line utility allowing to create dfu file from bin file by adding appropriate rule to makefile:

    $(PROJ_NAME).dfu: $(PROJ_NAME).bin
	     @tools/bin2dfu --i $(PROJ_NAME).bin --a 0x08000000 --o $(PROJ_NAME).dfu  
  

Parameter --a specifies starting address for bin file. It may have to be modified if additional (not ROM-based as in STM32F303) bootloader is used. Since this tool was not tested outside of this project it is not recommended to use if bootloader is not recoverable (risk of overwriting user bootloader in FLASH).

Executable with Code::Blocks/MinGW sources: bin2dfu.zip.

DFU loader

Small modification of DFU loader from ST Micro-electronics Device Firmware Upgrade (DFU/DfuSe) from C# article by Mark McLean. It has less features than STM DfuSe Demo tool, but is more handy when frequent firmware reloading is needed (USB DFU is the only one method to update miniscope v2d firmware and firmware development requires lot of testing and try-and-error). By auto-programming device when it is detected whole programming can be initiated and finished using only pushbuttons on board (RESET + BOOT to enter DFU mode and reprogram, RESET to leave DFU mode and run from FLASH).

Application requires two libraries from STM DfuSe Demo: STDFU.dll and STTubeDevice30.dll (you would have to install DfuSe Demo anyway for USB drivers) and .net 3.5 runtime.
C# DFU loader

Executable with Visual C# 2008 project/code: DFU Example 20130515.zip


 "Cookie monsters": 1050053    Parse time: 0.020 s