임베디드 보드/STM32

STM32 F429zi ADC 15 multi channel

ZEROWIN.TECH 2021. 2. 10. 10:11
728x90

가변저항을 이용하여 ADC 멀티채널 테스트를 합니다.

아두이노 시리얼프로터를 이용하여 ADC값을 그래프로 표시합니다.

ioc 파일 설정

adc channel 추가

DMA Settings

ADC3

#define ADC1_NUM 9
#define ADC3_NUM 6
uint32_t ADC1Result[ADC1_NUM];
uint32_t ADC3Result[ADC3_NUM];

/* USER CODE END 0 */

/**
  * @brief  The application entry point.
  * @retval int
  */
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_DMA_Init();
  MX_USART3_UART_Init();
  MX_ADC1_Init();
  MX_ADC3_Init();
  /* USER CODE BEGIN 2 */
  HAL_ADC_Start_DMA(&hadc1, (uint32_t *)ADC1Result, ADC1_NUM);
  HAL_ADC_Start_DMA(&hadc3, (uint32_t *)ADC3Result, ADC3_NUM);
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
	while (1) {

		 //HAL_ADC_Start(&hadc1);  // start using ADC
		 //HAL_ADC_PollForConversion(&hadc1, 10);  //set adc address and time out value
		 //uint16_t adcValue = HAL_ADC_GetValue(&hadc1);  // get adc value

		 //HAL_ADC_Start(&hadc3);  // start using ADC
		 //HAL_ADC_PollForConversion(&hadc3, 10);  //set adc address and time out value
		 //uint16_t adcValue2 = HAL_ADC_GetValue(&hadc2);  // get adc value

		 // printf("adc : %d, %d\n", adcValue, adcValue2);
		printf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\r\n",
				ADC1Result[0], ADC1Result[1], ADC1Result[2], ADC1Result[3], ADC1Result[4], ADC1Result[5], ADC1Result[6], ADC1Result[7], ADC1Result[8],
				ADC3Result[0], ADC3Result[1], ADC3Result[2], ADC3Result[3], ADC3Result[4], ADC3Result[5]);

		HAL_Delay(100);

    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
	}
  /* USER CODE END 3 */
}


테스트영상

STM32CubeIDE

STM32CubeIDE는 STM32Cube 소프트웨어 에코 시스템의 일부인 올인원 다중 OS 개발 도구입니다.

 

www.st.com/en/development-tools/stm32cubeide.html

 

STM32CubeIDE - STMicroelectronics

STM32CubeIDE - Integrated Development Environment for STM32, STM32CubeIDE-RPM, STM32CubeIDE-Lnx, STM32CubeIDE-Win, STM32CubeIDE-DEB, STM32CubeIDE-Mac, STMicroelectronics

www.st.com

 

PINMAP

docs.zephyrproject.org/1.13.0/boards/arm/nucleo_f429zi/doc/nucleof429zi.html

 

ST Nucleo F429ZI — Zephyr Project Documentation

ST Nucleo F429ZI Overview The Nucleo F429ZI board features an ARM Cortex-M4 based STM32F429ZI MCU with a wide range of connectivity support and configurations. Here are some highlights of the Nucleo F429ZI board: STM32 microcontroller in LQFP144 package LS

docs.zephyrproject.org

GitHub Source code

 

github.com/rionkim54/tutorial_adc_multichannel

참조동영상

 

www.youtube.com/watch?v=jsIX7jMMTEg

 

'임베디드 보드 > STM32' 카테고리의 다른 글

STM32H743II ADC multi channel + UDP Client  (0) 2021.02.15
STM32H7 OpenH743I-C ADC Multi Channel  (0) 2021.02.10
PTC PWM  (0) 2020.11.07
UI Design  (0) 2020.10.21
bmp2c convert batch  (0) 2020.09.17