2016-01-28 06:05 AM
http://manblaireau.net/Test/STM32F4_Builder_TEST.zip
) So here's my problem: I use a code found on the forum to use three ADC with DMA and the value that is returned to me trough a software serial connection are inconsistent, see yourself: My samples :http://manblaireau.net/Test/sinus10_100.png
http://manblaireau.net/Test/sinus1000_10000.png
And my code : I use a function generator directly in input of the ADC and my osciloscope confirms that it works. Have an idea ? Thank you in advance and good day. #stm3229i-discovery-adc-dma2016-01-28 07:16 AM
Your buffer holds 3 samples, it strains credulity that you can read these values and output them at the rate you are suggesting. You need a bigger buffer, the ADC needs to be in continuous mode, and you want to have the DMA ping-pong between two halves of the buffer (HT/TC) so it's not overwriting data as you are working with it.
Doesn't look to be any triggering going on, and the output of data is totally asynchronous. You need to think about the linear flow of data and time here, otherwise the data points you have are going to have no relationship to that.2016-01-28 08:31 AM
Hey ! Thanks for your response ! Very helpfull !
I had noticed that
my signal
appeared
asynchronous
but I thought
the
TIM2_Configuration
function
was used to
set the frequency
of
sampling
.I
'll digthe case.
So
I send the
first part of my
table
and then
the second
to avoid
overlap
acquisitions
?With
this kind of
approach
:(?)
void
DMA2_Stream0_IRQHandler(
void
) {
/* Test on DMA Stream Half Transfer interrupt */
if
(DMA_GetITStatus(DMA2_Stream0, DMA_IT_HTIF0)) {
/* Clear DMA Stream Half Transfer interrupt pending bit */
DMA_ClearITPendingBit(DMA2_Stream0, DMA_IT_HTIF0);
// save the first part of buffer here
}
/* Test on DMA Stream Transfer Complete interrupt */
if
(DMA_GetITStatus(DMA2_Stream0, DMA_IT_TCIF0)) {
/* Clear DMA Stream Transfer Complete interrupt pending bit */
DMA_ClearITPendingBit(DMA2_Stream0, DMA_IT_TCIF0);
// save the second part of buffer here
}
}
But then,
the
transmission
data
buffer
will not
interfere with the
sampling
?I will
make
future
tests,
in any case
what you say
makes sense.
Thank you.