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.

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

Other Parts Discussed in Thread: CC2530

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

  • disable其他GPIO口的中断使能位
  • 恩恩,但是一个组内的GPIO口还是无法通过disable中断使能位区别开啊
  • 試試下面從cc254x抓出來pm3的測試程式

    /***********************************************************************************
    * CONSTANTS
    */
    // Wait time in Active mode.
    #define ACT_MODE_TIME 50000


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


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

    /***********************************************************************************
    * @fn setup_port_interrupt
    *
    * @brief Function which sets up the Port 0 Interrupt for Power Mode 3 usage.
    *
    * @param void
    *
    * @return void
    */
    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;
    }


    /***********************************************************************************
    * @fn port0_isr
    *
    * @brief Port 0 Interrupt Service Routine, which executes when SRF05EB S1
    * (P0_1) is pressed.
    *
    * @param void
    *
    * @return void
    */
    #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;
    }


    /***********************************************************************************
    * @fn main
    *
    * @brief Enter Power Mode, exit Power Mode 3 using Port 0 Interrupt.
    *
    * @param none
    *
    * @return 0
    */

    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();

    }
    }