Other Parts Discussed in Thread: MSPM0G3507
大家好、
我将尝试在我们的设计中使用 MSPM0G3507实现低功耗模式。 关于这一点、我无法实现通过 TIMG0中断将 MCU 唤醒。 我可以在停止或待机模式下通过此 IRQ 唤醒 MCU 吗? 因为 MCU 数据表的第98页中提到 PD0 IRQ 作为唤醒源。 顺便说一下、第1361页提到 TIMG0由 PD0供电。
我正在使用 MSPM0G3507 EVM、这段代码
/*
* 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;
}
}
谢谢
尼古拉