[MSP430 Fun Talk 6] Clock Introduction and Graphical Configuration Method
I don't know if you have a feeling of stepping into the MCU now. This time, let's talk about the "heart tone" of the MCU, that is, the clock of the MCU. Why is it called the heart? That is to say, the running pace of the MCU is determined by this clock, and the code is executed step by step according to the pace of the clock. You will slowly experience the details later.
Similarly, we need to open the data sheet, still that file.
Let's see what are its clock sources?
There are five in total:
1. LFXTCLK: low-frequency crystal oscillator. The manual says that several crystal oscillators of 32768HZ can be used, and external clock source input can support 50kHz or less.
2. VLOCLK: internal low-power low-frequency crystal oscillator, usually around 10kHz
3. DCOCLK: internal digitally controllable crystal oscillator with selectable frequency
4. MODCLK: internal low-power crystal oscillator, usually around 5MHz 5.
HFXTCLK: high-frequency crystal oscillator, ranging from 4MHz to 24MHz.
The following also explains the selectable modes for the system clock, which is very detailed.
If we take a general look, we will find that there are many chapters about clocks and they are very complicated, which is indeed difficult for beginners. Here we know that for 430, there are three clocks:
1. MCLK: Main system Clock. As the name suggests, this clock determines the operating speed of the CPU. The higher the frequency configuration, the faster the CPU runs, but at the same time, the power consumption of the CPU is also greater.
2. SMCLK: Sub-Main Clock, subsystem clock, specifically provides clocks for some on-chip peripherals that require high-speed clocks, including timers and ADCs.
3. ACLK: Auxiliary Clock, auxiliary clock, the frequency of this clock will be very low and the power consumption is relatively low. It is mainly for some on-chip peripherals that only need low-frequency clocks, such as LCD controllers.
These clocks can also be output.
You may wonder, we didn't configure the clock before, but why did the microcontroller run?
We found the following paragraph in the manual:
It tells us that when the clock is not configured, the microcontroller defaults to the clock configuration. We will not care about what it means here for the time being. When we have a certain basic learning, we can return to this part for a deeper understanding.
Since the clock configuration here is relatively complicated, this is also one of the characteristics of TI's low power consumption. It can save energy loss by turning off some high-speed clocks. Faced with complex clock configuration, TI also provides us with a convenient way, that is Grace, a graphical configuration tool. Let's see how to use it.
First, open CCS and find CCS App Store under help.
Enter Grace. Click Select. (I have already installed it, so it is the Update button), then click Install.
After installation, we create a project. Here we choose the Grace project.
Get this interface. If not, you can click the main.cfg file under the project directory.
We can just follow the steps in Getting Started. Click Device Overview.
Many modules here can be configured modularly. We will not explain them in detail here. You can click them one by one to see them. The watchdog (WatchDog) is turned off by default, so you don't need to configure it yourself. Here we click Clock System to enter.
Keep clicking in.
We can see that there are many graphical options here to facilitate our configuration. Here we configure it as follows. Since the high-speed crystal oscillator on the board is not soldered, only the low-speed clock crystal oscillator is soldered, we configure it according to our actual situation.
We configure it at the highest speed, and then input the external low-speed clock. Close the main.cfg file and click Save. Next, click Compile to generate the code. Remember that saving main.cfg is very important, otherwise the following error will occur.
OK, we get the following code in the project,
Of course, this graphical configuration is not only for configuring the clock, but many other things can also be quickly configured through graphical configuration to achieve the purpose of rapid development, which is relatively convenient.
Grace_init() has been automatically added to the main function; what is this function? Let's right-click open declaration to see it. (Or hold down Ctrl on the keyboard and click on this function)
We will stop here for this time's clock configuration, which is a bit rough. Later we will use another lecture to analyze the clock configuration of 430 and the benefits of such a design.
For more content and attachment downloads, please click below Read the original text .
Welcome to watch
[Interesting Talk about MSP430] Lecture 1 of MSP430
[Interesting Talk about MSP430] Lecture 2 of MSP430
[Interesting Talk about MSP430] Lecture 3 of MSP430
[Interesting Talk about MSP430] Lecture 4 of MSP430
[Interesting Talk about MSP430] Lecture 5 of MSP430
Featured Posts