AnsweredAssumed Answered

STM32F4 ADC 12 Channels DMA transfers wrong ,repeated values

Question asked by Diego Colombo on Jan 11, 2018

please,once more i need help ,being a novice on the use of DMA


MCU is STM32F410RBT,mounted on a custom board
Configuration done with CubeMx,IDE is STM32 Workbench


I'm sampling 12 channels at 1KHz,12 bits, i mean that every 1 ms i should have a new collection of 12 samples


The error is that ,for at least one channel ,the sequence of consecutive values is not correct:

I set a bench with a ramp waveform in a way that during the rise of the ramp every sample should be about 145 bits greater than the previous one,the collected values instead are showing some wrongly repeated values between right values,see image,of course the blue ramp-values are the right ones.I can say taht other ADCchannels are at values about 0 bits,because they are connected to VSS,so i reasonably claim that they are not responsible of values in the list
comparison between correct ascending ramp,and ramp with repeated values

The problem happens even if i transfer the data in single mode or burst of 4

Is it a typical syntom of some trivial error?


I use circular buffer mode,FIFO treshold full,and i do almosto nothing on DMA interrupt,except collecting data,i don't flush the FIFO unless such stuff is done by the HAL_DMA_IRQHandler function


void DMA2_Stream0_IRQHandler(void)
   /* USER CODE BEGIN DMA2_Stream0_IRQn 0 */


   /* USER CODE END DMA2_Stream0_IRQn 0 */
   /* USER CODE BEGIN DMA2_Stream0_IRQn 1 */

   test_array[test_index++]=ADC1ConvertedValues[0];//contains the first of 12 samples
   test_index &=TEST_WRAP_LIMIT;//restart index from 0 when it reaches the end of the array

  /* USER CODE END DMA2_Stream0_IRQn 1 */



Thanks in advance,