Delay SPI Slave Port Parameter Update ADAU1452
Hello EngineerZone,
i searched for a similar topic but i can't find one that is equivalent to my problem, so i add a new question.
At the moment i used the SPI port from my mikrocontroller (STM32F4...) to control a "Single Volume Block" over the
SPI slave port from the ADAU1452. I use "Block Writes" and this works fine.
My problem is, that the audio codec AD1938 delays the incomming signal by approx. 600us, because of its group delay.
So the moment when i change the volume over the SPI port is to early.
I solve this problem at the moment with a 600us delayed SPI signal from my mikrocontroller but i want to relieve my mikrocontroller a little bit.
So my question is:
Is there a way to delay these "parameter updates" or "SPI signals" in the ADAU1452.
Something like an "Logic Delay Block" or something else.
So that i can write the new value immediatly over SPI in a block and only after 600us this value will be updated.
Thanks in advance and kind regards,
Eric
Audio Signal Processors
adau1452
adau1452 spi
ad1938
Integrated/Special Purpose A/D Converters
SigmaDSP Audio Processors
Audio CODECs
Show More
Hello Eric,
There is no direct way to delay the implementation of a SPI write to registers but you can achieve this with a few cells.
If you implement a DC cell to hold a value and provide an address for you to write a value is the first step. Then you simple delay that value by approximately 600us and then feed that to the volume control. Here is a picture:
I set it for 29 sample periods because at 48kHz fs, 600us = 28.8 sample periods. So it will be just over 600us.
Now this all said, I am having trouble seeing what you are doing that your application might be to be this sensitive to gain over time and how the microcontroller can decide when the gain needs to change before the actual signal has even been sampled? How does it know the gain needs to change?
Then there is the fact that one period of a 1.667kHz since wave is 600us. So the volume change has to change within one cycle of a 1.667kHz wave is really fast. Then if you are using a volume cell with any slew then there is no way the gain will change that fast. If you absolutely must change the gain that fast then you should not be using a volume control with slew but instead use one with no slew or a simple gain cell. Then when you change the volume that quickly you will get clicks and pops and it will be audible.
So the basic thought that how can you react to something that has not happened yet is tough to understand. If you need to react to a peak very quickly then there are limiters in the library that react instantaneously. There are also ways to prevent signals from going too high. Then if you need to react to something "before" it happens then the trick is to delay the output signal but have the level sensing react to the signal before the delay line. However, at this point the signal has been sampled and has been transferred to the DSP.
So I am a little confused but there are certainly ways to do what you are asking about.
Dave T
Hello Dave,
thanks for your fast anwser. This helps me a lot.
For better understanding:
The microcontroller has information of the analog signal before it is converted in digital through the codec.
I used an oversampled internal ADC for this. So the microcontroller can react very fast and send a gain value to the ADAU1452.
I know that so fast switching will generate clicks and pops but this is not necessasy for me at the moment . Maybe interpolation will prevent these effects later.
So i must use an "volume control" or "gain cell " without slew rate. My problem is that i can't find one that has an external control without slew rate. But if i understood your anwser right, the only way to delay incomming SPI signals is to write to the DC cell, delay this value and connect this to the external control port of the "volume control". Or am i wrong?
I can't find any documentation of the "Single Slew Ext Vol" block you used in the picture. If i set both values of this block to 0, will i get a "volume control" with no slew rate?
Thanks in advance and kind regards,
Eric
Hello Eric,
There has to be a way to do this. You are correct that all the external volume controls have slew. A slew setting of "0" will still get you around 2ms of slew so you will not like that.
So I think a brute force method of going back to basics should work. A gain control is simply a multiply operation so try using a multiply cell. Something like this:
The value in the DC cell will be the multiplier. It will not be in dB but you have a controller to do the math. Or have a lookup table...
This gives me another idea,... if you do not need fine gain steps then I suppose you could use an index selectable table in the SigmaStudio schematic and have the gains pre-calculated and only have to step to the proper index to obtain the desired gain. It would be a DC cell driving a lookup table then through the delay line to the multiply cell. It is a lot of code but it would take the load off of the controller to calculate the multiplier.
Dave T
Hello Dave,
sorry for my late response. This was a great idea and helped me a lot.
Thanks for your support. This realy great at this forum.
Kind regards,
Eric
Please log in to reply.





