AnsweredAssumed Answered

Software interrupt doesn't work - please help

Question asked by ofri.igal on Sep 9, 2013
Latest reply on Oct 16, 2013 by oliver
Hi,

I try to set a software interrupt.

I set it as follows:
#define HZ500_EXT_INT_LINE                                EXTI_Line1
#define HZ500_EXT_INT_IRQ                                    EXTI1_IRQn
#define HZ500_EXT_INT_PREEMPTION                    1
#define HZ500_EXT_INT_SUB                                    2

void init_500hz_event_interrupt(void)
{
  EXTI_InitTypeDef   EXTI_InitStructure;
  NVIC_InitTypeDef   NVIC_InitStructure;
    
  /* Enable SYSCFG clock */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
 
  /* Configure EXTI Line1 */
  EXTI_InitStructure.EXTI_Line = HZ500_EXT_INT_LINE;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Event;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure);
    
  /* Enable and set EXTI1 Interrupt */
  NVIC_InitStructure.NVIC_IRQChannel = HZ500_EXT_INT_IRQ;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = HZ500_EXT_INT_PREEMPTION;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = HZ500_EXT_INT_SUB;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
    
  NVIC_Init(&NVIC_InitStructure);
}

I have an ISR routine that is triggered by an external interrupt and it should trigger the software interrupt, I use the following command in order to trigger the software interrupt:

EXTI_GenerateSWInterrupt(HZ500_EXT_INT_LINE);

Unfortunately the software interrupt is not trigered. Am I missing something?

The ISR for the interrupt routine is defined as follows:

#define HZ500_EXT_INT_HANDLER                                                    EXTI1_IRQHandler

void HZ500_EXT_INT_HANDLER(void)
{
    static uint8_t hz_100_creation;
    
    EXTI_ClearITPendingBit(HZ500_EXT_INT_LINE);

    TOGGLE_TP23;

    read_ppg_led_registers();

    hz_100_creation++;

    if(hz_100_creation >= HZ_100_COUNT)
    {
        hz_100_creation = 0;

#ifdef RAW_DATA_MODE
        dls_dicmation();
#else
        dls_100hz_section();
#endif /* RAW_DATA_MODE */
    }
    
}

Thank you for your help

Outcomes