IRQ interupt causing PrefetchAbort exception

bones23 wrote on Thursday, December 20, 2007:

I am working on a str912 arm9. I have been fiddling with the joystick interrupt and have found that it randomly causes the PrefetchAbort exception to throw. Has anybody noticed this problem? I have tried setting a breakpoint right at the end of the IRQ handler and stepping through the program but the exception never occurs when i do this. My code is below.

//code for setting up the interrupt
static void prvSetupInterupts( void ){
  WIU_InitTypeDef WIU_InitStructure;
  GPIO_InitTypeDef GPIO_InitStructure;
 
  SCU_APBPeriphClockConfig(__GPIO7, ENABLE);
  /*KEY_INT on eval, unused on ADX*/
  SCU_APBPeriphClockConfig(__WIU, ENABLE);
  WIU_DeInit();
 
  GPIO_DeInit(GPIO7);
  GPIO_StructInit(&GPIO_InitStructure);
  GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
  GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Disable;
  GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;
  GPIO_Init (GPIO7, &GPIO_InitStructure);

  /*V_INIT*/
  //GPIO_DeInit(GPIO7);
  GPIO_StructInit(&GPIO_InitStructure);
  GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
  GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Disable;
  GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;
  GPIO_Init (GPIO7, &GPIO_InitStructure);
 
  /* Enable the WIU & Clear the WIU line 28 pending bit */
  WIU_Cmd(ENABLE);
  WIU_ClearITPendingBit(WIU_Line28);
 
  WIU_InitStructure.WIU_Line = WIU_Line28 ;
  WIU_InitStructure.WIU_TriggerEdge = WIU_FallingEdge ;
  WIU_Init(&WIU_InitStructure);
 
  /* Select WIU line 28 as VIC1.13 interrupt source */
  SCU_WakeUpLineConfig(28);
  
  //VIC_DeInit();
  /* Configure the External interrupt group 3 priority */
  VIC_Config(EXTIT3_ITLine, VIC_IRQ, 11);
  /* Enable the External interrupt group 3 */
  VIC_ITCmd(EXTIT3_ITLine, ENABLE);
  //VIC_SWITCmd(EXTIT3_ITLine, ENABLE);
}

//irq handler
void EXTIT3_IRQHandler(void)
{
  int i;
  portDISABLE_INTERRUPTS();
  {
    WIU_ClearITPendingBit(WIU_Line28);
    vParTestToggleLED( 3 );
  }
  portENABLE_INTERRUPTS();
}

davedoors wrote on Thursday, December 20, 2007:

Best not to disable and enable interrupts in the ISR, it should not be needed. Also ensure that vParTestToggleLED() does not enter and exit critical sections, you could test the ISR by just toggling the LED directly without using a function call.

bones23 wrote on Thursday, December 20, 2007:

Your right, the vParTestToggleLED() was entering a critical section. Thanks for the help.