« Back to “DSO Quad”

Frequency response application

To ease frequency response measurements on audio stuff, I wrote a program using the integrated DAC on the DSO Quad.

Measuring principle

Self response of the device. Self response of the device (with output connected directly to input).
Response of a RC filter. Response measured of a 1 kohm + 47 nF RC-lowpass filter.
Comparison with manual measurements. The manual measurements of headphone attenuator compared to measurements with DSO Quad. Notice how the dynamic range ends at -60 dB.

While the default firmware (constrained by memory requirements, probably) uses just 36 samples for sine wave generator, I allocated space for 8000 samples. The actual wavetable is generated on the fly using sinf(), which is a bit slow but allows setting the frequency very accurately.

For detecting the wave amplitude and phase, I use a DFT, again implemented using float math which is a bit slow as the STM32 does not have a floating-point unit. However, I only need to do it for the specific frequency (which is why FFT would not be any faster), and it is very efficient in filtering out the noise in the measurement.

The internal DAC has a maximum samplerate of 1 MHz. Based on my tests, it seems that 200kHz sine wave (5 points per cycle) is still accurate enough for measuring the frequency response, though it does look quite awful on waveform display. The phase response starts to veer off a bit even before 200kHz, and amplitude response drops off quickly after that point.

Installation and usage

I want to encourage people to take advantage of the open source nature of the DSO Quad. Therefore, I have tried to provide as good installation and compiling instructions as possible, to help anyone get started with custom apps.

To install, you need the HEX-file for the application. Note that, by default, this does not overwrite the default firmware, instead it installs as application number 4, which you can select when turning on the device.

Drawing of which button starts which application on the DSO Quad.

First boot the device into the bootloader, by turning it on while holding the leftmost button. An empty USB drive should appear on your computer (note that it does not have a partition table, so you may have to manually mount -t vfat /dev/sdb /mnt/dso under Linux). Copy the HEX file there, wait a few seconds and you are done.

To start the application, hold the fourth button down while turning on the power.

The application will start measuring immediately when started. Input should be connected to channel A. You can abort the measurement and enter the menu by holding down any key for a few seconds.

Source code and compiling

I hope that more people will spend a little time creating custom software for the DSO Quad, building a wide selection of programs for different purposes. There is already one project by gabonator1, and I must thank him a lot for leading the way - I consulted his sourcecode at many points. His project is about replacing the default user interface.

For now, I'm going to focus on small applications as that will yield something usable much sooner, and the default firmware isn't all that bad for the general use.

You can get the source code on SVN or as a zip archive:

svn co https://svn.kapsi.fi/jpa/dsoquad/freq

Compilation instructions for both Windows and Linux are in the README. I'm using the Codesourcery toolchain, but other arm-none-eabi toolchains should work, too.

If you have any trouble compiling or running the application, please contact me.

– Petteri Aimonen on 1.11.2011

Comment on this page (19 comments so far)