Sigma Studio Mode export does not use defined register locations
Hi All
I have had a problem with generating 'C' code for inclusion in my micro-controller program to control the SigmaDSP. To be more specific I am using SigmaStudio 3.10 Beta to write a program for a ADAU1701. I need the Beta version as I am using the Hilbert transform that does not work on the 3.9 version of the code. I have a micro-controller project that accepts SigmaStudio 'C' output files. I can change my SigmaStudio "program", output the revised header files and recompile the micro-controller project with no manual changes to the 'C' code. So far so good.
I have volume controls that I want to be able to set to an accuracy of 0.1 dB. I used the Mode capture system to capture a volume change. I then export the code to change the .h file created is below:
------------------------------------------------------------------------------------------------------------------------------------------------
ADI_REG_TYPE CHANA_GAIN_0[4] = {0x00, 0x04, 0x0C, 0x37};
void CHANA_GAIN_download(){
SIGMA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_, 0x0013, 6, CHANA_GAIN_0); /* Gain1940AlgNS3 */
}
------------------------------------------------------------------------------------------------------------------------------------------------
Fine if I want to set the gain to a specific level but I need 800 for 80dB control at 0.1dB accuracy. It is easy to calculate the value of the attenuation in the 5.28 format but the address of where it needs to be written is just the constant in the program (0x0013). So I thought I needed to harvest the address locations into an array of volume control locations in order to access the volume controls in my system. If I changed anything and the locations move, then I needed to repeat this process.
However I realised that the addresses are available (but not used in the auto-generated 'C' code) in the PARAM.H file
#define MOD_SINGLE1_GAIN1940ALGNS3_ADDR 19 //(Which is 0x13)
by using these, I do not need to change my code and I can automatically change my program as before. I hope this helps anyone else that is having the same problem.
John
As an aside, the DEVICE_ADDR_ should have the IC number appended DEVICE_ADDR_IC_1 which I cannot make happen in the Mode export although it works fine in the program export?
Audio Signal Processors
SigmaDSP Audio Processors
adau1701
Hi John,
There is something I noticed about the relationship between the Export System Files function and the Capture Window / Sequencer Mode function that might shed some light on the issue. Perhaps this is unrelated to what you're seeing, but then again, perhaps this is exactly the information you were looking for! In any case, I figured it's worth sharing.
(I made the key points in bold so the discrepancy between the two approaches is more obvious...)
When you compile your project, each algorithm's SPI/I2C-accessible parameters are assigned to a certain address in parameter memory. The actual address is dependent on the order of the algorithms in the program. The linker seems to line up the algorithms in sequential order (based on how the signal passes through them), and it then lines up the parameters sequentially in parameter memory as well.
By using the export system files option, you'll be able to generate header files with a list of the addresses of each parameter from the last successful compilation of the project.
Now, you can also use the capture window and sequencer window to create "modes" that also will export as header files. This is really useful for creating a list of commands that you want to turn into a single write "function" in your microcontroller code. However the difference is that the addresses used here are not necessarily from the last successful compilation of the project, but rather they were taken from the addresses of the corresponding parameters at the time the sequence was created. Successive re-compilations of the project (even after new algorithms are added, potentially shifting all of the existing parameter addresses) will not retroactively update the addresses stored in the sequences you created previously.
So, there's a significant caveat that needs to be kept in mind when using the sequencer. To sum it up, the sequencer should only be used to generate microcontroller code when the compilation of the project is finalized. Project revision and re-compilation will likely corrupt existing sequences.
I'm not sure if that's the cause of the problem you experienced, but it's definitely something that can catch you off guard if you don't see it coming! Hopefully this was helpful to you.
Hi Yagami
Thanks for the reply. You have explained my problem very well. I would like to have a micro-controller project for the SigmaDSP that needs no changes when I significantly change my SigmaDSP program. Ideally I should just be able to export my 'C' header files from SigmaStudio and recompile for the changes to take effect. By using the defines in the *PARAM.H file this is possible, as every SigmaStudio compilation changes the defines to the correct location if the address of the module is changed. However, these defines are NOT used in the mode capture 'C' output - raw numbers are used instead. So if you take the time to cross reference the addresses output by the MODE commands and replace them with the defines from the *PARAM.H file, then as you change the SigmaDSP program, the locations of the control modules should be changed and no changes are required from you to your micro-controller code.
I think this is an oversight by Analog Devices and should be corrected in a future version of SigmaStudio.
That is the essence of my previous post.
Regards
John
This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.
Thank you,
EZ Admin
Please log in to reply.