AnsweredAssumed Answered

STM32F7 Discovery - having trouble getting the ADC DMA to work

Question asked by 123abc.abc123 on Jul 31, 2015
Latest reply on Nov 11, 2016 by waters.matthias
Hello all,

I have configured the ADC to trigger based on Timer 6 update event every (1/48000) seconds. DMA is used to transfer the ADC conversion to memory. However, when I  debug, I see the timer count being incremented, but I don't see any ADC conversion being made or anything in the memory location where it saves the ADC values through DMA.

I have used ST's CubeMX to generate the initialization code.

#include "stm32f7xx_hal.h"
uint16_t ADC3ConvertedValue = 0;
uint16_t ADC_Value = 0;
/* USER CODE BEGIN Includes */
 
/* USER CODE END Includes */
 
/* Private variables ---------------------------------------------------------*/
ADC_HandleTypeDef hadc3;
DMA_HandleTypeDef hdma_adc3;
 
TIM_HandleTypeDef htim6;
 
/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/
 
/* USER CODE END PV */
 
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_DMA_Init(void);
static void MX_ADC3_Init(void);
static void MX_TIM6_Init(void);
 
/* USER CODE BEGIN PFP */
/* Private function prototypes -----------------------------------------------*/
 
/* USER CODE END PFP */
 
/* USER CODE BEGIN 0 */
 
/* USER CODE END 0 */
 
int main(void)
{
 
  /* USER CODE BEGIN 1 */
 
  /* USER CODE END 1 */
 
  /* MCU Configuration----------------------------------------------------------*/
 
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
 
  /* Configure the system clock */
  SystemClock_Config();
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_DMA_Init();
  MX_ADC3_Init();
  MX_TIM6_Init();
 
  HAL_TIM_Base_Start(&htim6);
  HAL_ADC_Start_DMA(&hadc3, (uint32_t*)&ADC3ConvertedValue, 1);
   
  while (1)
  {
 
   
 
  }
  /* USER CODE END 3 */
 
}


ADC3.PNG
ADC3_DMA.PNG
Timer6.PNG

Outcomes