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.

How Hardware Sample Averaging works

Hi, I am using TM4C129 for an audio application. I am trying to figure out how to use the oversampling function.

If I use one sequencer to sample 2 analog signals S1 and S2. The sequencer is activated by a timer set to 16KHz. The ADC sampling order will be:

S1, S2 (1/16K second interval) S1, S2 (1/16K second interval) S1, S2 ......

If I also enabled 4x oversampling, I guess the ADC order will be:

S1,S1,S1,S1, S2,S2,S2,S2 (1/16K second interval) S1,S1,S1,S1, S2,S2,S2,S2 (1/16K second interval) S1,S1S1,S1,S2,S2,S2,S2 ......

and the for consecutive values will be averaged to one.

This means, for each individual input, the oversampling does not happen evenly. It happens in a burst of 4 spaced by 1/16K second.

Is my understanding correct? If yes, how can I realize the oversampling so that the signal will be sampled EVENLY at 16K*4, and after the averaging, resulting in a signal stream at 16K rate?

  • Hello Tianlei,

    No. When S1 and S2 are put in the sequencer exactly once and triggered at 16KHz, then S1 and S2 will be sampled exactly one time for the trigger. So if 4x average is enabled then over 4 16Khz triggers will the data be collected for S1 and S2 and averaged.

    Do note that this is a 12-bit instrumentation amplifier and does not have the functions that are associated with a true voice sampling IC, e.g. 16 bit audio format, LPF, anti-aliasing filter, etc.

    Regards
    Amit
  • Hi Amit.

    If the sequencer is triggered at 16K and 4x average is also enabled, do you mean that I will get a 4K stream? What I found is that the sequencer still triggers interrupt at 16K even if I 4x average is enabled.

    I have LPF on the signal. I want to use the oversampling technique to off load some burden from anti-aliasing filter. 

    Thanks,

    Tianlei

  • Amit Ashara said:
    this [129's ADC] is a 12-bit instrumentation amplifier

    Newz to this reporter!    Might a (needed) "NOT" be missing?

    Compared to AD8251 (a real instrumentation amp) there are HUGE differences!   (none favoring the '129)

  • Hello Tianlei,

    The sequencer will be triggered at 16K, but the data would be averaged over 4 such samples before being made available in the ADC sequencer FIFO.

    Regards
    Amit
  • Hi,

    Let's remaind the user about this application note:  

  • Thanks a lot Petri!

    Hi Amit,

    I am starting to understand what happens inside the ADC now. Please verify:

    Signal S1 and S2 are in the same sequencer.

    no averaging -  when the sequencer is triggered, the ADC will spend 1uS to sample S1 and another 1us to sample S2. The sampled values are pushed into FIFO and the sequencer is done.

    4x averaging - when the sequencer is triggered, the ADC will spend 4uS to sample S1 4 times to get a average, then another 4uS for S2 to get another average. The two averages will be pushed into FIFO.

    Thanks,

    Tianlei

  • Hello Tianlei

    No. in 4X mode it will still take 1us to sample S1 and 1 us to sample S2. This it will do 4 times and then average will be pushed into the FIFO

    Regards
    Amit
  • Hi Amit,

    If this is the case, and if the sequencer is triggered at 16KHz, I will only get 4K samples per second at 4x averaging.

    What I found is that, no matter 4x average is enabled or not, my sequencer ISR (interrupt triggered on the completion of S2 sampling) is always invoked at 16KHz. This is what I don't understand. Do you mean that in the case of 4x averaging, I cannot rely on the sequencer ISR to read the FIFO, because there may not be valid data in the FIFO yet due to the 4x averaging function?


    Thanks,

    Tianlei

  • Hello Tianlei,

    The ISR shall be triggered on completion of the 4th transfer. To make this clear, toggle a GPIO in the ISR. In that case you should see a periodic waveform of 4KHz and not 16KHz, if the 4x average is enabled. Do note that for this to happen the sampler must have exactly one entry for S1 and S2.

    Regards
    Amit