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.

CC2642R: After certain interrupts,device stop working

Part Number: CC2642R

Hi,

I am working on cc2652R1 launchpad with SDK v5.10.

I am using simple peripheral onchip OAD example and have modified it as per requirement. I have configured 2 buttons on launchpad as interrupt and one callback function is set for those interrupts.Interruot and call back is configured successfully. when i press buttons multiple times to generate interrupts after getting few interruptson device,it stops working(it stops advertising as well and not debugs available on console also).I am pasting my code below. please help me identify the issue.

static PIN_Handle InterruptPinHandle;
static PIN_State buttonPinState;

PIN_Config AccInterruptPinTable[] = {
// Board_PIN_BUTTON0 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE, // MOTION
CONFIG_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_POSEDGE, // IMPACT
CONFIG_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP| PIN_IRQ_POSEDGE, // DOUBLE TAP
PIN_TERMINATE };

InterruptPinHandle = PIN_open(&buttonPinState, AccInterruptPinTable);
if (!InterruptPinHandle)
{
volatile int i;
Display_printf(dispHandle, SP_ROW_SEPARATOR_1, 0, "Pin open fail\r\n");
/* Error initializing button pins */
while (1){

}

}


/* Setup callback for button pins */
if (PIN_registerIntCb(InterruptPinHandle, &AccelrometerCallbackFxn) != 0)
{
volatile int i;
Display_printf(dispHandle, SP_ROW_SEPARATOR_1, 0, "Callback register fail\r\n");
/* Error registering button callback function */
while (1){

}

}

void AccelrometerCallbackFxn(PIN_Handle handle, PIN_Id pinId)
{
Display_printf(dispHandle, 0, 0, "Accelerometer callback %d\r\n",pinId);

//#ifdef debug
// Display_printf(dispHandle, 2, 0, "key: %d",(uint16_t) key); //added 22/11/2019
//#endif
if (timerflag == 0)
{
Util_startClock(&TapAccelClock);
}
/* Debounce logic */
#ifdef CPUDELAY
CPUdelay(8000 * 50);
#endif
if (!PIN_getInputValue(pinId))
{
Display_printf(dispHandle, 0, 0, "Switch case entered\r\n");
switch (pinId)
{
case CONFIG_PIN_BTN1:
int1status++;
timerflag = true;
if(int1status == 2)
{
PIN_setInterrupt(&buttonPinState, CONFIG_PIN_BTN1 | PIN_IRQ_DIS);
}
#ifdef debug
Display_printf(dispHandle, 0, 0, "\r\nTap INT\r\n");//uncommented
#endif
break;

case CONFIG_PIN_BTN2:
PIN_setInterrupt(&buttonPinState, CONFIG_PIN_BTN2 | PIN_IRQ_DIS);
impactstatus = true;
#ifdef debug
Display_printf(dispHandle, 0, 0, "\r\nbutton1 impact\r\n");
#endif
impactoverble = true;
break;

// case CONFIG_GPIO_BTN2:
//
//// GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t),
//// &initialAdvertEnable);
// Util_startClock(&StandbysleepClock);
// Display_printf(dispHandle, 0, 0, "motion detected\r\n");
//#ifdef debug
// Display_printf(dispHandle, 0, 0, "button0");
//#endif
// break;


default:
/* Do nothing */
break;
}
}
}