Post Go back to editing

Audio Signal Detection in ADAU1772

Dear All,

We are using ADAU 1772 model codec in our hardware design, controlling it via I2C bus through  ESP32 processor. i would appreciate if you can help me on  how i can detect the presence of the signal in the  inputs or outputs of ADAU1772  to cancel the sleep function  and activate the amplifier?  I have seen only one dsp aritmetic function available which is absolute value available in ADAU1772 , will that dsp module work and how i can implement this on my code? or any other way to do the signal detection?

Thank you in advance. 

Regards , 

Parents
  • Hello vision4u,

    You almost had it figured out. Yes, use the absolute value to feed into a LPF then send that to a dBReg and read that register with your controller.

    Here is what it will look like:

    I set the filter to 2Hz so there would be a long integration time and longer release but it is still not very long. It will allow you to slow down the reads so you do not miss anything. Then you will have to setup the longer time constants in your controller code. You probably will want to keep the amp on for a fairly long period once there is no more audio. 

    0x000C is the address of the first of three dB Registers. 

    You will also want to engage the HPF in the ADC and set it for 1Hz. This will remove the DC offset of the ADC converter which can influence the level being read. 

    Dave T

  • Dear Dave,

    Thank you very  much for your detailed explanation. İt is very appreciated. 

    I will have a look at this and see how it works. 

    Regards,

  • Dear Dave,

    I have another question , I have done your suggestion  with Dbreg2 .  I  want to understand the mathematical logic on how to read/convert  the register of 8 bit dbreg2 to corresponding dB value.  ı will aprreciate if you can help me to understand this conversion

     

    My design is below ,i summed left and the right signal  and i read different values like -40dB from dbreg2 even if there is no signal in the path. 

    what can be   wrong?  Thank you in advance. 

  • Hello vision4u,

    There could be a couple of reasons. 

    1) There is no HPF in the signal from the ADC. It is very easy for an ADC to have -40dB of DC offset. 

    Since you are using 2Hz on the LPF make sure the HPF is set for <=1Hz. This will remove the DC content. 

    2) There is noise in the system. Try to put a mute before the ABS block to shut it off and get zero. The filters might not settle all the way to zero but should be close to zero. 

    Dave T

  • Dear Dave , Putting the  mute in front of ABS sorted the problem.  Thank you for your rapid response .

    Any suggestion for  making me understand how to convert bits of the register to dB  from my above question? 

    thank you in advance. 

  • Hello vision4u,

    The datasheet sort of shows how this works but does not explain it very well.

    Here is the entry in the datasheet for me to explain:

    This table of values really should have gone from 0b11111111 down but the software we use to develop these figures cannot do it that way. Think of it like a 2's compliment number with the MSB missing.

    We only have 8 bits to do this. We want to go from 0dB fs and have a range of 96 dB. So 8 bits = 256 steps so 96/256 = 0.375dB per step. 

    So in the binary numbers below remember that the MSB is not included in the register. I put a space to easily see it. For those of you who are used to working with 2's compliment this will help.  

    1 0000 0000 would be 0dBFS. But we cannot start there so we start from one less. ( we need the 0b0000 0000 for the bottom of the scale) So the dBreg will never return a 0dBFS number. 

    1 1111 1111 would be (-1) so when the dBreg returns 0b1111 1111 the level is -0.375dB

    1 1111 1110 would be (-2) so when the dBreg returns 0b1111 1110 the level is -0.75dB

    1 1111 0000, So when the dBreg returns 0b1111 0000 the level is -6dB.

    This continues subtracting 0.375 dB from the previous step until the register returns zero. Then the level is -96dB .

    So what is probably easier to program in your controller is to simply use the following formula:

    dB Level =  -96 + (dBreg * 0.375 )

    I suppose you can do it this way using a bit of middle school algebra dB Level = (dBreg * 0.375 ) -96  

    I have put together a spreadsheet that counts all the way down so you can see every possible value and see how it works. 

    XLSX

    Dave T

  • Dear Dave,

    Thank you very much for this detailed answer. We solved the code with your equation :-)

    Regards,

  •  in the datasheet, it refers that the dBVal register is "R", means  it is only for reading the data not "W(Write). How can i write my own custom values for this register? Please guide on this.

  •  ,  can any of you please answer my question? I have to "write" a value in audio driver. 

  • Hello anlg,

    The register is read only. Only the core can write to it and trigger the conversion. Since this DSP core is a limited instruction fast core, there is no way to write a value into the core like we can do in other SigmaDSP cores. There is no DC cell function available. 

    Why do you need to write to this from a controller? Just have the controller do the dB conversion itself? Yes, this hardware accelerator would be faster but usually you do not need to calculate a dB level until an integration of many samples has completed which takes a lot of time. 

    The only ways you can get a value into this dBreg is from the ADC input or from the serial input port. Keep in mind that the serial input port goes through the ASRC so it would be difficult to stuff DC values into the register without the values being changed by the ASRC. 

    I hope this helps.

    Dave T

  • Thank you Dave for you prompt response. I really appreciate your help.

    I misunderstood some of the points from datasheet and regarding my application, that is why, I was thinking of writing to dbreg. 

    I will get back to you after implementing your suggestions.

  • Hello anlg,

    No problem. There are things in the datasheet that could be better explained. It is tough to anticipate any question when writing it. 

    I hope your project goes well.

    Dave T

Reply Children
No Data