Solved
Trouble with multiple ADCs and DMA
I'm trying to get ADC values from multiple channels of ADC1 of STM32F103C8T6 using DMA where conversion is triggered by TIM3 every 1ms. However, I'm not seeing the right values. I tried the polling mode and that worked fine. Here is the main function code so far and the settings in CubeMX. The full code is here. What am I missing?
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();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ADC1_Init();
MX_SPI1_Init();
MX_TIM1_Init();
MX_I2C1_Init();
MX_USART1_UART_Init();
MX_DMA_Init();
MX_TIM2_Init();
MX_TIM3_Init();
/* USER CODE BEGIN 2 */
HAL_ADC_Start_DMA(&hadc1, (uint32_t*) adc1_values, 2);
HAL_TIM_Base_Start(&htim3);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
