System Control & Clock UNIT 08 로봇 SW 교육원 조용수
학습 목표 System Control Register System Clock CMSIS CMSIS Project 2
System Control Register Reset, System Timer, Interrupt 등을 관리 전반적인 MCU 동작에 영향을 미치는 작업으로, 초 기 Power Up 시점에서 관련 Register 설정이 필요 3
System Control Register 4 PDID : MCU ID
System Control Register 5 RSTSRC : System Reset Source Register
System Control Register 6 IPRSTC1 : Peripheral Reset Control Register 1
System Control Register 7 IPRSTC2 : Peripheral Reset Control Register 2
System Control Register 8 Brown-Out Detector – 전원 전압이 일정값 이하로 저하되는 것을 감지 BODCR : Brown-Out Detector Control Register
System Control Register 9 MCU 의 경우 제한된 Pin 으로 인하여 여러가지 기 능이 하나의 핀 Out 에 공유된다. Px_MFP : Multi Function and Input Type Control
System Control Register 10 P0_MFP : Multi Function and Input Type Control
System Control Register Lock & Unlock – 외부 Noise 및 시스템 오 동작 으로 인한 전체 시스템의 영향을 막기 위한 작업 –MCU 의 중요한 Register 를 일정 형식의 Unlock 루틴을 거쳐야 Write 가능 11
System Control Register Lock & Unlock 12
System Control Register Lock & Unlock 13
System Control Register Lock & Unlock 14
System Control Register C 15
Clock MCU 동작을 위한 기본 단위 모든 내부 동작은 Clock 과 동기화 하여 진행된다. 16
Clock X-tal – 주변에 발진에 필요한 회로 구성필요 – 가격 저렴 Osc – 발진 회로 내장 – 정확한 주파수 출력 17
Clock 4 가지의 Clock Source 제공 4~24 MHz external high speed crystal oscillator (HXT) Programmable PLL output clock frequency (PLL source can be selected from external 4~24 MHz external high speed crystal (HXT) or MHz internal high speed oscillator (HIRC)) (PLL FOUT) MHz internal high speed RC oscillator (HIRC) 10 kHz internal low speed RC oscillator (LIRC) 18
Clock 선택된 Clock 은 각 I/O 디바이스의 Clock 으로 공급 19
Clock Control Register 20
Clock Control Register 21 PWRCON
Clock Control Register 22 AHBCLK
Clock Control Register 23 APBCLK
Clock Control Register 24 CLKSTATUS
Clock Control Register 25 CLKSEL0
Clock Control Register 26 CLKSEL1
Clock Control Register 27 CLKSEL2
Clock Control Register 28 CLKDIV
Clock Control Register 29 PLLCON
Clock Control Register 30 PLLCON
System Init 31 #define GCR_BA 0x #define CLK_BA 0x #define GPIO_BA 0x void UnlockReg() { *((volatile unsigned int *)(GCR_BA + 0x100))=0x59; *((volatile unsigned int *)(GCR_BA + 0x100))=0x16; *((volatile unsigned int *)(GCR_BA + 0x100))=0x88; } void LockReg() { *((volatile unsigned int *)(GCR_BA + 0x100))=0x01; } void SystemInit() { int count = ; UnlockReg() ; *((volatile unsigned int *)(CLK_BA + 0x00)) |=0x04; while(count--); LockReg() ; }