Working on MSP432 - Part 8 (Output SYSCLK on a GPIO pin)

Working on MSP432 - Part 8 (Output SYSCLK on a GPIO pin)


One of the important design requirements in micro controller based designs is the clock selection. Micro controllers available in the market have a different clock system internally and the programmer has to understand the register settings to use the required clock in their systems. In MSP432, below is the clock system.


We can understand that there are several clock input options for MSP432:
  • LFX - External RTC Clock (32.768 KHz)
  • HFX - External High Frequency Clock (1 MHz to 48 MHz)
  • DCO - Internal Digitally Controlled Oscillator (3 MHz and is configurable)
  • VLO - Internal Very-Low-Power Low-Frequency Oscillator (9.4 KHz)
  • REFO - Internal Low-Power Low-Frequency Oscillator (32.768 KHz or 128 KHz)
  • MODOSC - Internal Low Power Module Oscillator (25 MHz)
  • SYSOSC - Internal System Oscillator (5 MHz)
Get more details of the clock system of MSP432 from below link:


Looking at the clock options, we are definitely having lot of options and all the clocks used for operation (for peripherals as well) inside the micro controller are derived from these clocks. As there are several dividers and clock bits inside the micro controller to derive respective peripheral clocks, designer wanted to know the actual clock generated inside the controller. For this, there are several pins of controller dedicated. Below snapshot shows some of the MSP432 pins dedicated for this purpose.


Follow the below steps, to output the external clock frequency on a particular GPIO pin. External High Frequency clock is internally configured to a SMCLK.
  • Configuring the SMCLK to output on the P7 port, 1st pin

P7->DIR=0xFF;                 //Setting the direction of P7 port to output
P7->OUT=0x00;                 //Setting the output of P7 port to LOW by default
P7->SEL1 = 0x00;             // Configuring the first pin of the P7 as per above table
P7->SEL0 |= 0x01;            // Configuring the first pin of the P7 as per above table

  • Select the pin of the controller to high frequency clock input

PJ->SEL0|= 0x000C          //Selecting the PJ.2, PJ.3 functionality to clock
  • Enabling the SMCLK and configuring the High Frequency clock to SMCLK

CS->CTL1 |= 0x00000050;    //Configuring SMCLK to HFXTCLK
CS->CTL2 |= 0x01610000;    //HFXT is on if HFXT is selected via the port selection and HFXT is not in bypass mode of operation, HFXT is in the range >40 MHz to 48 MHz

Once the above settings are done in your program, you must see the external clock crystal frequency on the configured clock output pin.

Post a Comment

0 Comments