Single Level Detector in ADAU1452

Hi,

I use Single Level Detector to read level in my program.

I find that the data from 1452 is 4 bytes which doesn't contain the sign bit, so I think it's not 8.24 format.

I have the following questions

1) What's the level mean, is it RMS level?

2) What's the format of the data, 32.0 or other?

3) How can I calculate the dB value from the 4 bytes?

4) If I get 0dB value from the 4 bytes, what's the final voltage output from DAC, assume that the DAC is ADAU1962. 

  • 0
    •  Analog Employees 
    on Jul 1, 2021 8:22 PM

    Hello Foster,

    There is a lot to unfold here. You mentioned the data from the level meter, which data are you referring to? There are a number of parameters associated with the meter object. 

    You can use the Params window to see how this all works. There are some parameters that the programmers included variables but then never used and the DSP does not update those memory locations. 

    Here are the parameters for one meter in my test project.

    There are a few little issues with understanding this window. The first is that the data is shown in three different formats. This is really handy since sometimes one format means more to you than another. 

    Then the conversion of the hex data that is read from the DSP memory to 8.24 or to 32.0 is just for those bytes. It knows nothing is there is more than 32 bits of data that is spread across two memory locations. So the sign bit interpretation is meaningless. Also, I have noticed that the 32.0 is really being displayed as a signed integer which is not exactly 32.0. But that is something I will ask the programmer when I have a chance. Usually this is not an issue. 

    Here is the program I used. 

    Note that I can switch from an internal oscillator to a DC cell. This is handy to see how things are being calculated. 

    The oscillators in the DSP output a full scale 0dBFS for a 1.24 level inside the core. This will be truncated to a 1.23 level when going out of the core to the serial ports. Now the core is 8.24 so it can go way above 0dBFS for a 1.24 number. This is why you can go over 0dBFS which you can say is impossible. This because we have extra bits that we are not counting when we call it 0dBFS. So the meter can be setup to go over 0dB. Just keep in mind that any signal above a 1.24 number will be clipped when going out of the core. 

    The meters are setup to read RMS. So a 0dBFS will not read 0 but will read -3dB. I wish there was a way to change it to peak so it will give you 0dB but I have gotten used to this. One other thing. These meters are NOT meant to be laboratory quality reference meters. They are meant to give you a decent idea of the level at one place in the DSP signal flow. 

    Back to the Capture window. Some of these are static parameters that actually can be changed if you want to. Well, changed by a system controller usually. This version of meter does calculate part of the RMS value in the DSP. The rest has to be done up in the host like the PC in SigmaStudio or a controller in your hardware. So the value that says "RMS" is really "MS" the mean squared. The time constant, the hold and the decay are setup to hold the data for 10 ms. Note the hold time is 480 which is 10ms of samples at 48kHz fs. So it will keep a running average of the square of the audio sample. This all said, I do not think this was actually implemented in the DSP code. The RMS value should be but it looks to me that all the time constant and hold time variables are ignored. Then I change them they do not seem to make any difference. 

    I do know that the SigmaStudio program just uses the X variable and does not use the X_Lo. You certainly could if you like. 

    The RMS and X variables are the sample squared. You can verify this by switching to a DC cell and if you set it to "1" you get a "1". If you set it for 0.5 you get 0.25

    This data comes from the accumulator which is 56 bits wide. The lower 32 bits are held in the X_Lo variable and the next memory location after rms. ( it is not labeled. ) 

    So the X and rms variables hold the rest of the 56 bits, which is 24 bits as right justified data. So this means the upper byte is always empty and the sign bit will always be zero. In your controller you would have to shift the data over so the sign bit is in the correct place. Now, keep in mind this is a squared number which will never be negative. 

    The last variable you need to know about is the LinX and LinX_Lo variables. this is the actual sample. This can be positive or negative and it is the sample at the instant in time you do the readback. One sample. So you have no idea about the actual level which is why you need the square of the average over the last 10ms. 

    So if you do not need super low resolution then just read the "X" variable every 10ms and then do all the dB calculations and meter ballistics in your controller code. This is what SigmaStudio does. I am pretty sure there are other posts about this on the forum so do a search. 

    Keep in mind that this is for the Single Level Detector with Numerical Display. Other meter objects will be different and have different parameters. 

    Now your question about the level out of the DAC. 

    A full scale DC value will come out as a 1 in 1.23 format. Actually, very close to it, 0.999999...  You then look at the datasheet for the DAC and see what voltage level a full scale signal will produce. This will be your output level. It gets a little tricky with the RMS and dB calculations but this is how to figure this out. Any changes in the DAC reference voltage will change the DAC output range. A digital value is a number, if it is a 1 then what does the DAC convert that to? Whatever it is setup to convert it to. if a digital 1=5V then it will be 5V. If a digital 1 is 2V then it will be 2V. Then if you send it a signal that is 6dB less, then the outputs will be 2.5V for the 5V reference and 1V for the 2V reference. 

    Dave T