This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SIMPLELINK-MSP432-SDK: Interfacing with 48 MHz external clock on the MSP432E401Y

Part Number: SIMPLELINK-MSP432-SDK
Other Parts Discussed in Thread: MSP432E401Y

Hello everyone,

I have existing software running on an MSP432P4 series device (MSP432P401R). Since the MSP432P4 series has been discontinued, I am hoping to migrate the software to an MSP432E4 series device (MSP432E401Y) until a more permanent solution can be found and the software can be redesigned from the ground up.

Because the existing software was written using the TI Drivers, my understanding is that changing from an MSP432P4 series device to an MSP432E4 series device should be reasonably straightforward (from a software perspective).

The existing software is based on the portable TI-Drivers FreeRTOS example project for the MSP432P401R (C:\ti\simplelink_msp432p4_sdk_3_40_00_05\examples\rtos\MSP_EXP432P401R\demos\portable\freertos\ccs\portable_MSP_EXP432P401R_freertos_ccs.projectspec). The migrated software would hypothetically based on the portable TI-Drivers FreeRTOS example project for the MSP432E401Y (C:\ti\simplelink_msp432e4_sdk_4_20_00_12\examples\rtos\MSP_EXP432E401Y\demos\portable\freertos\ccs\portable_MSP_EXP432E401Y_freertos_ccs.projectspec).

I have begun to investigate whether this migration is feasible, starting with pinout/peripheral compatibility.

The existing software uses roughly 24 GPIOs, 4 UART interfaces, 2 I2C interfaces, 1 SPI interface, and 6 ADC inputs. The MSP432E401Y is compatible in terms of its peripherals: there are sufficient GPIO, UART, I2C, SPI, and ADC interfaces.

I am getting stuck, however, when it comes to the use of an external 48 MHz clock source.

The existing software relies on an external, single-ended 48 MHz clock source. On the MSP432P401R, the TI-Drivers Power Module provided the option to create custom perfomance levels and configure the external clocks via the PowerMSP432_ConfigV1 struct. I can find no such option for the MSP432E401Y. My impression is that such interfacing is not easily achieved using the TI-Drivers.

To get my feet wet, I consulted the Datasheet (DTS) and technical Reference Manual (TRM) for more information.

[0.] According to [TRM: 4.1.5.1 Fundamental Clock Sources]: "The PIOSC is an on-chip clock source that the microcontroller uses during and following POR."

[1.] According to [TRM: 4.1.5.1 Fundamental Clock Sources]: "The MOSC provides a frequency-accurate clock sourced by one of two means: an external single-ended clock source is connected to the OSC0 input pin, or an external crystal is connected across the OSC0 input and OSC1 output pins. The single-ended clock source range is from DC through the specified speed of the microcontroller."

[2.] According to [DTS: Table 5-12. Main Oscillator Input Characteristics]: the minimum and maximum values for the "External clock reference (PLL in BYPASS mode)" (f_REF_XTAL_BYPASS) are 0 MHz and 120 MHz, respectively.

[3.] According to [TRM: Figure 4-5. Main Clock Tree]: the "mosc" clock signal is sourced by a multiplexer, the input of which is selected by the control signal "NOXTAL".

[4.] According to [TRM: Table 4-20. MOSCCTL Register Field Descriptions]: the PWRDN register bitfield... "provides user control over powering down the main oscillator circuit. This bit should be cleared when using a crystal and set for single-ended mode... 0x0 = Power to MOSC circuit is enabled. 0x1 = MOSC circuit is powered down."

[5.] According to [TRM: Table 4-20. MOSCCTL Register Field Descriptions]: the NOXTAL register bitfield... "provides the user control over the power drawn from the main
oscillator circuit. This bit should be set when either crystal or single-ended mode is being used. If the application needs MOSC, this bit should be cleared."

[6.] According to [TRM: Table 4-21. RSCLKCFG Register Field Descriptions]: the USEPLL register bitfield... "controls whether the clock source is specified by the OSCSRC field or the output of the PLL is provided to the system clock divider and serves as the system clock source. 0x0 = Clock source is specified by the OSCSRC field. 0x1 = Clock source is specified by the PLL."

[7.] According to [TRM: Table 4-21. RSCLKCFG Register Field Descriptions]: the OSCSRC register bitfield "specifies the oscillator source that becomes the oscillator clock (OSCCLK) source, which is used when the PLL is bypassed during run or sleep mode... 0x3 = MOSC is the oscillator source."

[8.] According to [Table 4-26. DSCLKCFG Register Field Descriptions]: the DSOSCSRC register bitfield "specifies the oscillator source that becomes the oscillator clock (OSCCLK) source, which is used when the PLL is bypassed during deep-sleep mode... 0x3 = MOSC"

Based on [1,2], it would appear that the MSP432E401Y can support an single-ended external clock reference with a frequency of 48 MHz.

Based on [0,3,4,5,6,7,8], it would appear that, ignoring the OSCCLK clock divider (which I expect is 1 by default), if I want to make SYSCLK a 48 MHz clock sourced by my single-ended external clock, I should:
[A.] Set MOSCCTL.PWRDN
[B.] Clear MOSCCTL.NOXTAL
[C.] Clear RSCLKCFG.USEPLL
[D.] Assign 0x3 to RSCLKCFG.DSOSCSRC
[E.] Assign 0x3 to RSCLKCFG.OSCSRC

Do you think this would work? If not, where might I look next for a solution?

Ultimately I can design a prototype board and test this with the actual external clock, but I'd like to exhaust all other options before doing so.

Thanks very much,


Dylan

Clock Tree, for reference:

  • The existing software uses roughly 24 GPIOs, 4 UART interfaces, 2 I2C interfaces, 1 SPI interface, and 6 ADC inputs. The MSP432E401Y is compatible in terms of its peripherals: there are sufficient GPIO, UART, I2C, SPI, and ADC interfaces.

    Please note that although there are sufficient interfaces such as UART, I2C or SPI, but the hardware may be very different. In another word, a UART from MSP432P will be different than MSP432E. These are two different devices. 

    I am getting stuck, however, when it comes to the use of an external 48 MHz clock source.

    The existing software relies on an external, single-ended 48 MHz clock source. On the MSP432P401R, the TI-Drivers Power Module provided the option to create custom perfomance levels and configure the external clocks via the PowerMSP432_ConfigV1 struct. I can find no such option for the MSP432E401Y. My impression is that such interfacing is not easily achieved using the TI-Drivers.

    I suppose you want to retain using an external single-ended 48Mhz clock for MSP432E. Is that correct?

    I will suggest you look at an example like C:\ti\simplelink_msp432e4_sdk_4_20_00_12\examples\nortos\MSP_EXP432E401Y\driverlib\hello. In this example as well as many others, you can find how the clock is typically configured using the API SysCtlClockFreqSet. See below example as to use an external 25Mhz MOSC as the source clock for the PLL to generate a final SYSCLK at 120Mhz. 


    // Run from the PLL at 120 MHz.
    //
    g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
    SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
    SYSCTL_CFG_VCO_480), 120000000);

    The API is quite complicated to take care of many conditions. You can read the source code of this API in C:\ti\simplelink_msp432e4_sdk_4_20_00_12\source\ti\devices\msp432e4\driverlib\sysctl.c. I don't expect you to fully understand it as I don't either. Having said that, the existing API does not support an external single-ended clock input source by fooling the API a bit. What you can do is to setup the clock as if you are using an external MOSC with 25Mhz but you will just leave out the OSC1 pin and connect your single-ended 48Mhz to the OSC0 pin.

      SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_OSC), 25000000);

    The poster in the below post is able to get it working with a 30.72MHz external single-ended clock.  Please follow the discussion. 

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1265145/tm4c1290ncpdt-epi-host-mode-clocking/4791729#4791729

  • Thanks very much for the prompt reply -- and the useful thread. That looks like a great starting point for me.

    Yes, I would like to retain the use of the external 48 MHz clock source as there are control algorithms that have been tested at this frequency with this particular external clock.

    I will have to take some time to go through the other poster's thread, and then I will revisit this thread.

    At a glance, and not knowing too much about the MSP432E4, I would expect that the only thing I might need to do differently than the poster would be to manually configure MEMTIM0 (MSP432E4 TRM, Section 7.2.3.1) appropriately for a 48 MHz frequency? It would seem that, because the same MEMTIM0 register settings can be used for 25 MHz and 30.72 MHz, one can get away without configuring MEMTIM0 if using a single-ended clock at 30.72 MHz.

  • Hi,

      That is a very good point. Yes, for frequency of 48Mhz, you would need to manually adjust the MEMTIM0 register for the flash wait states according to the table. You will need to also set the MEMTIMU bit in the RSCLKCFG register for the MEMTIM0 to be applied. 

  • Thanks for your help.