当前位置:网站首页>An in-depth understanding of crystal oscillation circuit derived from xtalin pin and xtalout pin of single chip microcomputer
An in-depth understanding of crystal oscillation circuit derived from xtalin pin and xtalout pin of single chip microcomputer
2022-07-27 20:03:00 【xiebingsuccess】
The first step in the process of using single chip microcomputer is to choose the clock source of single chip microcomputer , You can often see the following circuit schematic diagram :

In this schematic diagram, a crystal oscillator is connected to XTALIN Pins and XTALOUT Pin , Provide clock frequency to MCU , Now let's analyze the working principle of this circuit in detail .
The clock sources of single chip microcomputer generally include the following :
1、 Through the of single chip microcomputer CLKIN The pin directly inputs a square wave clock to the MCU by an external clock source .
2、 As shown in the above figure, the MCU is connected by an external crystal oscillator XTALIN Pins and XTALOUT Pin , Together with the oscillation circuit inside the single chip microcomputer, it forms a clock source , Usually this clock source is called crystal oscillator (SysOsc), The accuracy of this clock source can reach very high, generally used ppm To represent the error of the external crystal oscillator . The frequency of this oscillator is determined by the external crystal oscillator , The biggest feature of oscillator is high frequency stability . Quartz crystal oscillators are used in systems that require high frequency accuracy and stability , Such as electronic watch 、 The master clock of the computer 、 High precision signal generator 、 Main oscillation source of all communication systems
3、internal RC Oscillator (IRC) Internal clock source , Usually a fixed frequency , such as 12M, The accuracy of this kind of clock can reach ±1.5%. When the communication rate is relatively high , For example, serial port 115200 Baud rate of , At this time, if IRC Error code will appear in clock communication ; When the communication rate is reduced , such as 2400 When the baud rate is reached, the communication will be normal , So in high-speed communication, we still need to use the above article 2 Kind of clock source .
4、 Special clock source of single chip microcomputer , such as dedicated Watchdog Oscillator (WDOsc) Clock dedicated to watchdog circuit , The clock used for the timer of single chip microcomputer wake-up (internal low-power, low-frequency Oscillato), The accuracy of this clock source is not high , Usually only ±40% The accuracy of the .
The following figure is a single chip microcomputer NXP824 Clock resources :

Will be inside IRC The clock passes through the switching matrix SWM Switch to output pin foot CLKOUT, The following waveforms can be seen through the oscilloscope , Show IRC Clock bit 12M.

void CLKOutInit (void)
{
LPC_SWM->PINASSIGN[11] = (LPC_SWM->PINASSIGN[11] & (~(0xFF << 16))) |
(CLKOUT << 16); /* Distribute CLKOUT To the pin P0_7 */
/*
* CLKOUTSEL To configure
* >bit[1:0] 0x0 IRC oscillator 0x1 Crystal oscillator(SYSOSC)
* 0x2 WDT oscillator 0x3 Main Clock
* >bit[31:2] Reserved
*/
LPC_SYSCON->CLKOUTSEL = 3; /* CLKOUT Source selection :MAINCLK */
LPC_SYSCON->CLKOUTUEN = 1; /* to update CLKOUT Clock source */
while (!(LPC_SYSCON->CLKOUTUEN & 0x01));
LPC_SYSCON->CLKOUTDIV = 24; /* CLKOUT Output distribution coefficient :24 */
}
It can be seen from the above that , The clock source of single chip microcomputer is generated by the oscillator , The following information is collected and sorted out from the network , Mainly to deepen the understanding of oscillation circuit .
Design principle of crystal oscillator
1.1、 Classification of oscillators

1.2、 The principle of oscillation
1.2.1、 The generation of self-excited oscillation


1.2.2、 Conditions for oscillation


1.3、 Starting vibration and amplitude
1.3.1、 Vibration initiation process

1.3.2、 Stability of amplitude


边栏推荐
猜你喜欢
随机推荐
transformers-bert
11.2DHCP
AutoCompleteTextView (input box pre match)
ms721负载测试
Qt的QTextToSpeech类实现语音播报功能
Systemservice (system service)
归一化(Normalization)和标准化(Standardization)
China business CDP white paper | love Analysis Report
Introduction to reinforcement learning
如何快速提升抖音小店三分钟回复率?哪些情况会影响抖音小店回复率呢?
C#网络应用编程,实验2:IP地址转换和域名解析练习
C # find perfect numbers, output daffodils and use of classes
uva1377
全局函数
Sword finger offer 25. merge two sorted linked lists
【C#】正序、逆序、最大值、最小值和平均值
11.5.OSPF
Function summary
成年人只有一份主业是要付出代价的,被人事劝退后,我哭了一整晚
高手勿进!写给初中级程序员以及还在大学修炼的“准程序员”的成长秘籍



![In a real case, college students were cheated when taking orders. I hope you won't be cheated [painful lesson]](/img/7d/142e69d6da1899cefbcc99d7929fba.png)





