3.1 터미널 프로그램 Token2Plus
Download
Report
Transcript 3.1 터미널 프로그램 Token2Plus
박찬식 교수님
조교 : 양준석, 조민규
Contents
1) 프로젝트 팀 구성, 보드 재료 소개, 개발 환경 구축
2) GPIO 실습(LED, 7-세그먼트)
3) Interrupt 실습 (LED, Switch)
4) Timer를 이용한 시계
5) 모터, PWM 신호 발생
6) 모터, PWM 신호 발생
7) SPI
8) USART
9) 센서 I2C
10) 프로젝트 주제 설정
2
1.4 Clock Control
■ STM32 CPU의 최대 시스템 클럭인 72Mhz를 사용하는 방법에 대한 실험을
진행할 것이다
1.4 Clock Control
내부 HSI (8MHz)를 사용하는 방법과 외부 HSE (12Mhz)를 이용하는 방법
1.4 Clock Control
Clock control register (RCC_CR)
#define RCC_CR_HSEON
#define RCC_CR_HSERDY
#define HSEStartUp_TimeOut
((uint32_t)0x00010000)
((uint32_t)0x00020000)
((uint16_t)0x0500)
RCC->CR |= ((uint32_t)RCC_CR_HSEON);
do
{
HSEStatus = RCC->CR & RCC_CR_HSERDY;
StartUpCounter++;
}
while((HSEStatus == 0) && (StartUpCounter != HSEStartUp_TimeOut));
1.4 Clock Control
Clock configuration register (RCC_CFGR)
#define RCC_CFGR_PLLSRC_HSE
((uint32_t)0x00010000)
#define RCC_CFGR_PLLMULL6
((uint32_t)0x00100000)
RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_HSE | RCC_CFGR_PLLMULL6);
1.4 Clock Control
Clock control register (RCC_CR)
#define RCC_CR_PLLON
#define RCC_CR_PLLRDY
((uint32_t)0x01000000)
((uint32_t)0x02000000)
RCC->CR |= RCC_CR_PLLON; /* Enable PLL */
while((RCC->CR & RCC_CR_PLLRDY) == 0){;} /* Wait till PLL ready*/
1.4 Clock Control
Clock configuration register (RCC_CFGR)
#define RCC_CFGR_SW_PLL
#define RCC_CFGR_SWS
((uint32_t)0x00000002)
((uint32_t)0x0000000C)
/* Select PLL as system clock source */
RCC->CFGR |= (uint32_t)RCC_CFGR_SW_PLL;
/* Wait till PLL is used as system clock source */
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)0x08){;}
3.1 터미널 프로그램
■ Token2Plus
http://www.coung.net/Token2Shell
3.1 터미널 프로그램
■ Token2Plus
3.1 터미널 프로그램
■ Token2Plus
1.5 7-세그먼트 구동 실습
■ Mango-M32 보드에 구현된 7-세그먼트와 그에 연결된 GPIO를 이용하여 7-세그
먼트를 구동하는 예제이다. 여기서 7-세그먼트는 0에서 9까지의 숫자를 표시하도
록 구성되었으며, 1초마다 0에서부터 차례로 증가하여 9까지 표시하도록 한다
1.6 7-세그먼트 구동 실습
■ 직접 회로를 구성하고 7-Segment의 각 자리 pin 불을 켜보는 실험
1.6 7-세그먼트 구동 실습
■ 직접 회로를 구성하고 7-Segment의 각 자리 pin 불을 켜보는 실험
#define
#define
#define
#define
#define
#define
#define
#define
#define
GPIO_7_SEG_POWER_PIN GPIO_Pin_8
GPIO_7_SEG_A_PIN
GPIO_Pin_0
GPIO_7_SEG_B_PIN
GPIO_Pin_1
GPIO_7_SEG_C_PIN
GPIO_Pin_2
GPIO_7_SEG_D_PIN
GPIO_Pin_3
GPIO_7_SEG_E_PIN
GPIO_Pin_4
GPIO_7_SEG_F_PIN
GPIO_Pin_5
GPIO_7_SEG_G_PIN
GPIO_Pin_7
GPIO_7_SEG_DP_PIN
GPIO_Pin_6
#define
#define
#define
#define
#define
#define
#define
#define
#define
GPIO_SEG_POWER_PIN GPIO_Pin_8
GPIO_SEG_A_PIN GPIO_Pin_0
GPIO_SEG_B_PIN GPIO_Pin_1
GPIO_SEG_C_PIN GPIO_Pin_2
GPIO_SEG_D_PIN GPIO_Pin_3
GPIO_SEG_DIG_4 GPIO_Pin_4
GPIO_SEG_DIG_3 GPIO_Pin_5
GPIO_SEG_DIG_2 GPIO_Pin_6
GPIO_SEG_DIG_1 GPIO_Pin_7
1.6 7-세그먼트 구동 실습
■ 직접 회로를 구성하고 7-Segment의 각 자리 pin 불을 켜보는 실험