Skip to main content
Apill
Associate III
Aug 22, 2018 1:42 PM UTC
Solved

Is it possible to store values of ADC every time it changes, I wanted to store them in DMA and do the average of samples? or Do i need to use an external sd card through i2c and store them in it?

..

    This topic has been closed for replies.
    Tesla DeLorean
    Tesla DeLoreanBest answer
    Guru
    Aug 22, 2018 3:31 PM UTC

    "Every time it changes" is a bit vague, every time the conversion completes it triggers a DMA transfer to a buffer, you can get an interrupt for the HT (Half) and TC (Complete) points in the buffer, which you want reasonably deep to reduce interrupt loading, and then you can do a running average of the inactive half of the buffer.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..

    3 replies

    Tesla DeLorean
    Tesla DeLoreanBest answer
    Guru
    Aug 22, 2018 3:31 PM UTC

    "Every time it changes" is a bit vague, every time the conversion completes it triggers a DMA transfer to a buffer, you can get an interrupt for the HT (Half) and TC (Complete) points in the buffer, which you want reasonably deep to reduce interrupt loading, and then you can do a running average of the inactive half of the buffer.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Apill
    ApillAuthor
    Associate III
    Aug 22, 2018 3:42 PM UTC

    thanks for the response, which brings me to a hypothesis DMA can store the values of ADC after conversion.???? after storing i would like to do the average of all the numbers stored in them.

    Tesla DeLorean
    Guru
    Aug 22, 2018 5:02 PM UTC

    Ok, so you'd traverse the array in the interrupt, summing the values, and computing your average.

    DMA in this context just auto-fills the array in the back ground, and you get an interrupt at various fill levels/points.

    What the DMA can't do is wait for the value on the ADC to vary, or do the summing.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..