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.

Proper Interrupt Settings

Other Parts Discussed in Thread: CC2430, CC2530

I have problems with my interrupt. They don't seem to work properly and I would like to know what's wrong with my settings. Can anybody help me please:

I'm using the ports P0_1 and P0_2 on teh SoC_BB (Battery Board) with the CC2430:

 

hal_key.c

 

#define HAL_KEY_SW_6_ENABLE

  #define HAL_KEY_SW_6_PORT     P0                      // Port location of SW1

  #define HAL_KEY_SW_6_BIT      HAL_KEY_BIT1            // Bit location of SW1

  #define HAL_KEY_SW_6_SEL      P0SEL                   // Port Select Register for SW1

  #define HAL_KEY_SW_6_DIR      P0DIR                   // Port Direction Register for SW1

  #define HAL_KEY_SW_6_IEN      IEN1                    // Interrupt Enable Register for SW1

  #define HAL_KEY_SW_6_IENBIT   HAL_KEY_BIT5            // Interrupt Enable bit for SW1

  #define HAL_KEY_SW_6_EDGE     HAL_KEY_RISING_EDGE     // Type of interrupt for SW1

  #define HAL_KEY_SW_6_EDGEBIT  HAL_KEY_BIT0            // EdgeType enable bit SW1

  #define HAL_KEY_SW_6_ICTL     PICTL                   // Port Interrupt Control for SW1

  #define HAL_KEY_SW_6_ICTLBIT  HAL_KEY_BIT3            // Interrupt enable bit for SW1

  #define HAL_KEY_SW_6_PXIFG    P0IFG                   // Port Interrupt Flag for SW1

 

  #define HAL_KEY_SW_9_ENABLE

  #define HAL_KEY_SW_9_PORT     P0                      // Port location of Counter Setting

  #define HAL_KEY_SW_9_BIT      HAL_KEY_BIT2            // Bit location of Counter Setting

  #define HAL_KEY_SW_9_SEL      P0SEL                   // Port Select Register for Counter Setting

  #define HAL_KEY_SW_9_DIR      P0DIR                   // Port Direction Register for Counter Setting

  #define HAL_KEY_SW_9_IEN      IEN1                    // Interrupt Enable Register for Counter Setting

  #define HAL_KEY_SW_9_IENBIT   HAL_KEY_BIT5            // Interrupt Enable bit for Counter Setting

  #define HAL_KEY_SW_9_EDGE     HAL_KEY_RISING_EDGE     // Type of interrupt for Counter Setting

  #define HAL_KEY_SW_9_EDGEBIT  HAL_KEY_BIT0            // EdgeType enable bit Counter Setting

  #define HAL_KEY_SW_9_ICTL     PICTL                   // Port Interrupt Control for Counter Setting

  #define HAL_KEY_SW_9_ICTLBIT  HAL_KEY_BIT3            // Interrupt enable bit for Counter Setting

  #define HAL_KEY_SW_9_PXIFG    P0IFG                   // Port Interrupt Flag for Counter Setting

 

  // P0 can only be enabled/disabled as group of high or low nibble

  #define HAL_KEY_P0INT_LOW_USED    (HAL_KEY_SW_6_BIT | HAL_KEY_SW_9_BIT )

  #define HAL_KEY_POINT_HIGH_USED   0

 

...

 

HAL_ISR_FUNCTION( halKeyPort0Isr, P0INT_VECTOR )

{

  /* P0IF is cleared by HW for CHVER < REV_E */

 

  halProcessKeyInterrupt();

 

  if( CHVER >= REV_E )

  {

    P0IFG = (HAL_KEY_P0INT_LOW_USED | HAL_KEY_POINT_HIGH_USED );

    P0IF = 0;

    CLEAR_SLEEP_MODE();

  }

}

 

OnBoard.c

void InitBoard( byte level )

{...

     OnboardKeyIntEnable = HAL_KEY_INTERRUPT_ENABLE;

     HalKeyConfig( OnboardKeyIntEnable, OnBoard_KeyCallback);

...}

 

hal_board.cfg

/* S1 */

#define PUSH1_BV          BV(1)

#define PUSH1_SBIT        P0_1

#define PUSH1_POLARITY    ACTIVE_LOW

 

/* S9 */

#define PUSH9_BV          BV(2)

#define PUSH9_SBIT        P0_2

#define PUSH9_POLARITY    ACTIVE_LOW

 

#define HAL_BOARD_INIT()                          \

{                                                 \

  /* set direction for GPIO outputs  */           \

  LED1_DDR |= LED1_BV;                            \

                                                  \

  /* configure tristates */                       \

  P0INP |= PUSH1_BV;                              \

}

/* ----------- Push Buttons ---------- */

#define HAL_PUSH_BUTTON1()        (PUSH1_POLARITY (PUSH1_SBIT))

#define HAL_PUSH_BUTTON9()        (PUSH9_POLARITY (PUSH1_SBIT))

 

THANKS FOR ANY HELP. IT'S REALLY APPRECIATED!