STM32F030C6T6_ADC_DMA
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-12-11 11:18 PM
Posted on December 12, 2015 at 08:18
we are configured the ADC1 ADC_CHANNEL_8 & ADC_CHANNEL_9 in DMA mode using STM32CUBMX version 4.0 for MDK-ARM.
But the ADC value are not updated in the user buffer,please help me how to configure the ADC using DMA mode. int main(void) { static uint32_t adc__user_buffer[2]={0}; uint8_t pData[15]={0}; /* 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_ADC_Init(); MX_TIM3_Init(); MX_USART1_UART_Init(); HAL_ADC_MspInit(&hadc); memset(adc__user_buffer,0,sizeof(adc__user_buffer)); HAL_ADC_Start_DMA(&hadc,(uint32_t*) adc__user_buffer, 2); /* USER CODE BEGIN 2 */ /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ memset(pData,0,sizeof(pData)); sprintf(pData,''ADC1 %4lu\r\n'',adc__user_buffer[0]); HAL_UART_Transmit(&huart1, pData, strlen(pData),5); memset(pData,0,sizeof(pData)); sprintf(pData,''ADC2 %4lu\r\n'',adc__user_buffer[1]); HAL_UART_Transmit(&huart1, pData, strlen(pData),5); HAL_Delay(1000); } /* USER CODE END 3 */ }
This discussion is locked. Please start a new topic to ask your question.
0 REPLIES 0
