AnsweredAssumed Answered

Write safeload to control Medium Size EQ

Question asked by JCB on Jul 31, 2014
Latest reply on Aug 1, 2014 by JCB

Hi all. Good day.

 

I'm trying to use MCU to send to safeload register to enable/disable Medium size EQ in SS Project. I'm having trouble in doing this.

The drawing was as per attached. I have no idea what's went wrongs. Hoping to get help in this forum.

 

The testing below were done to control EQ which center frequency is 2000Hz, Q=3, System Frequency Fs=48000Hz

I'm using ADAU 1701-Eval.

 

Method 1: Mathematics calculation

I had tried to use the mathematics calculation as in Help> Algorithm Information > EQ Algorithm > Peaking

Common Variables:

        boost = -40,   Fs= 48kHz,   f0 = 2000Hz,  gain =0, 

A  = 10^(boost/40)

ω0 = 2*pi*f0/Fs

alpha = sin(ω0)/(2*Q)  //(type: Peaking)    

gainLinear = 10^(gain/20)

      

Coefficients

a0 =  1 + alpha/A

a1 = -2 * cos(ω0)

a2 =  1 - alpha/A

b0 = (1 + alpha*A) * gainLinear

b1 = -(2 * cos(ω0)) * gainLinear

b2 = (1 - alpha*A) * gainLinear


Yet,  no luck. Because this calculation would gave different values as in Capture Window.

 

 

Method 2: Capture Window

I had tried to use data from capture windows(as in attachment below). But still no luck. The 2kHz audio was still heard and persist.

 

**************************************************************************************************************************************

MCU Safeload Codings:

For you information, I'm using Arduino Ethernet. Communication to DSP was done in I2C. Tested connection is working fine by reading from DSP Readback block.

 

Here are the main part:

 

void loop (){

       if(clicked){        

                val_EQ0B1[0] = 0x00; val_EQ0B1[1]= 0x59; val_EQ0B1[2]=0xcf; val_EQ0B1[3] =0x95;  // B0 {0x00, 0x59, 0xCF, 0x95};  *hard-coded values for f0=2000

                val_EQ1B1[0] = 0xff; val_EQ1B1[1]= 0x53; val_EQ1B1[2]=0x3e; val_EQ1B1[3] =0x72;   //  B1 {0xff, 0x53, 0x3e, 0x72 };

                val_EQ2B1[0] = 0x00; val_EQ2B1[1]= 0x59; val_EQ2B1[2]=0x0a; val_EQ2B1[3] =0x15;  // B2 {0x00, 0x59, 0x0a, 0x15 };

                val_EQ1A1[0] = 0x00; val_EQ1A1[1]= 0xac; val_EQ1A1[2]=0xc1; val_EQ1A1[3] =0x8e;  // A1 {0x00, 0xac, 0xc1, 0x8e };

                val_EQ2A1[0] = 0xff; val_EQ2A1[1]= 0xcd; val_EQ2A1[2]=0x26; val_EQ2A1[3] =0x56;   //  A2  {0xff, 0xcd, 0x26, 0x56 };


                    i2c_safeload_write_block(Dev_Address, 0x0815, Addr_Filter2_EQ0B1, val_EQ0B1, 4);

                    i2c_safeload_write_block(Dev_Address, 0x0816, Addr_Filter2_EQ1B1, val_EQ1B1, 4);

                    i2c_safeload_write_block(Dev_Address, 0x0817, Addr_Filter2_EQ2B1, val_EQ2B1, 4);

                    i2c_safeload_write_block(Dev_Address, 0x0818, Addr_Filter2_EQ1A1, val_EQ1A1, 4);

                    i2c_safeload_write_block(Dev_Address, 0x0819, Addr_Filter2_EQ2A1, val_EQ2A1, 4);

                    set_core_IST_bit(Dev_Address); 

          }

}

****************** Functions *************************

void i2c_safeload_write_block( int deviceaddress,  unsigned int safeload_adr, unsigned int celladdress, byte* data, byte length ) {

    unsigned int safeload_data_reg=0x0810;

    switch(safeload_adr)

    {

       case 0x0815: safeload_data_reg=0x0810; break;

       case 0x0816: safeload_data_reg=0x0811; break;

       case 0x0817: safeload_data_reg=0x0812; break;

       case 0x0818: safeload_data_reg=0x0813; break;

       case 0x0819: safeload_data_reg=0x0814; break;

    }

   

    /* Safeload Data Register (2064 to 2068; 0x0810 TO 0x0814) Write Format*/

    Wire.beginTransmission(deviceaddress);   

    Wire.write((int)(safeload_data_reg >> 8)); // MSB

    Wire.write((int)(safeload_data_reg & 0xFF)); // LSB   

    Wire.write(0x00);  //compulsory 0x00

    byte c;

    for ( c = 0; c < length; c++)      Wire.write(data[c]);

    Wire.endTransmission();   

   

     /* Safeload Address Register (2069 to 2073; 0x0815 TO 0x819 ) Write Format*/

    Wire.beginTransmission(deviceaddress);   

    Wire.write((int)(safeload_adr >> 8)); // MSB

    Wire.write((int)(safeload_adr & 0xFF)); // LSB   

    Wire.write((int)(celladdress >> 8)); // MSB

    Wire.write((int)(celladdress & 0xFF)); // LSB   

    Wire.endTransmission();      

}

 

 

  void set_core_IST_bit(int deviceaddress)

  {  

    /*set the initiate safeload transfer bit ( 5th bit )

    in the core control register to initiate the loading into RAM*/

    Wire.beginTransmission(deviceaddress); 

    Wire.write(0x08);

    Wire.write(0x1C);  //address of DSP core control: 0x081C. Holds 2bytes data.

    Wire.write(0x00);

    Wire.write(0x3C);

  }

 

Hope to hear from you soon. Thank you very much

 

Best Regards.

JCB

Outcomes