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: Power Policy Management

Part Number: MSPM0G3507

Hi team,

I'm trying to implement a low power mode in our desing with the MSPM0G3507. Regarding to this, I cannot achieve waking up the MCU from a TIMG0 interrupt. Can I wake up the MCU from this IRQ in STOP or STANDBY mode? Because in page 98 from the MCU datasheet refers to PD0 IRQ as waking up source. By the way in page 1361 refers that TIMG0 is powered up by PD0.

I'm using the MSPM0G3507 EVM and this code

/*
 * Copyright (c) 2021, Texas Instruments Incorporated
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * *  Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * *  Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * *  Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "ti/driverlib/m0p/dl_core.h"
#include "ti_msp_dl_config.h"



void init_all() {
  SYSCFG_DL_init();
  NVIC_EnableIRQ(TIMER_0_INST_INT_IRQN);
  NVIC_EnableIRQ(GPIO_SW_GPIOA_INT_IRQN);
  NVIC_EnableIRQ(GPIO_SW_GPIOB_INT_IRQN);

  DL_TimerG_startCounter(TIMER_0_INST);
  DL_SYSCTL_disableSleepOnExit();
}

int main(void) {
  int j = 0;
  int k = 0;
  init_all();
  while (1) {
    j++;
    k = j;
    k--;
    // DL_SYSCTL_setPowerPolicySHUTDOWN();
    // DL_SYSCTL_setPowerPolicySTOP0();
    DL_SYSCTL_setPowerPolicySTANDBY0();
    // DL_SYSCTL_setPowerPolicyRUN0SLEEP0();

    __WFI();
    init_all();
  }
}

void GROUP1_IRQHandler(void) {
  switch (DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1)) {
  case GPIO_SW_GPIOA_INT_IIDX:
    /* If SW is high, turn the LED off */
    if (DL_GPIO_readPins(GPIO_SW_USER_SWITCH_1_PORT,
                         GPIO_SW_USER_SWITCH_1_PIN)) {
      DL_GPIO_setPins(LED_GPIO_PORT, LED_GPIO_LED_01_PIN);
    }
    /* Otherwise, turn the LED on */
    else {
      DL_GPIO_clearPins(LED_GPIO_PORT, LED_GPIO_LED_01_PIN);
    }
    break;
  case GPIO_SW_GPIOB_INT_IIDX:
    /* If SW is high, turn the LED off */
    if (DL_GPIO_readPins(GPIO_SW_USER_SWITCH_1_PORT,
                         GPIO_SW_USER_SWITCH_2_PIN)) {
      DL_GPIO_setPins(LED_GPIO_PORT, LED_GPIO_LED_01_PIN);
    }
    /* Otherwise, turn the LED on */
    else {
      DL_GPIO_clearPins(LED_GPIO_PORT, LED_GPIO_LED_01_PIN);
    }
    break;
  case GPIO_SW_CAN_RX_EM_IIDX:
    /* If SW is high, turn the LED off */
    if (DL_GPIO_readPins(GPIO_SW_USER_SWITCH_1_PORT,
                         GPIO_SW_USER_SWITCH_2_PIN)) {
      DL_GPIO_setPins(LED_GPIO_PORT, LED_GPIO_LED_01_PIN);
    }
    /* Otherwise, turn the LED on */
    else {
      DL_GPIO_clearPins(LED_GPIO_PORT, LED_GPIO_LED_01_PIN);
    }

    break;
  }
}

/**
 * STANDBY0 Clock, runs all the time at the same frequency
 */
void TIMER_0_INST_IRQHandler(void) {
  static uint32_t count = 0;

  switch (DL_TimerG_getPendingInterrupt(TIMER_0_INST)) {
  case DL_TIMERG_IIDX_ZERO:
    count++;
    if (count > 2) {
      DL_GPIO_togglePins(LED_GPIO_2_PORT, LED_GPIO_2_LED_3_PIN);
      count=0;
    }
    break;
  default:
    break;
  }
}

Thanks

Nicolas

  • Hi Nicolas,

    Are you saying that the device is not waking up for the ISR / the GPIO is not toggling? TimerG0 is optionally enabled during STANDBY and STOP modes, so I would expect that it can wake up from these power modes.

    It looks like the example found in:

    [SDK Install Path]\mspm0_sdk_1_30_00_03\examples\nortos\LP_MSPM0G3507\driverlib\sysctl_power_policy_sleep_to_standby

    Demonstrates waking the device up from STANDBY0 to toggle a GPIO, and it changes the low power mode periodically. You may want to compare your code to that example to see if some difference is causing the behavior you see.

  • Hi Dylan,

    I re-wrote this code from the example that you recommended. The mistake was that the MCU was doing the initialize routine every time the sw exec the __WFI() directive. 

    Thanks!