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.

MSPM0G3507: 4MHz clock swith to 32MHz

Part Number: MSPM0G3507
Other Parts Discussed in Thread: LP-MSPM0L1306,

I have problem with the main clock when I am running on 4MHz internall system oscillator and using Timer. It switch to 32 MHz, when timer interrupt is enabled. Bellow is complete description how I uncover the problem. Code below was tested with optimization level 0, ccs1250, mspm0_sdk_1_20_00_05, LP-MSPM0G3507, LP-MSPM0L1306. Behaviour of both development kits were identical. I haven't found how to continue with the 4 MHz clock.

I found this problem described in Errata - SYSOSC_ERR_01. The workaround doesn't help. I tested many Low Power Policy including STOP0 mode and SYSOSC FCL (SYSCFG > SYSOSC (Internal System Oscillator) > Enable Frequency Correction Loop) is disabled.


LP-MSPM0G3507:
Here is complete description where the problem occur. On empty project I made some changes.

SYSCFG:
- SYSCTL:
- Main Clock Divider = 4
- SYSOSC Frequency (Internall System Oscillator) = 4MHz

- Add SYSTICK:
- Initialize Period = true
- Period = 1000
- Enable SysTick Interrupt = true
- Enable SysTick And Start Counting = true

- Add GPIO:
- Group Name = GPIO_GRP_0
- Pin Name = PIN_0
- Assigned Port = PORTB
- Assigned Pin = 0


Main code:

#include "ti_msp_dl_config.h"

int main(void)
{
    SYSCFG_DL_init();
    
    while (1) {
        __WFI();
    }
}

void SysTick_Handler(void)
{
    DL_GPIO_togglePins(GPIO_GRP_0_PORT, GPIO_GRP_0_PIN_0_PIN);  
}


Now the pin A0 toggle at pretiod 1ms. Then I add timer.

SYSCFG:
- Name = TIMER_0
- Desired Timer Period = 1 ms
- Start Timer = true
- Interrupts Configuration (Enable Interrupts) = Zero event

Added in the code:

void TIMG0_IRQHandler(void) { }

And now pin A0 toggle at pretiod 1/8 ms. The probles is in the function DL_TimerG_enableInterrupt(TIMER_0_INST , DL_TIMERG_INTERRUPT_ZERO_EVENT) in SYSCFG_DL_TIMER_0_init(), because it changes register SYSCTL_CLKSTATUS > SYSOSCFREQ from 01 - SYSOSC4M to 00 - SYSOSC32M.

LP-MSPM0L1306:
Identical result as abowe. On empty project I made some changes.

SYSCFG:
- SYSCTL:
- Main Clock Divider = 4
- SYSOSC Frequency (Internall System Oscillator) = 4MHz

- Add SYSTICK:
- Initialize Period = true
- Period = 1000
- Enable SysTick Interrupt = true
- Enable SysTick And Start Counting = true

- Add GPIO:
- Group Name = GPIO_GRP_0
- Pin Name = PIN_0
- Assigned Port = PORTA
- Assigned Pin = 0


Main code:

#include "ti_msp_dl_config.h"

int main(void)
{
    SYSCFG_DL_init();
    
    while (1) {
        __WFI();
    }
}

void SysTick_Handler(void)
{
    DL_GPIO_togglePins(GPIO_GRP_0_PORT, GPIO_GRP_0_PIN_0_PIN);  
}

Now the pin A0 toggle at pretiod 1ms. Then I add timer.

SYSCFG:
- Name = TIMER_0
- Desired Timer Period = 1 ms
- Start Timer = true
- Interrupts Configuration (Enable Interrupts) = Zero event

Added in the code:

void TIMG0_IRQHandler(void) { }

And now pin A0 toggle at pretiod 1/8 ms. The probles is in the function DL_TimerG_enableInterrupt(TIMER_0_INST , DL_TIMERG_INTERRUPT_ZERO_EVENT) in SYSCFG_DL_TIMER_0_init(), because it changes register SYSCTL_CLKSTATUS > SYSOSCFREQ from 01 - SYSOSC4M to 00 - SYSOSC32M.

  • Hi Milan,

    Welcome to the E2E forums. 

    And now pin A0 toggle at pretiod 1/8 ms. The probles is in the function DL_TimerG_enableInterrupt(TIMER_0_INST , DL_TIMERG_INTERRUPT_ZERO_EVENT) in SYSCFG_DL_TIMER_0_init(), because it changes register SYSCTL_CLKSTATUS > SYSOSCFREQ from 01 - SYSOSC4M to 00 - SYSOSC32M

    I don't think it should be doing this, as the DL_TimerG_enableInterrupt function should just touch the IMASK register. See below source for this function (the TimerG and TimerA versions of these functions redirect to this shared one from dl_timer.h).

    How are you observing this bit is changing? Are you watching it in the debugger or reading it back in your code? 

    I think this might be due to an AsynchronousFastClock request from these interrupts. Can you try adding a call to DL_SYSCTL_blockAllAsyncFastClockRequests before the call to SYSCFG_DL_init() in your main code? 

    Best Regards,
    Brandon Fisher

  • Thanks for answer. Adding DL_SYSCTL_blockAllAsyncFastClockRequests() before SYSCFG_DL_init() solves the problem.

    Note:
    I reads registers from Registers window in CCS while steping into/over c functions. To confirm that I write register content into array before and after change. Clock changed at "gptimer->CPU_INT.IMASK |= interruptMask;". I got same result when 3s delay was included between SYSCFG_DL_init() and DL_TimerA_enableInterrupt(TIMER_0_INST , DL_TIMERA_INTERRUPT_ZERO_EVENT); - DL_TimerA_enableInterrupt was remove from SYSCFG and added in the code after 3x delay_cycles(1000000).