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.

TAA5212: setting up bi-quad filter

Part Number: TAA5212

Tool/software:

Hello, I'm trying to setup biquad filters with the TAA5212, to do some filtering in the 20~100kHz region.

I drive the TAA5212 with the SAI interface of a STM32L4 microcontroller.
Using 187.5Khz as sample frequency and a bclk of 12Mhz.

I can read out the raw signal just fine, but I never notice the effect of the filter, can someone take a look at my register settings and tell my what I am doing wrong.

Register setup code:

writeByte(0x00, 0x00); // set page 0
writeByte(0x01, 0x01); // software reset
ThisThread::sleep_for(3); // device settle time after power on / reset


writeByte(0x02, 0x09); // Wake up with AVDD > 2v and all VDDIO level
ThisThread::sleep_for(3); // device settle time after wake


writeByte(0x10, 0x50); // Configure DOUT as Primary ASI (PASI) DOUT
writeByte(0x19, 0x00); // 1 data input and 1 data output for PASI
writeByte(0x1A, 0x70); // PASI I2S, 32 bit format

writeByte(0x50, 0x50); // ADC Ch1 single ended, mux inp1, 10KOhm, ac-coupled, 1Vrms

writeByte(0x76, 0x80); // Enable Input Ch1, disable output channels

// Set up filters before powering up any adc channel 30kHz low pass
writeByte(0x00, 0x08); // set page 8

writeByte(0x08, 0x2e); // N0 = 0x2e8f9340
writeByte(0x09, 0x8f);
writeByte(0x0A, 0x93);
writeByte(0x0B, 0x40);

writeByte(0x0C, 0xd1); // N1 = 0xd1706cc0
writeByte(0x0D, 0x70);
writeByte(0x0E, 0x6c);
writeByte(0x0F, 0xc0);

writeByte(0x10, 0x2e); // N2 = 0x2e8f9340
writeByte(0x11, 0x8f);
writeByte(0x12, 0x93);
writeByte(0x13, 0x40);

writeByte(0x14, 0x11); // D0 = 0x114fb4c0
writeByte(0x15, 0x4f);
writeByte(0x16, 0xb4);
writeByte(0x17, 0xc0);

writeByte(0x14, 0xE8); // D0 = 0xe8611cc0
writeByte(0x15, 0x61);
writeByte(0x16, 0x1c);
writeByte(0x17, 0xc0);

writeByte(0x00, 0x00); // set page 0 again
writeByte(0x72, 0x08); // No HPF enable 1 biquad

writeByte(0x78, 0xa0); // Power up ADC and MICBIAS

  • Hi Rob,

    One of our experts is looking into this thread and will respond soon.

    Best,

    Garret

  • Hi Rob,

    It is a little harder to deconstruct your coefficients for your filter, so instead I will explain my steps to get coefficients. First, you can use the TIBQ tool downloadable here: https://www.ti.com/tool/COEFFICIENT-CALC 

    This GUI allows you to select any type of filter you want, and choose the number of bits used in the biquad coefficients as well as the sample rate, then it generates the coefficients needed. For second order, all N0, N1, N2, D1, and D2 coefficients are generated, for first order, substitute 0 for N2 and D2. Make sure the coefficients are 32 bit and the sample rate is set to yours! Here are some example values I got from using the GUI to make a 30k LPF:

    If you replace your current coefficients with these does it help? Otherwise I can take a deeper look at your code and test it out next week.

    Best,
    Mir

  • Hi Mir,

    Thank you for looking into this and pointing us towards the TIBQ tool.
    We replaced our current coefficients with yours, unfortunately we didn't see any effect.

    Let me know if there are any other tests or settings I can provide or try.

    Best regards,

    Rob

  • Hi Rob,

    Could you try moving your line setting register 0x72 before setting the biquads? Also, what signal are you testing with and what are you looking at/listening to determine the effects of the filter? I know typically the AP GUI stops at around 20k, you need to manually expand the range of the FFT scope to see frequencies above that. Are you testing with noise or a freq sweep? Since 30k is above human hearing you would not be able to hear this change, it would be a FFT or spectrogram effect. 

    Best,
    Mir

  • Hi Mir,

    We moved our line setting register 0x72 before setting the biquads, we still see no result. We have also changed our ADC channel 1 band-width selection to 96 kHz mode (register 0x50).

     

    We check the result by measuring 16384 values and calculating the FFT using Matlab. When we use the programmable HPF (so no biquads) with a 25 kHz cutoff (first figure) we can see the response we would expect. However, when we set the programmable HPF to it's default value and try to use the biquads as shown in our code snippet, and according to the datasheet, we do not get the expected response. There is no filtering except for the HPF. The results are shown in the figure (second figure). The results show the response when we input the coefficients you gave us. Turning the biquads on or off makes no difference at all. They seem to be bypassed completely.

     

    Note that we are measuring free space, so without any input tone. That is why the signal is so weak. This shouldn't matter however, as shown in the first figure. We should definitely see a filter response. 



    The built in HPF with custom coefficients (not biquad)


    Default HPF with 1 biquad enabled with given coefficients

    Best regards,

    Rob

  • Hi,

    I notice you set D0 twice instead of D1 and D0, so this may be something else to change. However, I experienced something similar to you. I was able to get all these filters working at 96kHz sample rate and below, but at 176.5 or 192kHz the filter did not make a difference. 

    ^after running the script at 187.5k, we see no change

    I did see my filter's effects when I was at 48k or 96k. I did a 10kHz LPF for multiple different sample rates. I will include my script here, the only thing I changed was register 0x50 to put it in wide band mode, and changing the filter coefficients. I got all the coefficients from the TIBQ tool.

    w a0 00 00 # // set page 0
    w a0 01 01 # // software reset
    d 03
    
    w a0 02 09 # // Wake up with AVDD > 2v and all VDDIO level
    d 03
    
    w a0 10 50 # // Configure DOUT as Primary ASI (PASI) DOUT
    w a0 19 00 # // 1 data input and 1 data output for PASI
    w a0 1A 70 # // PASI I2S, 32 bit format
    
    w a0 50 50 # // ADC Ch1 single ended, mux inp1, 10KOhm, ac-coupled, 1Vrms
    w a0 50 61 #wide band, 40k input impedance
    
    
    w a0 76 80 # // Enable Input Ch1, disable output channels
    
    # // Set up filters before powering up any adc channel 30kHz low pass
    w a0 00 08 # // set page 8
    
    # MULTIPLE FILTER TRIES:
    # w a0 08 12 99 b4 44 12 99 b4 44 12 99 b4 44 2a f1 85 18 df b6 24 be
    # w a0 08 00 00 10 fe 00 00 10 fe 00 00 10 fe 7f bd f7 29 80 83 cd b3
    # w a0 08 09 3e c0 f5 09 3e c0 f5 09 3e c0 f5 46 fc c7 51 cd 0b 6d 86
    # w a0 08 02 e3 5f e4 02 e3 5f e4 02 e3 5f e4 62 12 29 08 b0 4e 2e 5d
    # w a0 08 02 c4 72 a8 02 c4 72 a8 02 c4 72 a8 62 c1 ca 18 af 6a a1 2c
    w a0 08 00 08 92 e7 00 08 92 e7 00 08 92 e7 7d 09 e0 f3 85 c9 f2 7e 
    
    
    w a0 00 00 # // set page 0 again
    w a0 72 08 # // No HPF enable 1 biquad
    w a0 78 a0 # // Power up ADC and MICBIAS
    
    
    
    

    I have asked our biquad expert on the team about the high sample rate issue. I will let you know what I find out.

    Best,
    Mir

  • Hi Mir,

    I was wondering if you had a chance to ask the biquad expert about this issue?

    Best regards,

    Rob

  • Hi Rob,

    I did ask but did not hear back, and now that you ask again he is out of office. I will ask others and make this a higher priority to get you an answer. It seems like a wide bandwidth specific issue.

    -Mir