본문 바로가기
Embedded SW/[Infineon] TC275 English Version

06. Understanding MCU Clock, Oscillator (Infineon TC275)

by 방구석 임베디드 2023. 8. 26.
반응형

 

Before understanding interrupts, let's understand the meaning of clock and oscillator in MCU.

 

This article is one of the articles that serialize the overall contents of development.

So, if you look at the previous article, I think it will be more helpful.

I will link the article below. Read it if you need to.

(Of course, there is no big problem if you just read this article.)

 

00. Embedded SW development using TC275 (Prologue)
01. What is embedded SW and what is MCU (Micro Control Unit)?
02. How to purchase an embedded development board (TC275, Infineon)
03. How to set up an embedded SW development environment (what is a source code editor, compiler, and debugger environment)
04. How to create an MCU TC275 project (Infineon)

05. Digital output settings and LED blinking using TC275 (push-pull, open drain)

 

1. What does clock mean?

A clock is a square wave signal in which logic states H (high, logic 1) and L (low, logic 0) appear periodically.
These clock signals are used to synchronize digital circuits.
Let me try to explain it a little easier.
The picture below is a device called an oscillator.
This device makes a clock.

Let's find the clock on the TC275 development board.
On the development board, the green box below is the oscillator.
If you look at the contents, it says 20MHz.

So let's take a look at the circuit diagram.
In the circuit diagram, the oscillator is connected as shown below.
You can check that it is connected to XTAL1 and XTAL2.

This oscillator is connected to the MCU as shown in the circuit diagram above.
And, this oscillator provides a clock to the MCU.
If you take the oscillator once, you can see that the sine wave is coming out as shown below.
The period is 20 MHz.

The MCU discretizes this.
That is, it recognizes them as 1s and 0s.
In other words, if it exceeds a certain level, it is recognized as 1.
If it is below a certain level, it is recognized as 0.
(MCU converts analog value to digital value and recognizes it as Low and High)

Therefore, since the above frequency is 20MHz, the MCU accepts 20000000 clocks per second.
A slightly cleaner picture would look like this:

Now what you do with this clock is important.

 

2. What does the MCU do with the clock?

 

Currently, the oscillator attached to the board generates and sends 20000000 clocks per second. 

What will the MCU do with this?

 1) The CPU in the MCU performs calculation operations in synchronization with this clock.

 

Inside the MCU is the CPU.
CPU stands for Central Processing Unit.
The CPU runs the program.

When we view a picture on a computer, the CPU reads the data of the picture and performs an operation, 

putting values into the appropriate pixels on the computer monitor and displaying the picture.

 Therefore, the operation is performed through three stages of the CPU.
The three phases can be divided into fetch, decode, and execute operations.

 - fetch : Fetch an instruction from memory.
When we install Word or PPT, the program is installed.
These programs consist of sets of instructions, such as 32 bytes or 16 bytes.
The CPU reads one instruction.
It is called fetch.

- decode: Interprets the Instruction acquired from the memory and analyzes what kind of action to perform.
The instruction made up of 32 bytes contains some content.
It is a promise that the CPU will perform some operation.
The stage where the CPU interprets this can be called decode.

- excute: Executes the interpreted Instruction.
Now, calculations are performed through a device called ALU (Arithmetic Logic Unit) in the CPU.
Store the result in a register or memory.

 

You can think that 1) -> 2) > 3) actions are performed according to the arrow mark above, and one line of code is executed.
(Details such as pipeline and assembly code are omitted first.)

 If the clock speed increases as shown below, the speed of fetching, interpreting, and operating instructions will increase.

Therefore, securing the maximum cpu clock speed is directly related to performance in MCUs.

 
2) Give a clock to the peripherals that exist in the MCU so that the peripherals can perform operations.
MCU contains various peripherals.
For example, in the case of the Timer module, a clock is received and counted, and various events (eg periodic interrupt) can be created at the desired time (ex 1ms).

In the end, the clock can be said to be the food line that operates the CPU and peripherals in the MCU.
 However, there are times when the CPU is not enough to perform calculations according to the clock speed of 20 MHz.
Usually, 32-bit high-end MCUs are designed to use CPU clocks from 200MHz to 300MHz.
However, the clock generated by the oscillator is only 20 MHz.
How can I increase 20MHz to 200MHz?
The frequency of the clock can be increased through a module called PLL (Phase-Locked Loop).
Therefore, when using an MCU, the clock of the external oscillator is not used as it is, but it is used by increasing the maximum frequency output allowed by the CPU.

The CPU of TC275 can use clock frequency up to 200MHz.

Therefore, it is necessary to increase the frequency from 20 MHz to 200 MHz.
In the next chapter, we will design how to increase the frequency.

반응형

댓글