В микроконтроллерах с ядром MSP430 есть уникальная возможность по управлению питанием и частотой самого ядра и периферии.

Microcontrollers with the MSP430 core have a unique ability to manage power control and frequency of the core and the peripheral.

Сначала рассмотрим как же можно управлять питанием. За эту функцию отвечает узел «low-power module» (LPM). Этот модуль имеет восемь режимов работы. В режимах работы этого узла учитываются три основных потребности:

  • — Сверхнизкая мощность;
  • — Скорость и пропускная способность;
  • — Минимизация индивидуального периферийного потребления.

First, let’s look at how can manage power control. The «low-power module» node is responsible for this function (LPM). This module has eight modes of operation. In the modes of operation of this node, three basic needs are taken into account:

  • Ultra-low power;
  • Speed and bandwidth;
  • Minimization of individual peripheral power.

Все управление питанием происходит сбросом или установкой бит CPUOFF, OSCOFF, SCG0 и SCG1 в регистре SR. Преимущество такого управления питанием в том, что текущий режим работы сохраняется в стеке при возникновении прерывания. По окончанию прерывания основная программа возвращается в заданный режим питания. Обработчик прерывания так же может изменить режим питания при выходе манипулируя сохраненным в стеке значением регистра SR.

All power management is done by resetting or setting the CPUOFF, OSCOFF, SCG0, and SCG1 bits in the SR register. Keeping the current operating mode on the stack when an interrupt occurs is an advantage of such power control management.  At the end of the interrupt, the main program returns to the specified power mode. The interrupt handler can also change the power mode on exit by manipulating the value of the SR register stored in the stack.

При изменении любого бита регистра SR, выбранный режим вступает в силу немедленно.

When any bit of the SR register changes, the selected mode takes effect immediately.

С правилами перехода из одного режима питания в другой можно познакомиться в документе «CC430 Family User’s Guide (Rev. E)» глава 1.4 по адресу 

https://www.ti.com/lit/ug/slau259e/slau259e.pdf

The rules for switching from one power control mode to another can be found in the document «CC430 Family User’s Guide (Rev. E)» chapter 1.4 at link 

https://www.ti.com/lit/ug/slau259e/slau259e.pdf

На иллюстрации показаны основные режимы работы узла LPM.

The picture shows the main modes of operation of the LPM node.

Теперь рассмотрим возможность управления частотой.

Now let’s consider the possibility of the frequency control.

У ядра MSP430 существуют три источника тактовой частоты MCLK (Master Clock), SMCLK (Sub-Master Clock) и ACLK (Auxiliary Clock). Любой из этих источников может быть подключен к каждой периферии микроконтроллера независимо друг от друга. За формированием частот на этих источниках отвечают блоки FLL (Frequency Locked Loop) и DCO (Digitally Controlled Oscillator). Кроме того, DCO может использовать в качестве опорной частоты внутренний генератор 10 кГц VLO (Very-Low-Power Low-Frequency Oscillator), внутренний генератор 32768 Гц REFO (Trimmed Low-Frequency Reference Oscillator), и внешние кристаллы на 32768Гц и 26 МГц.

The MSP430 core has three clock sources MCLK (Master Clock), SMCLK (Sub-Master Clock) and ACLK (Auxiliary Clock). Any of these sources can be connected to each peripheral of the microcontroller independently of each other. The FLL (Frequency Locked Loop) and DCO (Digitally Controlled Oscillator) blocks are responsible for shaping the frequencies on these sources. In addition, DCO as the reference frequency can use an internal 10 kHz VLO oscillator (Very-Low-Power Low-Frequency Oscillator), an internal 32768 Hz REFO oscillator(Trimmed Low-Frequency Reference Oscillator), and external crystals at 32768 Hz and 26 MHz .

Комбинация настроек этих блоков поможет реализовать очень гибкую и сбалансированную систему.

The combination of the settings of these blocks helps to implement a very flexible and balanced system.

Все узлы формирования тактовых частот объединяются в систему UCS (Unified Clock System) с которой вы можете познакомиться в документе «CC430 Family User’s Guide (Rev. E)» глава 3 по адресу https://www.ti.com/lit/ug/slau259e/slau259e.pdf

All nodes of the formation of clock frequencies are combined into the UCS system (Unified Clock System), which you can get acquainted with in the document «CC430 Family User’s Guide (Rev. E)» chapter 3 at link https://www.ti.com/lit/ug/slau259e/slau259e.pdf

На платах разработчика семейства TiTAN установлен микроконтроллер СС430А5137 на основе ядра MSP430. Согласно документации на него максимальная частота составляет 20 МГц. Так ли это?

On the development boards of the TiTAN family installed the CC430A5137 microcontroller based on the MSP430 core. According to the documentation for it, the maximum frequency is 20 MHz. Is it so?

Давайте проведем эксперимент по разгону микроконтроллера до максимально возможной частоты.

Let’s conduct an experiment to overclock the microcontroller to the maximum possible frequency.

Напишем вот такую программу.

Let’s write this program.

Подключим плату TiTAN к осциллографу. На порт P1.1 мы будем выводить ACLK (красная линия), а на порт P1.4 мы будем выводить MCKL (желтая линия).

Let’s connect the TiTAN board to the oscilloscope. On the port P1.1 we output ACLK (red line), and on the port P1.4 we output MCKL (yellow line).

В теле программы мы будем поочередно выдавать «0» и «1» на порте P2.0. Это подтвердит факт работы микроконтроллера и его основной программы.

In the body of the program, we will alternatively display «0» and «1» on port P2.0. This will confirm that the microcontroller and its main program are working.

Для полноценной работы выберем режим LPM3.

For full-fledged work, let’s select the LPM3 mode.

Вот что у нас получилось.

Here’s what we got.

Период ACLK составляет ~720 nS – это около 1,39 МГц

ACLK period is ~ 720 nS — that’s about 1.39 MHz

Так как ACLK = MCLK/32, то вероятно MCLK=44.76 МГц ? Wow!

Since ACLK = MCLK / 32, then probably MCLK = 44.76 MHz? Wow!

Так ли это? Подключим MCLK к частотомеру.

Is it so? Let’s connect MCLK to a frequency counter.

C:\Users\Valery\Downloads\20210303_161853.jpg

Осталось проверить работает ли при этом само ядро MSP430.

It remains to check whether the MSP430 core itself is working.

Подключим к осциллографу. На порт P0.0 мы будем выводить импульсы из программы (красная линия), а на порт P1.1 мы будем выводить MCKL (желтая линия).

Let’s connect to the oscilloscope. On port P0.0 we will output pulses from the program (red line), and on port P1.1 we will output MCKL (yellow line).

Wow! Работает!

Wow! Working!

Мы видим, что установка порта в «1» составляет 4 такта MCLK, а сброс в «0» и повтор цикла — 7 тактов MCLK.

We can see that setting the port to «1» is 4 MCLK clock cycles and reset to «0» and repeat cycle is 7 MCLK clock cycles.

Отсюда делаем вывод – ядро MSP430 очень легко можно разогнать практически в 2 раза.

Hence, we conclude that the MSP430 core can be very easily overclocked by almost 2 times.

Данный трюк поможет разработчикам освоить новые приемы программирования на платах TiTAN.

This trick will help developers master new programming techniques on TiTAN boards.