cancel
Showing results for 
Search instead for 
Did you mean: 

How to setup ADC 'smart' way to sample channels at different rates

denis
Associate II
Posted on October 17, 2013 at 10:03

I have about 2 - 3 channels which I need to sample differently , as in, say:

ch1  : at 400 Hz,  batch processing samples at 100,  (possibly one more chan like that)

ch2, 3: one sample every 100 is ok.

The ADC sampling is triggered by external timer trigger.

What would be proper way to do this?  Can this be done somehow with regular vs injected channels, without extra handling/reconfiguring in isr?

#the-part-is-complicated
4 REPLIES 4
Posted on October 17, 2013 at 15:53

It's going to be fairly complicated, you'd need to review the manual and resources of each ADC, trigger sources, DMA etc. for the part you're talking about and own the design choices/tradeoffs. You'll likely have to experiment.

The injected route seems to be one way of attacking the problem, but you'd still need to manage that, and where the data goes.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
denis
Associate II
Posted on October 18, 2013 at 10:27

clive1, what would be the other?

im very very , very open from suggestions from a pro 🙂

raptorhal2
Lead
Posted on October 19, 2013 at 03:29

Is it a mandatory requirement that nothing extra be done in the ISR ?

The simple approach is to sample all channels at 400 Hz. Save channel 1 and ? every time in the ISR and use a counter in the ISR to determine when to save channels 2 and 3.

Regards, Hal

denis
Associate II
Posted on October 21, 2013 at 10:25

Hey hal,   

>Is it a mandatory requirement that nothing extra be done in the ISR ?

well yes because we want to do as little as possible in software. i mean stm32 is such an advanced mcu, i thought such things can be totally done with proper config.

But otherwise yes, its in ISR.  Currently i'm  sampling at 400 but interrupting only every 4th sample after dma transfer completes to pass on a batch for processing.

Have an overhead of extra buffers.