XMOS Board + Wavefront DSP Board

Started by markseel, February 12, 2012, 08:49:15 PM

Previous topic - Next topic

markseel

Hi All,

I started a new project  ;D.  It uses the XMOS XS1-L1 for the peripheral processor and program loader, and a number of AL3102 Wavefront DSP's for audio processing.  Here's how it works:

1) The 'main' board contains the XMOS XS1-L1, FLASH memory, crystal oscillator, switching voltage regulators, and passives to create a single board for developing XMOS programs.  It has a the XTAG connector that you connect to an XMOS JTAG emulator called an XTAG-2 that allows you to load and debug XMOS programs, burn programs and data to FLASH, and to receive debug information in real-time (see 'XSCOPE').

2) Here's a layout of the board: https://picasaweb.google.com/111829367884437703386/NextAudioDigitalAudioSignalProcessor#5708424406608386658

3) The 'dsp' board connects to 'main' board and has multiple Wavefront AL3102 DSP's (the DSP core is called the DSP-1K).  Each DSP is boot-loaded via the 'main' board (the DSP programs are stored in the FLASH on the 'main' board).

4) While running (processing audio) the 'main' board continuously updates each of the DSP's with parameter data (from external pots connected to low-speed ADC's, or from a table of parameters accessed via rotary encoders, etc).

5) A third board could reside in-between the 'main' board and the 'dsp' board using the same method of connecting the boards together (28-pin angled male/female header/socket pairs).  This board could use the remaining 'main' board I/Os for the rotary encoders, low-speed ADC control, led displays, serial interface to lcd/oled displays, or whatever.

6) To create DSP programs you would use either the Wavefront assembler or Python scripts (see this forum's postings 'Simple DSP' and 'Next DSP Effects Board') for explanations of how Python is used).  The DSP-1K object code is then burned into FLASH using an XMOS command-line tool that's used for uploading XMOS programs and data.

7) I'd supply the XMOS code (and compiled program image) for booting the DSP and loading the DSP programs but since the 'main' board has the XTAG connection anyone could modify the program to add more functionality.  This allows one to add code (using XMOS's development environment) and hardware (by adding boards with the 28-pin connectors) to increase system function.

8) The XMOS JTAG (called XTAG) is only $20 from Digikey!!

I was going to use the XMOS for DSP but it's more work to make a DSP program for that platform than it is for the Wavefront DSP.  The Wavefront part handles the fixed fractional math details, performs automatic memory addressing for FIFO's, and also has functions for log/antilog - and it does these at 50 MIP's.  So doing a single tap for an FIR for the DSP-1K takes one instruction (and one instruction cycle!) while the same function on a conventional CPU (like the XMOS core) takes up to six (load coefficient, load sample, multiply/accumulate, shift accumulator right to maintain decimal point, increment coefficient pointer, increment sample pointer).  So 50 DSP-1K MIPS is comparable to 300 CPU MIPs.  Not bad for an IC that draws only 31 mA.

The 'main' board has been layed out - I'll receive sample boards to test this week.  I'm working on the DSP board now.  I'd probably sell the main board for $30 - $40.  Not sure about the DSP board.  Either way I'll post the GERBER's in the near future for each so people can make their own if they want to.

Currently the DSP board has two AL3102 DSP's and one AK4556 Audio Codec.  I could design it to support four DSP's but that's probably overkill.  That's be 200 DSP-1K MIPs (approximately 1200 CPU MIPS  :icon_eek:).  Also, I wasn't sure if I sure include the CODEC or not.

Thoughts or suggestions anyone?

SISKO

Ive been always interested on your works! Cant think of a suggestion, but just say that Im following you and waiting till you have everything done in here. Hopefully, this would be one of my projects to do this year (nothing related to school, just for hobby). I was trying to decide wich was better, if Spin-Semi Fv-1, your first project or the second one. But when I read about you saying that it would be some news about a third project, I got very excited!

So, nothing that contribute to your work per se. Just wanted to let you know how I feel :)
--Is there any body out there??--

markseel

#2
Thanks SISKO :)  I'll keep the post updated as I go along.  Suggestions are always welcome!

Here's a picture of the 'main' board (with XMOS CPU) layout:



markseel

#3
Got the board running after a few changes.

I updated the board layout.   I swapped out the TPS62237 and TPS62239 switching regulators (1.0V and 3.3V) for a FAN5358  1.0V switcher and a 3.3V linear for easier assembly.  I also removed the FLASH.  The board still has connections for the FLASH (D00, D01, D10, D11) therefore attached boards can include the FLASH memory.

Using the XTAG2 JTAG adapter an XMOS program can send data to the PC using functions like 'printf'.   The setup looks like this:

XMOS Board ---(printf)---> XTAG JTAG Adapter ---(USB)---> PC

I tested the throughput of this board and the XTAG2 for data sent to the computer from an XMOS program via 'printf' functions.  My laptop is pretty slow (1.2 GHz Core2 Duo) but I was able to get 2.4 Mbits/sec.

So one could make a simple attachment board for this XMOS board that streams 24-bit 48 kHz audio from a ADC using this arrangement:

ADC Board ---(I2S)---> XMOS Board ---(JTAG BUS)---> XTAG JTAG Adapter ---(USB)---> PC

I have I2S code running on the XMOS so I'll make an audio adapter board and try this out  ;D

Here's the latest main board layout.  Pretty simple; an XS1-L1 48, two regulators, a crystal, a power-on delay, and some passives:





markseel

#4
Here's an attachment board for the XMOS main board.  It has 3 Wavefront AL3102 DSP's that are daisy chained.


markseel

For the DSP board in the previous post:

Each DSP has 4 digital audio (stereo) inputs and 4 digital audio (stereo) outputs.

Channel 1 for all DSP's is used to carry audio data and are used to form the following signal path:
ADC --> DSP1 --> DSP2 --> DSP3 --> DAC

Channels 2,3,4 for all DSP's are used to carry parameter data for effecting the DSP algorithm's behaviors.  Each channel natively carries 24-bit  left/right audio (two audio words, 24-bits each).  The XMOS IC instead uses this 48-bit data to encode 6 8-bit parameters (ranging in value from 0 to 255).  Therefore each of the three DSP's can have up to 18 parameter adjustments (36 total!) that are sent to the DSP's at the sampling rate of 48 KHz.

Each DSP also has a two-wire port (SDA and SCL) for program downloading.  The XMOS downloads the programs for each DSP using this bus.

Here's a diagram:



I'll get DSP board PCB's in a few weeks.  Until then I'll lay out the CODEC board that has the 48 kHz 24-bit audio ADC and DAC along with some analog circuitry for intrafaceing to the guitar and such.

markseel

#6
Here's the analog interface board containing signal conditioning and the 24-bit 48 kHz stereo CODEC (AK4556).  It has an input for guitar and an output for the amp.

The board can be connected directly to the XMOS main board for streaming guitar to the PC (and thus just using the boards input) or can be connected to the Wavefront AL3102 x3 DSP board for creating a digital effects chain with a guitar input and ouput for the amp.

The interface circuit consists of four op-amps. The first opamp buffers the imput signal (for a high impedance input for the guitar). The second opamp amplifies the guitar signal by 12 dB in order to increase the SNR at the ADC's inputs.  Soft clipping via the two diodes prevents hard clipping.  The digital effects chain includes overdrive/distortion algorithms but I wanted to perform some of that overdrive in the analog domain to help mitigate loss of precsion of the digitized signal when incorporating digital gain.  Anyway, the slightly amplified, and possible mildly clipped when playing hard, signal is fed to two opamps.  The signal now has a maximum aplitude of about 1.4 volts pk-pk due to signal compression from the diodes.  The two opamps amplify the signal slightly in order to ensure that the full dynamic range of the ADC inputs are used (about 2.3 volts pk-pk). One of these two opamp is inverting, the other is non-inverting. The two outputs are fed to the two ADC inputs (one output to left, other output to right).  The DSP program then should subtract the left from the right - this increases the SNR by 6 dB.

The schematic and PCB layout are below.





markseel

#7
Here's how the boards stack up so far:





fairfield

This is incredible.
I'm downloading the XMOS dev tools right now.
Can't wait to see more.
Guillaume Fairfield
Fairfield Circuitry

markseel

#9
The XMOS development tools are free from XMOS and includes an IDE as well as command line tools.

I'll supply pre-built programs for two different applications:

1) Streaming guitar audio from the analog board to the PC using the audio board connected to the main board.
2) Downloading three DSP programs to the DSP board to implement an effects chain using the audio board, DSP board and the main board.

APPLICATION 1:

For using this system to stream audio to the PC: Use the XMOS command line program loader to run the XMOS program that reads data from the ADC's and sends the data to the PC via the JTAG interface.

c:\> xrun xmos_stream.xe | my_program.exe

'xrun.exe' is the command line program loader from XMOS.
The 'xmos_stream.xe' file is the xmos program that streams the ADC data to the PC (24 bits at 48 kHz)
'my_program.exe' is any command line program that you'd use to process, store or play the audio data.

APPLICATION 2:

For using this system as an effects chain: Build your DSP programs using the Python-based DSP assembler (see my posts for the Simple Audio DSP Module) and then use the XMOS command line program loader to run the XMOS program that loads the DSP's.

c:\> nextdsp.py dsp_program_1.py > dsp_program_1.hex
c:\> nextdsp.py dsp_program_1.py > dsp_program_2.hex
c:\> nextdsp.py dsp_program_1.py > dsp_program_3.hex
c:\> xrun xmos_effects.xe dsp_program_1.hex dsp_program_2.hex dsp_program_3.hex params.txt

'xrun.exe' is the command line program loader from XMOS.
The 'dsp_program_x.py' files are the DSP programs (Python scripts that generate the DSP op-codes).
The 'dsp_program_x.hex' files are compiled Wavefront AL3012 programs.
The 'xmos_effects.xe' file is the xmos program that loads the dsp's.
The 'params.txt' file contains the 58 parameters for the three DSP programs.


markseel

I'm working on DSP programs to implement a full effects chain that uses all three DSP's and implements compression, distortion and chorus.

Overdrive/Distortion - Multi-stage distortion algorithm consisting of non-linear wave-shaping using logarithms.  There's two stages of overdrive.  Each overdrive stage includes the following sub-stages; mid-range emphasis, upsampling, clipping via log/antilog wave shaping, downsampling, and low-pass filtering.  Each clipping stage has adjustments for clipping thresholds, softness/hardness, and asymetry. 

Equalization - 13 band graphic EQ

Chorus - Up to 30 millisecond chorus with up to three simultanious chorus voices.  Each voice has adjustmenst for mix level, delay modulation rate, delay modulation depth, and base delay.

The effects chain is:

Compression
Parametric Pre-Overdrive EQ
Overdrive/Distortion Stage
Parametric Pre-Overdrive EQ
Overdrive/Distortion Stage
13 Band Graphic EQ
Chorus

There's three DSP's.  Each DSP can execute up to 1024 instructions for each audio sample, has 1024 words of sample memory, and supports 18 parameters.  Given these the effects chain algorithms are arranged as follows:

DSP 1 - Adjustment 1: Compression threshold
DSP 1 - Adjustment 2: Compression ratio
DSP 1 - Adjustment 3: Compression knee hardness
DSP 1 - Adjustment 4: Compression attack
DSP 1 - Adjustment 5: Compression release
DSP 1 - Adjustment 6: Compression make-up gain
DSP 1 - Adjustment 7: Parametric EQ 1 center frequency
DSP 1 - Adjustment 8: Parametric EQ 1 bandwidth
DSP 1 - Adjustment 9: Parametric EQ 1 gain/cut
DSP 1 - Adjustment 10: Overdrive stage 1 signal gain
DSP 1 - Adjustment 11: Overdrive stage 1 positive signal clipping threshold
DSP 1 - Adjustment 12: Overdrive stage 1 negative signal clipping threshold
DSP 1 - Adjustment 13: Overdrive stage 1 positive signal clipping hardness
DSP 1 - Adjustment 14: Overdrive stage 1 negative signal clipping hardness
DSP 1 - Adjustment 15: Parametric EQ 2 center frequency
DSP 1 - Adjustment 16: Parametric EQ 2 bandwidth
DSP 1 - Adjustment 17: Parametric EQ 2 gain/cut
DSP 1 - Adjustment 18: Unassigned

DSP 2 - Adjustment 1: Overdrive stage 2 signal gain
DSP 2 - Adjustment 2: Overdrive stage 2 positive signal clipping threshold
DSP 2 - Adjustment 3: Overdrive stage 2 negative signal clipping threshold
DSP 2 - Adjustment 4: Overdrive stage 2 positive signal clipping hardness
DSP 2 - Adjustment 5: Overdrive stage 2 negative signal clipping hardness
DSP 2 - Adjustment 6: Graphic EQ band 1 (50 Hz) gain/cut
DSP 2 - Adjustment 7: Graphic EQ band 2 (80 Hz) gain/cut
DSP 2 - Adjustment 8: Graphic EQ band 3 (128 Hz) gain/cut
DSP 2 - Adjustment 9: Graphic EQ band 4 (205 Hz) gain/cut
DSP 2 - Adjustment 10: Graphic EQ band 5 (328 Hz) gain/cut
DSP 2 - Adjustment 11: Graphic EQ band 6 (524 Hz) gain/cut
DSP 2 - Adjustment 12: Graphic EQ band 7 (839 Hz) gain/cut
DSP 2 - Adjustment 13: Graphic EQ band 8 (1.34 kHz) gain/cut
DSP 2 - Adjustment 14: Graphic EQ band 9 (2.18 kHz) gain/cut
DSP 2 - Adjustment 15: Graphic EQ band 10 (3.44 kHz) gain/cut
DSP 2 - Adjustment 16: Graphic EQ band 11 (5.50 kHz) gain/cut
DSP 2 - Adjustment 17: Graphic EQ band 12 (8.80 kHz) gain/cut
DSP 2 - Adjustment 18: Graphic EQ band 13 (14.1 kHz) gain/cut

DSP 3 - Adjustment 1: Chorus voice 1 time delay
DSP 3 - Adjustment 2: Chorus voice 1 modulation rate
DSP 3 - Adjustment 3: Chorus voice 1 modulation depth
DSP 3 - Adjustment 4: Chorus voice 1 wet/dry mix
DSP 3 - Adjustment 5: Chorus voice 2 time delay
DSP 3 - Adjustment 6: Chorus voice 2 modulation rate
DSP 3 - Adjustment 7: Chorus voice 2 modulation depth
DSP 3 - Adjustment 8: Chorus voice 2 wet/dry mix
DSP 3 - Adjustment 9: Chorus voice 3 time delay
DSP 3 - Adjustment 10: Chorus voice 3 modulation rate
DSP 3 - Adjustment 11: Chorus voice 3 modulation depth
DSP 3 - Adjustment 12: Chorus voice 3 wet/dry mix
DSP 3 - Adjustment 13: Unassigned
DSP 3 - Adjustment 14: Unassigned
DSP 3 - Adjustment 15: Unassigned
DSP 3 - Adjustment 16: Unassigned
DSP 3 - Adjustment 17: Unassigned
DSP 3 - Adjustment 18: Unassigned

Anyone, feel free to suggest parameters and such.

markseel

Hi all.  USB grounds can be pretty noisy. Any thoughts as to how I can prevent a noisy ground from lowering the audio boards SNR?

RonaldB

Sorry can't help you on that one but this sure looks like a great project.
Keep up the good work.

RonaldB

Ronan

Some of the hifi guys with DACS feeding a USB use a unit that isolates their DAC ground from the PC ground, to avoid a ground loop, if that is what you are asking I can give you an example IC to do that. With this setup, power is not supplied by the USB to the outboard device, they use a seperate power supply for the DAC or outboard USB device. I think that's how it works, can look into it further tomorrow, I actually have one attached to my PC but I'm going to bed right now :)

MetalGuy

Congrats for the project! Several thoughts as an end user not developer.
As I can see this project will be able to do several effects in a row. Please consider including other commonly used effects like flanger, delay and reverb.
For example I'm not interested in overdrives and/or compression.
I guess it will be possible to create a library with effects and via appropriate software assign them in any order to the DSPs thus creating custom chains.
If not I hope this will be available at least as a custom option.

markseel

Got the XMOS main board PCB prototypes back.  Assembled one board, hooked up the XTAG2 JTAG adapter, downloaded and debugged an XMOS program - works perfectly!

Thanks for the posts all.

I'm looking to add some Analog Devices digital isolators and a power selector (jumper) to the audio board so that there's an option to substitute the USB ground and supply with a cleaner external supply.

I agree, The ability to create custom effects chains is the way to go.  I'll update the design so that we can share dsp programs and create our own chains.

markseel

#16
I made some pretty big changes to he design.

The effects are no longer built in.  Effects programs can be programmed by anyone, shared, and downloaded to form your own effects chains.  As many effects that will fit in RAM can be used.  

The DSP program assembly language in simple.  Here's an example:


Include Dependencies.

.inc filters     .. Includes FIR and IIR filter implementations
.inc resampling  .. Includes sample rate conversion filter coefficients
.inc butterworth .. Includes low-pass, band-pass and high-pass filter coefficients

Define an algorithm for the clipping function.

.def soft-clip input output gain igain bias
.asm AMC gain bias JN 1 AC0 -1.0 EXP AC0 -1.0 AMC igain .. Y=(1-16^|g*(X+b)|)/g
.asm PUT output
.use fir-x4 output output, low-pass-x4-20hz             .. Remove DC component
.end

Cascade four of the soft-clip tages to form an overdrive stage.

.def overdrive input output gain igain bias
.use soft-clip input output gain igain bias
.use soft-clip input output gain igain bias
.use soft-clip input output gain igain bias
.use soft-clip input output gain igain bias
.end

Upsample the input by four, overdrive it, then downsample by four.
The resampling uses an 80th order FIR filter with predefined coefficients included above.
The resampling filter used has 0.35fs bandwidth with -60 stop-band attenuation.

.def overdrive input output gain igain bias
.asm CM0 input +0.5 PUT input
.use upsample input up1 up2 up3 up4, resample-x80-035-60
.use softclip up1 clip1 gain igain bias
.use softclip up2 clip2 gain igain bias
.use softclip up3 clip3 gain igain bias
.use softclip up4 clip4 gain igain bias
.use dnsample clip1 clip2 clip3 clip4 down, resample-x80-035-60
.use low-pass-n4-500hz down output
.end

Main Application

.def main
-- Read Left and Right Samples - Treat the two inputs as a differential input.
-- The identifiers 'adc0' and 'adc1' are predefined nets representing the left
  and right inputs of ADC #1.
.asm CM0 0.5 adc0 CMA -0.5 adc1 PUT input
-- Distort the input!
-- The identifiers 'par0', 'par1' and 'par' are predefined nets for three of a
  total of sixteen user parameters that are updated continuously.
-- Note the 'igain' must be equal to one divided by 'gain'!
.use overdrive input output par0 par1 par2
-- Write left and right samples - Treat the two outputs as a differential output.
-- The identifiers 'dac0' and 'dac1' are predefined nets representing the left
  and right outputs of DAC #1.
.asm CM0 1.0 output PUT dac0 CM0 -1.0 output PUT dac1
.end


The DSP instruction set is:

JMP count Jump over the next 'count' instructions
JZ count If the accumulator == 0.0 then jump over the next 'count' instructions
JN count If the accumulator != 0.0 then jump over the next 'count' instructions
JP count If the accumulator > 0.0 then jump over the next 'count' instructions
JZP count If the accumulator >= 0.0 then jump over the next 'count' instructions
JN count If the accumulator < 0.0 then jump over the next 'count' instructions
JZN count If the accumulator <= 0.0 then jump over the next 'count' instructions
PUT name offset Store the accumulator in memory region 'name' at offset offset
GET name Load accumulator with value in memory region 'name' at [offset + AA]
SET name Store accumulator value to memory region 'name' at [offset + AA]
EXP Accumulator = Antilog16( accumulator )
LOG Accumulator = Log16( accumulator )
00C constant Set accumulator to constant value
1AC constant Accumulator = accumulator + constant
AC0 constant Accumulator = accumulator * constant
AAC constant Accumulator = accumulator * accumulator + constant
1CM constant name offset Accumulator = constant * name[offset]
CM0 constant name offset Accumulator = constant * name[offset]
CMA constant name offset Accumulator = accumulator + constant * name[offset]
ACM constant name offset Accumulator = accumulator * constant + name[offset]
AMC constant name offset Accumulator = accumulator * name[offset] + constant
MMC constant name offset Accumulator = [address] * name[offset] + constant
AND constant Accumulator = accumulator & constant


markseel

More changes ...

The XTAG will not be the general purpose interface for downloading programs.  Instead the effects board will be Bluetooth enabled.  The Bluetooth profiles will be public and accessable by any computing device that suports Blueooth Low Energy.  This includes smart phones, tabets, and PC's.  I've worked with Bluetooth preffesionally so I'll provide PC SW for downloading programs and making effects adjustments (16 adjustments per DSP). Hopefully programmers out there could write DSP programming and parameter controlling apps for mobile devices.

g_u_e_s_t

#18
not certain how my post ended up here
sorry

tp1936