cancel
Showing results for 
Search instead for 
Did you mean: 

Reading ADC after exactly 1.56 us

sanjib
Associate III
Posted on January 09, 2014 at 13:20

The original post was too long to process during our migration. Please click on the attachment to read the original post.
21 REPLIES 21
Posted on January 09, 2014 at 14:05

This is why ADC can be triggered from timers.

JW
Posted on January 09, 2014 at 14:22

Per your [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/Timer%20value%20calculation&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/AllItems.aspx&currentviews=871]earlier thread, what part about the fact you can't interrupt at these sorts of rates can't you get your head around?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on January 09, 2014 at 15:57

The timer is not set up the way the comments suggest, please fix that so we don't have to guess what your system/attentions are.

You have TIM2 basically interrupting every 100 cycles, of 84 MHz?, or 200 machine cycles. You can't do a lot with that, but you need to be very conscious about what you're doing, and how long that takes, or could take.

You need to let the HARDWARE manage high rate tasks.

You make the TIM trigger the ADC

You make the DMA copy the data at EOC

You make the ADC sequence the channels

And you service interrupt when you have dozens, or hundreds of samples to process.

You'll need to evaluate the resources you have, the documented function, and if that's sufficient to do what you want, in the way that you want.

If there aren't the resources, then you'll need to consider how you might address, mitigate,  or adapt what you're doing so you can.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
sanjib
Associate III
Posted on January 10, 2014 at 06:09

sanjib
Associate III
Posted on January 10, 2014 at 06:30

Posted on January 10, 2014 at 13:25

I'm not annoyed as much as I'm frustrated. I don't want to own your project, I have my degree already.

As you need to read 4 different pins in a cascade style, your option really is to program the list into the ADC and use sequence/continuous mode, and play games with the sample time, and inter-sample space setting, and bus clocks, to get the exact pacing you are looking for.

You could confirm the pacing via a GPIO toggled on DMA HT and TC interrupts, and measured on a scope.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on January 10, 2014 at 16:05

Ok, let's try playing this a different way.

Draw a system diagram for your sonar system, illustrating where these 4 analogue signals come from, what they are measuring, and what you expect the signals to look like.

Are they from a delay line?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
sanjib
Associate III
Posted on January 13, 2014 at 06:28

Posted on January 13, 2014 at 16:10

Ok, but why four separate analogue signals? Please DIAGRAM this system.

Again going to suggest to tune the clocking source, and sample time, and inter-sample time to meet your periodicity goals.

Or if you don't need multiple analogue sources sample one aggressively and process the data.

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