This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

problem of AIC3254 spectrum analyzer

Hello,

I use the AIC3254-EVM-K to develop medical application.

Now, I have a problem of the function - Spectrum Analyzer.

How can I get the value from the register that the output power is located in I2C memory 

in order to use this data for further evaluating?

Thanks for reply.

 

  • Hello Steve,

    The Spectrum Analyzer in AIC3254EVM-K CS is meant for demostration purposes. I would recommend using the Spectrum Analzyer component in PurePath Studio to create your own Analyzer, which allows you to use your own custom fc's.

    If you still want to use the demo Spectrum Analyzer in AIC3254 CS, I recommend reading the following document on how to read C-RAM locations: http://www.ti.com/litv/pdf/slaa425c

    Each coefficient can be converted into a dB value with the following equation:

    Band Energy in dB = (24 bit value read from C-RAM / 217)

    The table below shows the coefficient locations for each band:

    Channel

    Band Centre Frequency

    C-RAM Addr

    Register Address

    Left

    28 Hz

    90

    p47_r[8:10]

    Left

    40 Hz

    91

    p47_r[12:14]

    Left

    58 Hz

    92

    p47_r[16:18]

    Left

    80 Hz

    93

    p47_r[20:22]

    Left

    115 Hz

    94

    p47_r[24:26]

    Left

    161 Hz

    95

    p47_r[28:30]

    Left

    230 Hz

    96

    p47_r[32:34]

    Left

    322 Hz

    97

    p47_r[36:38]

    Left

    459 Hz

    98

    p47_r[40:42]

    Left

    643 Hz

    99

    p47_r[44:46]

    Left

    919 Hz

    100

    p47_r[48:50]

    Left

    1286 Hz

    101

    p47_r[52:54]

    Left

    1838 Hz

    102

    p47_r[56:58]

    Left

    2573 Hz

    103

    p47_r[60:62]

    Left

    3675 Hz

    104

    p47_r[64:66]

    Left

    5145 Hz

    105

    p47_r[68:70]

    Left

    7350 Hz

    106

    p47_r[72:74]

    Left

    10106 Hz

    107

    p47_r[76:78]

    Left

    14700 Hz

    108

    p47_r[80:82]

    Left

    18375 Hz

    109

    p47_r[84:86]

    Right

    28 Hz

    110

    p47_r[88:90]

    Right

    40 Hz

    111

    p47_r[92:94]

    Right

    58 Hz

    112

    p47_r[96:98]

    Right

    80 Hz

    113

    p47_r[100:102]

    Right

    115 Hz

    114

    p47_r[104:106]

    Right

    161 Hz

    115

    p47_r[108:110]

    Right

    230 Hz

    116

    p47_r[112:114]

    Right

    322 Hz

    117

    p47_r[116:118]

    Right

    459 Hz

    118

    p47_r[120:122]

    Right

    643 Hz

    119

    p47_r[124:126]

    Right

    919 Hz

    120

    p48_r[8:10]

    Right

    1286 Hz

    121

    p48_r[12:14]

    Right

    1838 Hz

    122

    p48_r[16:18]

    Right

    2573 Hz

    123

    p48_r[20:22]

    Right

    3675 Hz

    124

    p48_r[24:26]

    Right

    5145 Hz

    125

    p48_r[28:30]

    Right

    7350 Hz

    126

    p48_r[32:34]

    Right

    10106 Hz

    127

    p48_r[36:38]

    Right

    14700 Hz

    128

    p48_r[40:42]

    Right

    18375 Hz

    129

    p48_r[44:46]

    Regards,

    J-

  • Thanks a lot for your reply.

    I'm using the PurePath to program the Spectrum analyzer on the AIC3254EVM-K.

    Follow is the figure : 

     

    The same problem is that how can I read the value from the register that the Component Interface shows.

    Thanks for your further reply.

    Best regards,

    Steve

  • Hi Steve,

    Do you want to know how to read it on an end system or on PurePath?

    On PurePath, you go to the memory tool and read the coefficient you want. The location of each band is shown on the Properties Window (e.g. Coeff 0 = p44_r08-r10).

    On the end system, you need to swap buffers every time you want to read a C-RAM register. This is explained in the app note I sent earlier.

    Regards,

    J-

  • Hi Arbona,

    Thanks for your further reply.

    I want to read the value on the end system.

    I study the app note you sent to me earlier and find out some relevant information that is on the page 5,6.

    However, I have no idea to read the value I want.

    Can you give me the illustration if I want to read the Coeff 0 = p44_r08-r10 ,Coeff 1 and Coeff 2 on the end system?

    And the Control Interface on the AIC3254-EVMK means the PC or other things?

    Thanks a lot,

    Steve



  • I try to read the value from PurePath's memory tool.

    Here are the procedures:

    1.Set a ToneGenerator  ( frequency=900 , amplitude=1.0)

    2.The Biquad_5 band-pass filter's center frequency is 900 Hz.

    3.Make sure the register of Biquad_5 filter is located on p44_r24-r26.

    4. The memory tool reads from p_44_r[20:30] that show the 00 value as belows.

     

    So , I have a problem that if I make all the procedure right, I think it would be a value rather than 0 in the register p44_r24-r26.

    Thanks for your reply.

    Best regards,

    Steve 

  • Hi Steve,

    First, for the tone generator, you need to stop it and then run it using its property window after the code has been executed (i.e. it will not run if started as 'Run'.) One good way to test this is to connect it to interpolator output (or I2S_Out if using miniDSP_A) to ensure it is running.

    To check coefficients I recommend using Peek/Poke. The buffer switch is handled automatically with this. Using the I2C direct read will not work as seamlessly. The reason is that you need to switch buffers every time you read a coefficient in adaptive mode (as mentioned in C-RAM app note).

    Regards,

    J-

  •  Steve,

    Here is one example:

    1) Set ToneGen Status to Stop and 0.5 amplitude. (*correction*, was 0.2).

    2) Download the code.

    3) Set ToneGen Status to Run.

    4) Set Peek data format to M7.

    5) Swap the miniDSP buffer.

    6) Write the correct C-RAM address in Peek and select appropriate miniDSP (A or D).

    7) Click Peek.

     The reason to use M7 is because of the equation mentioned in the Spectrum Analyzer help file. It states that you need to divide the value you get by 2^17 to get the dB value. If we start in M24, you get the coefficient value as signed int24. Then 24-17 will give you 7. In this example, the tone is 0.5 of full-scale, or -6dB.

     Regards,

    J-

     

  •  

    Thanks a lot for your help.

    I try and it really work out. It make me more familiar with the function and the C-RAM Access.

    So, if I want to read the value on the end system and don't use the PurePath Memory Tool , how can I do it?

    More practically, the sound woulg change continuously.

    Can I store the value in every 16ms (same as swap the buffer in evey 16ms) ?

    Thanks for your further reply.

    Best regards,

    Steve

  • Steve,

    In the moment the buffer is swapped to give access to the I2C bus, that data will not change. So switching the buffer will give you a snapshot of what all the coefficients look like at the instant the buffer was swapped.

    Below is some code example for this functionality. In this example, you have two constants, DAC_CRAM_PAGE which is the page where all the bands are located and COEFF_REGISTER which is the first register contaning coefficients (e.g. 30 bands starting at register 8 would range from register 8 to 128 because of 4 bytes per coefficient).

    // -----------------------------------------------------------------------------
    // app_spectrum_getCoeffs
    // -----------------------------------------------------------------------------
    // Description:
    //   Reads spectrum data from miniDSP C-RAM.
    // Inputs:
    //   unsigned char *coeff_buffer
    // Output:
    //   none
    // -----------------------------------------------------------------------------
    void app_spectrum_getCoeffs(unsigned char *coeffBuffer)
    {
     audio_swapBuffer(DAC_CRAM_PAGE);     // Swap DAC C-RAM
     coeffBuffer[0]= COEFF_REGISTER;     // First C-RAM register
     audio_spiread(coeffBuffer, COEFF_BUFF_SIZE-1);
    }

    Let's say you want to display the coefficient as a line in a spectrum analyzer, then you can re-map it from dB to pixels. Below is an example for a 16-bit micro:

    // -----------------------------------------------------------------------------
    // app_spectrum_scaleCoeff
    // -----------------------------------------------------------------------------
    // Description:
    //   Scales a coefficient to match BAR_HEIGHT. Each band is
    //  represented as dB with a range of [-64, 0] (7.x format), which is
    //  re-mapped for a bar length BAR_HEIGHT.
    // Inputs:
    //   const unsigned char *coeff  -> Pointer to coefficient MSB
    // Output:
    //   Coefficient re-mapped to (0, BAR_HEIGHT-1)
    // -----------------------------------------------------------------------------
    unsigned char app_spectrum_scaleCoeff(const unsigned char *coeff)
    {
     signed long int i32_coeff;      // 32-bit coefficient
     double coeff_dB;        // Coefficient in decibels

     i32_coeff = (((*(coeff))   * 16777216 ) |  // << 24
         ((*(coeff+1)) *    65536 ) |  // << 16
         ((*(coeff+2)) *      256 ) );  // << 8
     coeff_dB = i32_coeff / 33554432.0 ;    // Divide by 2^25

     return (((coeff_dB+64.0)*((BAR_HEIGHT-1)/64.0)));
    }

    Regards,

    J-

     

  • J-,

    Thanks for your reply and the sample code.

    Can I read the register value in the PurePath programming without using the memory tool ?

    In other words, can I save the value as a constant and use the value to do further enumerating?

    Thanks for your reply.

    Regards,

    Steve 

  • Steve,

    The spectrum analyzer outputs data into a coefficient. You can read this coefficient and use it in your code as follows:

    First Generate the code to get CoefName by looking at View > Source Code.

    You might get that the name of the spectrum analyzer is:

    specAna_1_power_band1_l_1

    Then place two constant coefficient components and one AddCoeff component.

    In AddCoeff component, set InputCoefName1 to "specAna_1_power_band1_l_1", InputCoeffName2 to "C_1_Coefval" and OutputCoefName to "C_2_Coefval". Note that the C_x_Coefval may change in your process flow depending on the name of the components you place. You can use the output of C_2_Coefval to read the value.

    Regards,

    J-

  • J-,

    Thanks for your reply and it work out.

    In this situation, does it mean that if I just want to calculate in the mini-DSP, I don't need to swap the buffer because the purpose of the buffer swap only let us use the PC(memory tool) to see  the snapshot of the value.

     Regards,

    Steve.

  • J- ,

    In a situation that the voice change continuously and I want to keep calculating the value of spectrum analyzer.

    How can I save the last second value to do calculating and still read the value in the same moment?

    Regards,

    Steve. 

  • Steve,

    You could use a delay component.

    Regards,

    J-

  • J-,

    Thanks for your help.

    It's really helpful.

    Regards,

    Steve

  • Hi J-,

    I want to ask another question about the spectrum analyzer.

    Now I try to use MSP430 SPI to read the coefficient value of spectrum ananlyzer.

     Is the p44_r1_b0 will reset itself after I set it "1"?

    If I want to read the value of the buffer,should I change the address after switching the buffer.

    For example, do I need to change between the page 44 for 'buffer A' and page 62 for 'buffer B'.

    Or  I just need to read the same register after every switching the buffer..

    Best Regard,

    Steve.

     

  • hello J,

    I have done as your instruction, build>generate code, view>source code, but not found specAna_1_power_band1_l_1. how should i proceed?

    Thansk

    kal

  • Hello,

    Looks like this feature has been disabled in the newer PPS version. We'll look into it, but not that this is not required to be able to use Spectrum Analyzer component.

    Regards,

    J-

  • Hello J,

    Thanks for the reply. Could you please show me how to use the Spectrum Analyzer component?

    Below is the PPS diagram by following your instruction. But I am not clear what to do next.

    What I want to do is slightly the same as steve.

    1. Firstly is to read spectrum analyzer without memory tool. How to read value of output of C_2_Coefval  in PPS or in the end system?

    2. Secondly is to read spectrum analyzer by an end system. The end system is Arduino Uno with SPI control. How to read the spectrum analyser continuously as later on the end system will just read address/register of the spectrum analyser continuously?

    3. Next, to write miniDSP using Arduino Uno with SPI control. How to find the address/register of each component such as biquad, spectrum analyzer, and etc? What is the format to write from Arduino Uno to AIC3254?

    4. Finally to implement Feedback Destroyer Algorithm with Integration of Arduino Uno and AIC3254. This Algorithm is able to be develope once the Arduino Uno can read and write the AIC3254 by SPI control.

    Please Advise.

    Regards,

    Kal

  • Hi,

    There is no need to use AddCoeff component if you simply want to send data through SPI. You just read the coefficient location that corresponds to the spectrum analyzer via SPI. See the previous posts for instructions on how to do this.

    The coefficient (C-RAM) address can be found in the properties window of the spectrum analyzer component. The host needs to perform buffer swaps as explained previously to obtain the latest values.

    Regards,

    J-

  • Hello J,

    To make sure what I read of spectrum analyzer from SPI is true, so that i need to read spectrum analyzer in PPS first. In that case I can compare both values are matched so that I can confirm the reading from SPI is true.

    Please Advise.

    Thanks for reply.

    Regards,

    kal

  • See Verified Answer from Aug 24, 2011 http://e2e.ti.com/support/data_converters/audio_converters/f/64/t/129124.aspx?pi109030=1

    It explains how to confirm the spectrum analyzer value using PPS using peek and poke.

    Regards,

    J-

  • thanks J,

    I will start to explore this.

    Regards,

    kal