[sdiy] Microcontrollers for eurorack use... What to use?

rsdio at audiobanshee.com rsdio at audiobanshee.com
Mon Jan 5 00:08:40 CET 2015


On Jan 4, 2015, at 2:38 AM, Olivier Gillet <ol.gillet at gmail.com> wrote:
>> On the other hand, I've never had a project where I needed to use anything outside the provided IDE and debugger.
> 
> The problem is that most debuggers are not really designed for
> realtime DSP applications (though they are perfectly fine for
> debugging other functionalities of a synth - like the MIDI
> implementation, the user interface...). Few debuggers have plotting
> (TI's Code Composer almost gets it right though) or stream acquisition
> abilities, and when they have, they provide few options to perform
> analysis on the data. I wish instead they could work more like
> oscilloscopes and logic analyzers - with trigger conditions,
> measurements, cursors, protocol decoders... Say I hear an occasional
> click in the output of my DSP code. The easiest way I've found to work
> through such issues is to run the code locally, dump all state
> variables in a big file, and inspect it in a python shell in which I
> can evaluate expressions on the data and plot things to my heart's
> content. Sometimes that would even be outside the bandwidth of what a
> JTAG interface do.
> 
> Another thing I like doing which is not possible in an IDE is to
> automatically check if large code transformations still produce
> correct results (identical or with mostly small difference) - run the
> code locally to generate .wav files with both versions, load the data
> and compute statistics on the difference is what I do.
> 
> Overall, having the ability to quickly put a bit of DSP or applicative
> code "in vitro" to feed it very specific inputs and test patterns is
> something too precious to make me switch to an IDE. I guess it's a
> matter of the type of product - whether most of the development time
> will be spent (and value added will be present) in the low-level
> hardware functionality and interface, or in the DSP code/synth engine
> itself.

Excellent information, Olivier! I guess I took Code Composer Studio for granted, because I highly leveraged it's streaming audio buffer graphing features while developing for the TMS320 C5000 family.

When it comes to correct results, I ended up writing firmware that was a test environment for the DSP subroutines. The firmware would generate sine waves at specific frequencies, call the DSP subroutines with specific parameters, and then analyze the results. At first, I printed out values - CCS allows printf() from the DSP to appear inside the IDE. I don't think I would have figured out how to do that on my own. But eventually I just used CCS to graph the results of the tests, and then I could see any problems easily. CCS allows you to save a working environment with all of the graphs that you've set up, and I would load that whole collection whenever I needed to do analysis. When I was in the middle of DSP development, I had environments with half a dozen graphs, including real and imaginary buffers, input and output data, time domain and frequency domain. This all made it possible to carefully test everything.

One thing to consider is whether you're working on firmware for a "real" DSP, or simply doing DSP operations on a general purpose CPU. In the latter case, it's easy enough to run the "tests" on your Mac because Standard C is Standard C everywhere. But in my case, the DSP code is in assembly, and it's very difficult to simulate the same results when the processor has an instruction set that cannot be fully expressed in C. TI has a simulator, but since that runs inside CCS anyway, I found it just as easy to run on the actual processor.

In any case, it is very important to have some method of testing your DSP subroutines. Without careful control of input and output, you can't verify that the results will be correct when you run normal audio through. So, while I would encourage people to learn the capabilities of their IDE as well as learn the command-line tools, I suggest that they always follow your advice about testing - whether that testing occurs within the IDE or on the host computer command-line.

Brian Willoughby
Sound Consulting




More information about the Synth-diy mailing list