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.

TLV320AIC3206: Overflow in Biquads in TLV320AIC3206

Part Number: TLV320AIC3206

Hi!

I am using the Biquad filters in the TLV320AIC3206 to shape the audio signal and I am getting weird oscillations from the filter when there is overflow in the filter calculations. My initial version did not scale the signal before processing the audio. With some scaling, the performance improved but I am not sure if I am still overflowing the biquads.

Can you tell me how to adjust the filter scaling to prevent this from happening? I am currently setting the HA filter to { 0x1CA7D7,0,0,0,0 } to scale the signal by 13 dB to allow some headroom in the Biquad calculations.

The rest of my coefficients are:

        FILTER_PARAMS_BQ,            // EQ 81 Hz Fc -6,0 dB 50 Hz BW
        0x7F95F6,
        0x80D668,
        0x7EC0E3,
        0x7F2998,
        0x81A926,
        FILTER_PARAMS_BQ,            // EQ 526 Hz Fc -6,0 dB 300 Hz BW
        0x7D97B6,
        0x851E39,
        0x78C146,
        0x7AE1C7,
        0x89A703,
        FILTER_PARAMS_BQ,            // Treble Shelf 10000 Hz Fc 11,0 dB
        0x7FFFFF,
        0xC52F04,
        0x299ACD,
        0x10834D,
        0xE8877A,

What is the accuracy of the calculations through the filter chain? Scaling the signal by 13 dB reduces the signal from 24 bit to 22 bit. (The last bits being just noise anyway so this does not matter really) but I am curious how much scaling that should be applied to completely eliminate the overflow in the calculations.

Best regards,

Stefan Burstrom

  • Hi Stefan,

    If any of the biquad stages amplify the signal then the outputs of that stage can get clipped and also it's internal state variables can bet corrupted.

    So it is recommended that the input be gained down to prevent clipping. It appears that the treble shelf gain is 11 dB (can you confirm). If so then you would need to scale the input down by at least 11 dB to prevent clipping. Are you getting the instability from this section? You can set it all pass to compare.

    Best Regards.

  • Hi!

    The comment in the code was wrong, the gain of the shelf is 5 dB, not 11 dB. However, it does not make a big difference if I turn off this portion of the filter, I can still get the state variables to become corrupted. I suppose the same thing could happen with the 6 dB gain EQ setting at 50 HZ?

    What puzzles me is the behavior of the shelf filter when I use TIBQ to generate the coefficients. If I only enable the shelf filter, the graph shows that everything below 10kHz is attenuated by 3 dB and the shelf becomes a 2 dB gain. (See picture below)

    Whats weird is that the first time the shelf is added to the filter chain, the shelf part is rendered as 5 dB gain. If I disable and then reenabel the shelf filter again, then it is rendered as below. So I am not sure how the filter actually behaves. I have requested access to PurePath Studio to try the filter generation there, but for some reason I am not granted access. (Which is funny as we are currently producing 10k units using the above codec :) )

    Best regards,

    Stefan

  • The attachments did not make it through. (1) Could you try attaching it again? and (2) What was the input you used for testing that caused the instability?

    When did you request access for PPS? The 3206 does not have PPS support. The 3256 and 3254 have PPS support.

    Please send me the above info. There are some limitations that come with 24-bit coefficient words that can become a problem for filters with low frequency cut-offs and also for filters with high-frequency cutoffs with high-Q settings. I will check it at my end.

    Best Regards.

  • Hi!

    The picture that I sent was a screenshot from the TIBQ tool. You can try the following:

    Enable filter 1

    Select type Treble shelf

    Select FC = 10000

    Select gain = 10

    Now TIBQ will show a flat 0 dB response below 10k and then 10dB gain above 10k
    Now, disable filter 1 and enable it again. This will now show the flat response at -6dB below 10k and 4dB above 10k
    I have been digging a little bit on my end and I can only assume that the initial response curve is wrong and the 2nd one is the curve where filter coefficients have been normalized to not exceed 1.
    When I calculate a generic shelf filter, I get some of the coefficients >1, so I assume that the TIBQ just does not correctly visualize this in the graph. The coefficients are never beyond 0x7fffff. The reason why I am bringing this up is that I was not sure how to correctly rescale the signal after the treble shelf filter to achieve 0 dB gain in the flat section.

    The input signal that cause instability is mechanical noise if you scratch the surface of the microphone. Ie, I am not expecting this to sound good, I just want to ensure that this does not leave the filter self oscillating.

    With the following filter parameters, how much do you anticipate that a full swing input signal should be scaled to prevent overflow:
    Text "* Filter 1 High Pass 1st Order Butterworth, 10 Hz Fc 0,0 dB "
    Text "* Filter 2 EQ 81 Hz Fc 6,0 dB 50 Hz BW"
    Text "* Filter 3 EQ 526 Hz Fc -6,0 dB 300 Hz BW"
    Text "* Filter 4 Treble Shelf 10000 Hz Fc 5,0 dB"

    Btw, the only reason why I requested access to PurePath studio was that I was hoping that it had an updated filter coefficient calculator that did not have the issue that I described above (that a shelf filter response does not initially show up correctly)

    Best regards,

    Stefan

  • Hi Stefan,

    Yes, you are right that the filter response changes after the coefficients are normalized. The scale column indicates the scaling factor (=0.478...) applied to keep the coefficients from going beyond 0x7FFFFF. To achieve 0 dB gain in the flat section, the inverse scale factor (1/0.4787... = 2.088955) has to be applied.

    I am not able to see any instability with the filter settings that you mentioned. I tried the following filter setting and don't see any problem with a white noise test input. Could you send me the device configuration and a recording of your unstable output? Are you trying this on the EVM or on a custom board?

    Best Regards.