Page 44 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 44
STM32는 크게 APB2와 APB1으로 나누어지는데 GPIO, USART1, SPI1, TIM1은 APB2
Clock Source에서 처리되며, TIM2, TIM3, TIM4, USART2, USART3, SPI2, I2C2, CAN,
USB2.0 등은 APB1에서 처리된다.
APB2 Clock은 System Clock(72MHz)을 그대로 사용하며, APB1 Clock은 System
Clock/2(36MHz)를 사용한다. 따라서 최고의 성능을 필요로 하는 부분은 APB2에 연결하여 사
용하면 된다.
다음은 ARM Processor USART통신 기능을 테스트하기 위한 프로그램이다.
① Main_USART_TEST.c
#include "stm32f10x.h"
#include "stm32f10x_usart.h"
#include <stdio.h>
#ifdef __GNUC__
/* With GCC/RAISONANCE, small printf (option LD
Linker->Libraries->Small printf set to 'Yes') calls
__io_putchar() */
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif /* __GNUC__ */
void RCC_Configuration(void);
void GPIO_Configuration(void);
void NVIC_Configuration(void);
void USART_Configuration(void);
void DMA_Configuration(void);
void Init_All_Periph()
{
RCC_Configuration();
GPIO_Configuration();
- 37 -