Question about using custom code to program the ADAU1452
I have the EVAL-ADAU1452MINIZ and am hoping to be able to run custom code on it. It seems like running the code directly through SigmaStudio is not possible. I was wondering if the export system files tool is the first step in doing this. I understand it exported a bunch of C header files, but I was a little lost trying to figure them out. How difficult would it be to set up the evaluation board to run custom C, and is there somewhere I could to find more direction in accomplishing this? On another note, is it possible to export input data straight to a file?
Thanks,
Ryan
Audio Signal Processors
adau1452
c code
export
sigmastudio
SigmaDSP Audio Processors
custom
Show More
Hi.
If you want to command the ADAU1452, you must have a master connected to its I2C/SPI port.
Everything you do with Sigmastudio can be done with your master.
The USBi is a USB to SPI translator.
When Sigmastudio "link compile download" into your ADAU1452, you can see what happen into the "capture windows".
In summary:
DSP reset
DSP settings part 1
Program load
DM0 memory load
DM1 memory load
DSP settings part 2
DSP start
The required C files could be exported when you select "export system files".
The following exported files are interesting:
*_IC_1.h, contain constants that must be put into your MCU program memory.
*_IC_1_PARAM.h, most important file.
*_IC_1_REG.h, contain DSP's registers settings.
In your Sigmastudio installation folder:
SigmaStudioFW.h
You have to code a SigmaStudioFW.c file, which will contain the SPI functions described into the header. Well, sort of because the header is kind of retarded, so you will have to tweak it a bit.
You will surely need the following features:
write a register using SPI
write some registers using SPI
delay
format conversions
The ADAU1452 knows 2formats. Both are 32bits wide.
32.0 is the common integer format
8.24 is the common fixed point format
When you have coded those features:
You must put the default_download_IC_1() function that you find in your *_IC_1.h in a *_IC_1.c.
To load your code:
Your MCU must toggle "slave select" three times to put the DSP into the SPI slave mode. (you can't let SS low all the time, even if the DSP is in SPI salve mode.)
Then you call the default_download_IC_1() function, which upload your application into the DSP.
At this point, it's the same as connecting the USBi and clicking "link compile download" in Sigmatstudio.
Example 1: command a mono switch Nx1 with your MCU.
in *_IC_1_PARAM.h:
/* Module Nx1-1 - Mono Switch Nx1*/
#define MOD_NX1_1_MONOMUXSIGMA300NS1INDEX_ADDR 19237
#define MOD_NX1_1_MONOMUXSIGMA300NS1INDEX_FIXPT 0x00000000
#define MOD_NX1_1_MONOMUXSIGMA300NS1INDEX_VALUE SIGMASTUDIOTYPE_INTEGER_CONVERT(0)
#define MOD_NX1_1_MONOMUXSIGMA300NS1INDEX_TYPE SIGMASTUDIOTYPE_INTEGER
To put the switch from 0 to the 1 position, you have to translate 1 into 32.0 format, and then make a SPI write at the address MOD_NX1_1_MONOMUXSIGMA300NS1INDEX_ADDR.
Example 2: modify a linear gain with your MCU.
in *_IC_1_PARAM.h
/* Module Gain1 - Linear Gain*/
#define MOD_GAIN1_GAINALGNS145X1GAIN_ADDR 19236
#define MOD_GAIN1_GAINALGNS145X1GAIN_VALUE SIGMASTUDIOTYPE_8_24_CONVERT(1)
#define MOD_GAIN1_GAINALGNS145X1GAIN_TYPE SIGMASTUDIOTYPE_8_24
To set the gain from 1 to 2, you have to translate 2 into 8.24 format, and then make a SPI write at the address MOD_GAIN1_GAINALGNS145X1GAIN_ADDR.
Everything you need is the ADAU1452 datasheet. Read the SPI slave chapter and that's all you need for the beginning.
http://www.analog.com/media/en/technical-documentation/data-sheets/ADAU1452_1451_1450.pdf
The datasheet do not contain the right waveform mode, so keep only the basic idea.
Use SPI mode 0, SPI clock frequency <3MHz, MSB first, >1.3ms SPI write delay in the SigmaStudioFW.c delay function.
I suggest that you press F1 in Sigmastudio and read the SigmaDSP architecture. It's outdated, but useful.
Learn when to use the safeload. In other words if Sigmastudio use safeload, use it. If you make a good application, using the right blocks, you can avoid the safeload use.
The idea is that your master must be in charge of EVERYTHING. So you just have to perform SPI writes, and you never need to read back furiously some user-interface values.
I think that you have a good starting point.
For your second question:
Since a SPI read register is 3+4bytes long, you will need to clock about 60 times at 2MHz, so it's about 30us. If you use 48kHz sample frequency, you have to do it in 21us. That's why I've said do not "read back furiously" some values. If you are willing to use a higher SPI freq once you have set the DSP, the highest is 22MHz so...
I think that you can use some serial data output port to transfer data. Read the user guide!
http://www.analog.com/media/en/technical-documentation/user-guides/EVAL-ADAU1452MINIZ_User_Guide.pdf
If your second question was concerning Sigmastudio, then I don't think so.
Best regards,
Simon
Hi Ryan.
The ADAU1452 is an audio-processing DSP. It performs very efficiently a wide range of common audio-algorithms like filters, dynamic processors and so.If you want to use a C code, you have to use it typically inside of a MCU to command your DSP, as described above. But you can't use C code directly into the DSP. It use some kind of assembly code that only the Analog Device developers can use.
I don't think that you really want the audio data to go from the input jack, to the CODEC, to the DSP, to your MCU, operate them in C, send them back to the DSP, to the CODEC, to the output jack.
You MUST use Sigmastudio to make your application (see the user guide link given above, it's fast and easy), and it's a good idea to let the DSP do the audio-processing. That's the whole idea behind the ADAU series. Even those who don't know how to code in C, could easily program their DSP in a graphical and user friendly way, using Sigmatudio.
The advantage to use graphical programming is the user-friendliness.
The disadvantage of it, is that you have to use those blocks. If you want to make something special, like an adaptive distortion effect for guitar you have to assemble quite some blocks.
I remember that I used some SHARC DSP by the past. I programmed everything in C. It was quite cancerous to use advanced stuff like convolution, FFT and so. At least you had floating point and circular buffers. But for the basic stuff, you had two buffers (input and output, floating point). The first was automatically filled with the audio incoming data and you just had to take pick a value from it, use it, and then put it into the output buffer.
That's not what you have with the ADAU1452!
Best regards,
Simon
Thanks for your response Simon,
So after doing everything you said, where would I be? As in, what data would I have access to in the C code? I am hoping to essentially use the eval board to grab some samples from the input, operate on these samples in C, and then output the modified samples back to the board and out through the output jacks. Is that going to be possible / how difficult is that?
Thanks,
Ryan
Hi Simon,
Hmm, I think I see what you are saying. So the ADAU1452 is running preset segments of code, that I can't really edit easily except through SigmaStudio. But overall, SigmaStudio should be able to do most things? Seems like I should have gotten a SHARC DSP, but I guess I'll see what I can do with the ADAU1452.
Thanks again,
Ryan
Hello Ryan,
What you were talking about was transferring audio data using the I2C/SPI interface and you cannot do that. SigmaStudio is able to do quite a lot of functions and is easy to change and program. Plus, the SigmaDSP platform is optimized for audio so there are a lot of good things about it. However, you cannot run custom C code directly.
Dave T
Please log in to reply.