------------------------------------------------------------------- Frequency response user application for DSO Quad (Sys version 1.50) Published November 2011 by Petteri Aimonen ------------------------------------------------------------------- This is a frequency response application for the DSO Quad pocket oscilloscope. It is intended to be both useful as it is, and to provide a nice starting base for other application development on the DSO. Instead of replacing the default firmware, this program installs as APP4 by default (you can change this in Makefile). This means, if you start your DSO normally, it will go to the default firmware. If you hold down the 4th button while starting, it will boot into frequency response app. Building this application is best done using the Codesourcery gcc toolchain. The lite version (command line only) is free to download at https://sourcery.mentor.com/sgpp/lite/arm/portal/subscription?@template=lite Choose the "EABI" version. All of my code in this application are in public domain. However, atleast tinyprintf.c is under LGPL and some other files may also have restrictions. I want to thank gabonator1 on the Seeed studio forums for his dso203ui, which I copied the linker scripts and some startup code from. ------------------------------------ Compiling and installing under Linux ------------------------------------ 1. Download the TAR package of Codesourcery from the link above and extract it: wget https://sourcery.mentor.com/sgpp/lite/arm/portal/package8734/public/arm-none-eabi/arm-2011.03-42-arm-none-eabi-i686-pc-linux-gnu.tar.bz2 tar xjf arm-2011.03-42-arm-none-eabi-i686-pc-linux-gnu.tar.bz2 2. Add the tools to your path (path may vary depending on where you extracted them): export PATH=$PATH:~/dso/arm-2011.03/bin 3. Test that gcc works (it should print the version number): arm-none-eabi-gcc --version 4. Check out the source code and run make: svn co https://svn.kapsi.fi/jpa/dsoquad/freq cd freq make 5. Install the FREQ_APP.HEX to your device (turn on DSO Quad while holding button 1): sudo mount -t vfat /dev/sdb /mnt/dso sudo cp FREQ_APP.HEX /mnt/dso sudo umount /mnt/dso 6. Turn on DSO Quad while holding button 4 to enter the frequency response app. -------------------------------------- Compiling and installing under Windows -------------------------------------- 1. Download the Codesourcery arm-eabi Windows installer package from the link above and install it. "Typical" is ok. Select either "Modify path for current user" or "Modify path for all users". 2. Download the gnuwin32 make ("Complete package setup"), and install it: http://gnuwin32.sourceforge.net/packages/make.htm 3. Download source code for the frequency app. Either using a Subversion client or as a .zip archive. 3. Open command prompt (Start -> Run -> "cmd" -> ok) and navigate to the directory where the sources are: cd dso\freq 4. Run make (note that the gnuwin32 installer doesn't add it to the path, so you need to type the whole name): "C:\Program Files\GnuWin32\bin\make.exe" 5. Install the FREQ_APP.HEX to your device: 1) Connect DSO Quad to your PC using a USB cable and turn it on while holding button 1. 2) Copy FREQ_APP.HEX to the USB drive. 6. Turn on DSO Quad while holding button 4 to enter the frequency response app. (Note: the code uses Unix-style linebreaks, so in notepad it all appears on one line. Use wordpad or e.g. notepad++ to edit the code.) --------------------------------------- Features and general usage instructions --------------------------------------- Features: - Measures amplitude and phase response. - Saves CSV (text file) and bitmap. - High quality sine wave (8000 point table) - Uses DFT to discard noise on the input. - Selectable scan accuracy Connect the Wave out of DSO Quad to your device's input and CH A to the output. When started, the application does a fast sweep of the frequencies. After it is complete, you can either save the results or do a new sweep with more accuracy. The fast sweep measures 10 points for each decade of frequency, whereas the slow sweep measures 50 points. You can also select "Draw over" to keep the previous results visible while doing a new scan. This can be used for e.g. comparing different components. ------- Hacking ------- Main.c contains all of the main program logic and the graph drawing stuff. It is probably the easiest place to start if you want to customize the program. Rms_measurement.c contains a Discrete Fourier Transform implementation for detecting and measuring a waveform on the Channel A input. Signal_generator.c contains sine- and square wave output functions. The functions allow quite flexible setting of the output frequencies and the sine wave is much higher quality than in the default firmware. Ds203_io.c contains useful functions for graphics, text and file IO. They mostly interface the BIOS provided by the DSO Quad system firmware. -------------------- Some useful commands -------------------- Check the compiled binary size: arm-none-eabi-size -t build/FREQ_APP.elf TEXT is the ROM size in bytes and DATA + BSS is the RAM size. Maximum ROM for single app is 32 kiB and maximum RAM is 32kiB (+ 4kiB reserved for stack). List the per-function code sizes: arm-none-eabi-objdump -t build/FREQ_APP.elf | sort -k4 Browse the disassembly, for e.g. resolving HARDFAULT errors: arm-none-eabi-objdump -d build/FREQ_APP.elf | less