Post Go back to editing

How to access the I2S raw data in the DSP(e.g. adau1761) to get the control data?

Category: Software
Product Number: ADAU1761

Hello guys,

I am testing with MAX98396 amp, and this amp has one function call I/V sensing, this can monitor the amp output voltage and current, and send out the status data with the I2S format, like below picture:

If I input this I2S data to ADAU1761 SDATA_IN, how should I to take this two status data out inside the DSP? using which tool block to extract this?

I search the forum and there are few topics ask about this (example: i2s data has volume control data how to get it...etc), but these topics finally has no answer inside to help member to get the data from the i2s.

so I still not know how to get the i2s data in dsp.

Can anyone help me on this? this will be very appreciate!

Best Regards,

Alvis.

Parents
  • Hello Alvis,

    I am trying here to get an answer to you quickly. I do not have time to work out a detailed example. 

    The serial data will come into the core like all other serial data. 

    I circled it on the right. 

    Then you can use logic cells to manipulate the data and also multiplies/divide by 2 to shift the data where needed. 

    The voltage and current is alternating which makes it a bit more tricky but it is using the sign bit to mark it. You can just look at the MSB but you might just be able to test for positive or negative sample and that would give you if it is current or voltage. 

    Just use readbacks to verify what you are seeing. Look at a scope as well to be sure you are properly decoding the values. You can remove the load and the current will go to zero or close to it. Just be creative and you can work this out using SigmaStudio. 

    You will also probably have to use a hold cell to hold the data since it is alternating and not the same for every sample. 

    Got to run

    Dave T

Reply
  • Hello Alvis,

    I am trying here to get an answer to you quickly. I do not have time to work out a detailed example. 

    The serial data will come into the core like all other serial data. 

    I circled it on the right. 

    Then you can use logic cells to manipulate the data and also multiplies/divide by 2 to shift the data where needed. 

    The voltage and current is alternating which makes it a bit more tricky but it is using the sign bit to mark it. You can just look at the MSB but you might just be able to test for positive or negative sample and that would give you if it is current or voltage. 

    Just use readbacks to verify what you are seeing. Look at a scope as well to be sure you are properly decoding the values. You can remove the load and the current will go to zero or close to it. Just be creative and you can work this out using SigmaStudio. 

    You will also probably have to use a hold cell to hold the data since it is alternating and not the same for every sample. 

    Got to run

    Dave T

Children
  • Hello Dave,

    Thanks for your quick reply!

    I have tried to figure it out with bitwise and the multiplies/divide to get the right bits, but I still not in the right direction..

    Could you provide the example with the DC input entry for demo how to get the right value?

    I use read-back block in hex mode and if data is voltage will show  (0, xx, xx, xx)  and if data is current will show: (F, xx, xx, xx)

    I have tried few days..but still not get it.

    Thank you for coming in this topic

    Regards,

    Alvis.

  • Hello Alvis,

    This is not a trivial problem to solve. What makes it tricky is that the serial port hardware does some things for you that is normally really great and makes things easy. What it does is takes the MSB and sign extends it to fill in the 28 bits of the core from the 24 bits it gets from the serial port shift register. This is normally great but in this case the MSB is signaling when the data is current verses voltage! So we have to strip out the sign bit and the extension of the sign. 

    Then this leaves you with the 15 bit word that is still a 2's compliment number but the actual sign bit came in as the MSB-1 bit so you do not get the sign extension! So after to finish de-interleaving the current data from the voltage data and you hold it for one sample period, you then have to get it back to being sign extended so you can do math with it! Again, this is not super easy once it is in the core. So this took me a couple of days to work this out. 

    Plus, I also designed a test signal generator that will generate this interleaved 15 bit signal so I could test it carefully and use not just a sine wave but a DC cell to test specific values like max negative and positive numbers. 

    Then I needed to test this with real hardware. I am in Wilmington on the east coast and our Maxim class-D amps are designed and supported in California. So they sent over an eval board for me to setup and test which I did today. I was able to get it to work and it seems fine. One detail is that I have not been able to verify that the data is exactly correct. That it is not off by a factor of two or something like that due to all the bit manipulation I had to do. It seems fine from my simple tests and the I-V data sounds good when the audio out of the speaker sounds good and when I get it up to where the audio starts to clip in the speaker I also hear it in the I-V data. I will attach the project here but I do want you to also verify that the levels are correct and what you would expect. It may take me a while to setup a better test here on the east coast to verify the sense data is correct in the SigmaDSP. 

    In the program I also am calculating the power. I have switching so you can listen to it. You will see the important part I put in a hierarchy cell called "Decode". So this project is a bit busy due to all the testing and verification I was doing along the way. 

    One other thing to mention. When the data is interleaved, this means that the sense data is sampled at half the rate of the audio PCM rate. So the DSP is running at 48kHz but the sense data is at 24kHz. What I did in the program is used the hold cell to hold the data during the sample period when it is the other data that is active. So the I and V data has a zero order hold on the data at 48kHz. This will add some distortion harmonics and if you really need to hear it clean or use it to measure distortion you will need to filter it to a bandwidth of less than 12kHz because the sense data is sampled at 24kHz. It sounded rather clean without the filter but if you really need it to be super clean you will have to filter it. 

    I think that is everything I need to mention. 

    Enjoy!

    Dave T

    ADAU1761 IV Sense Decoding of MAX98396-7.dspproj 

  • Hello Dave,

    Thank you for your helps and sorry for the late reply!

    I have tested and tried understanding the algorithm.

    I have few questions I need request from your assistance, please help me clarify the questions, thank you again!

    I am using EVK MAX98396 and follow the user guide  to load the default preset register setting, and I found that the I/V Sensing data in default is inserted with this setting:

    For the Channel setting, Voltage data in PCM TX CH0 and Current in TX CH1, it seems not like the datasheet said, but when I check the datasheet, on page 47 topic: Data Output Channel-Interleaved I/V Sense Data

    we need to enable "Tx Interleave" to get the sync data for the right data.

    so I follow the setting to enable and set the data to the same channel:

    And in the project which you provide, I check the first level detector:

    I am not sure the level detector can be used like below detect:

    1. If I only open Voltage sense which means I cancel the Current data in the I2S slot, the level detector("Dig_In_L") is always show 0:

    Question 1: The Voltage is a data, why this can not be shown in the level detector?

    When I open the Current data, the level detector start show up.

    The other questions are in the project " Decoder " page which I want to check my thought is right or not.

    Question 2:

    this section function is as you said, using bitwise to get the 15 bits data remove the MSB-1 0/1 (the sign for the Voltage or Current), am I right?

    Question 3:

    for this section processing, which is trying get the MSB-1 from the input i2s data to determine this data is Voltage or Current?

    Question 4:

    in this section, I can not sure why need to develop a signal, can you help me understand this?

    and why should select at the 40,00,00 bit?

    Question 5:

    if the -9- is negative data, the multiplexer will be selected the extended data(circle mark) and this is for the current data,

    if is positive data, the data will be selected at the Not extended data(triangle mark) and this is voltage data, am I correct?

    Why the current data should be extend to 32bits? But for 1761 is 5.23 Numeric format why is not extend to 28bits?

    Do the Voltage data should be extended to 28bits?

    Because the negative reason, so the data should extend to 28-bits , again, I still not get it why should and(&) at 40,00,00 bits to check is negative current? What if voltage at 40,00,00 bit is 1, how voltage deal with this?

    For the MAX98396 setting like above, I can not sure the result is correct or not, because I tried add the level detector at the

    power calculate behind, I thought the speaker remove will cause the data to zero and the level detector will not show anything.

    If the music more louder the level detector show more dB but the result is not I though.

    Thank you for reading my question!

    This project really help me a lot!

    Regards,

    Alvis.