TI中文支持网
TI专业的中文技术问题搜集分享网站

关于外部中断唤醒PM3遇到的一个问题

在调试时,发现当CC2530进入PM3模式后,任何一个GPIO口的中断都能将芯片唤醒,即使所有GPIO口配置成上拉、三态都能将芯片唤醒。但我的实际需求是,只有某个特定的GPIO(P0_7)有下降沿的时候才将芯片从PM3中唤醒,而其他GPIO口出现下降沿无法唤醒芯片,请问这个需求怎么实现?

Viki Shi:

disable其他GPIO口的中断使能位

user5281211:

回复 Viki Shi:

恩恩,但是一个组内的GPIO口还是无法通过disable中断使能位区别开啊

YiKai Chen:

回复 user5281211:

試試下面從cc254x抓出來pm3的測試程式

/***********************************************************************************
* CONSTANTS
*/
// Wait time in Active mode.
#define ACT_MODE_TIME50000

/***********************************************************************************
* LOCAL VARIABLES
*/
// Variable for active mode duration.
static uint32 __xdata activeModeCnt = 0;

/***********************************************************************************
* LOCAL FUNCTIONS
*/

/***********************************************************************************
* @fnsetup_port_interrupt
*
* @briefFunction which sets up the Port 0 Interrupt for Power Mode 3 usage.
*
* @paramvoid
*
* @returnvoid
*/
void setup_port_interrupt(void)
{// Clear Port 0 Interrupt flags.P0IF = 0;P0IFG = 0x00;
// Interrupt enable on all pins on port 0.P0IEN = 0xFF;
// Enable CPU Interrupt for Port 0 (IEN1.P0IE = 1).P0IE = 1;
// Enable Global Interrupt by setting the (IEN0.EA = 1).EA = 1;
}

/***********************************************************************************
* @fnport0_isr
*
* @briefPort 0 Interrupt Service Routine, which executes when SRF05EB S1
*(P0_1) is pressed.
*
* @paramvoid
*
* @returnvoid
*/
#pragma vector = P0INT_VECTOR
__interrupt void port0_isr(void)
{// Note that the order in which the following flags are cleared is important.
// Clear Port 0 Interrupt Flags.P0IFG = 0x00;
// Clear CPU Interrupt Flag for P0 (IRCON.P0IF = 0).P0IF = 0;
// Set LED1 to indicate Active Mode.P1_0 = 1;
}

/***********************************************************************************
* @fnmain
*
* @briefEnter Power Mode, exit Power Mode 3 using Port 0 Interrupt.
*
* @paramnone
*
* @return0
*/

void main(void)
{/**************************************************************************** Setup I/O*/// Initialize P1_0 for SRF05EB LED1.P1SEL &= ~BIT0;// Function as General Purpose I/O.P1_0 = 1;// LED1 on.P1DIR |= BIT0;// Output.
// Initialize P0_1 for SRF05EB S1 button.P0SEL &= ~BIT1;// Function as General Purpose I/O.P0DIR &= ~BIT1;// Input.P0INP |= BIT1;// 3-state input.

/**************************************************************************** Setup interrupt** Setup and enable Port 0 Interrupt, which shall wake-up the SoC from* Power Mode 3.*/setup_port_interrupt();/************************************************************************ Setup powermode*/// Set [SLEEPCMD.MODE] to PM3.SLEEPCMD = (SLEEPCMD & ~SLEEPCMD_MODE) | SLEEPCMD_MODE_PM3;

/* Main Loop, enter/exit Power Mode 3. */while(1){// Wait some time in Active Mode, and clear LED1 before// entering Power Mode 3.for(activeModeCnt = 0; activeModeCnt < ACT_MODE_TIME; activeModeCnt++);P1_0 = 0;// Enter powermode// Sets PCON.IDLE with a 2-byte boundary assembly instruction.// NOTE: Cache must be enabled (see CM in FCTL).// This method gives the least current consumption.EnterSleepModeProcessInterruptsOnWakeup();}
}

赞(0)
未经允许不得转载:TI中文支持网 » 关于外部中断唤醒PM3遇到的一个问题
分享到: 更多 (0)