Okay, so I have been doing a lot of reading over lunch about STM32's ADCs and I have a bunch of questions. Unfortunately, I haven't had time this week to do much experimenting so my actual data isn't too good, so I am going to just try to outline what my problem is and try to get some direction.
The application I am creating is a pretty straight-forward DSP problem. I need to continually read multiple analog channels [~(6-10) of them], perform some processing, then create some output. For an initial test, I tried to read each of the channels separately by calling analogRead() on the six separate pins. I measured the speed of these 6 reads and it clocks in at 44 milliseconds. This seemed way too slow to me [BTW, I measured this the easy arduino way using 2 calls to millis()]. After studying the libmaple source and reading this application note from ST, it appears to me that libmaple is using single conversion mode. The application note list something like 10 or 11 different modes and I am guessing one of the others would be optimal for my application but here is where I am split...
First off, I am wondering if I can get more speed out of this mode for the time being. I would rather just get on with development so I can get more familiar with this chip then tackle the problem later. I am guessing the slowdown isn't entirely just attributed to fact that analogRead() uses the single conversion mode, correct? For starters, the ADC is determined by a prescalar. So can that be pushed any faster? Also, I noticed this section of code in adc_init():
/* Up the sample conversion time to 55.5 cycles/sec, see note above */
/* TODO: fix magic numbers */
ADC_SMPR1 = 0xB6DB6D;
ADC_SMPR2 = 0x2DB6DB6D;
I think I read that this has something to do with the amount of samples that are taken for a measurement?? but what I cannot determine is how these numbers were derived and if the sampling process can be sped up or not. Actually, a good explanation of the adc_init() function would be helpful in general.
So, should I try to improve the single conversion process for my application? If so, at what level can I improve the speed without sacrificing too much accuracy. Could this possibly have anything to do with which pins I am using? Are the 2 ADCs configured differently?
OR
should I just go straight to trying to implement one of the other modes, possibly a dual or continuous scanning mode? If so, any suggestions on that.
OR
Is my problem way simpler than I am making it?
Thanks in advance and so sorry about the belabored points and the length of this post. Please correct my misunderstandings where possible.
Also, this post may be in the wrong forum...