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.

httpserver doesn't sense interrupt

Hi everyone,

I'm trying to build a system that receive command from webserver.

It's composed from a lamp, that can be configured as Dimmer or as simple lamp.

I'm using the httpserver example to build this system.

I have a pin that makes the entrance of the zero crossing when the power at 50 HZ crosses zero.
I set an interruption on the rising edge of this pin. When I get something through a post on the webserver, it is no longer triggered the interrupt pin on the zero crossing. What might be?

  • Hi,

    Post the part of your code where you setup interrupts. Did you register your interrupt handler using Interrupt Register API's?

    - kel
  • void Button_IF_Init(P_INT_HANDLER S2InterruptHdl,P_INT_HANDLER S3InterruptHdl )
    {
        if(S3InterruptHdl != NULL)
        {
            //
            // Set Interrupt Type for GPIO
            //
          
        	MAP_GPIOIntTypeSet(GPIOA1_BASE,GPIO_PIN_5,GPIO_RISING_EDGE);
        	
            g_S3InterruptHdl = S3InterruptHdl;
    
            //
            // Register Interrupt handler
            //
    #if defined(USE_TIRTOS) || defined(USE_FREERTOS) || defined(SL_PLATFORM_MULTI_THREADED)
        // USE_TIRTOS: if app uses TI-RTOS (either networking/non-networking)
        // USE_FREERTOS: if app uses Free-RTOS (either networking/non-networking)
        // SL_PLATFORM_MULTI_THREADED: if app uses any OS + networking(simplelink)
            osi_InterruptRegister(INT_GPIOA1,(P_OSI_INTR_ENTRY)GPIOs3IntHandler, \
                                    INT_PRIORITY_LVL_1);
    #else
    		MAP_IntPrioritySet(INT_GPIOA1, INT_PRIORITY_LVL_1);
            MAP_GPIOIntRegister(GPIOA1_BASE, GPIOs3IntHandler);
    #endif
            //
            // Enable Interrupt
            //
            MAP_GPIOIntClear(GPIOA1_BASE,GPIO_PIN_5);
            MAP_GPIOIntEnable(GPIOA1_BASE,GPIO_INT_PIN_5);
        }
    
        if(S2InterruptHdl != NULL)
        {
            //
            // Set Interrupt Type for GPIO
            //
            MAP_GPIOIntTypeSet(GPIOA3_BASE,GPIO_PIN_2,GPIO_FALLING_EDGE);
            MAP_GPIOIntTypeSet(GPIOA3_BASE,GPIO_PIN_3,GPIO_FALLING_EDGE);
        	
    
    
            g_S2InterruptHdl = S2InterruptHdl;
    
            //
            // Register Interrupt handler
            //
    #if defined(USE_TIRTOS) || defined(USE_FREERTOS) || defined(SL_PLATFORM_MULTI_THREADED)
        // USE_TIRTOS: if app uses TI-RTOS (either networking/non-networking)
        // USE_FREERTOS: if app uses Free-RTOS (either networking/non-networking)
        // SL_PLATFORM_MULTI_THREADED: if app uses any OS + networking(simplelink)
            osi_InterruptRegister(INT_GPIOA3,(P_OSI_INTR_ENTRY)GPIOs2IntHandler, \
                                    INT_PRIORITY_LVL_1);
    #else
    		MAP_IntPrioritySet(INT_GPIOA3, INT_PRIORITY_LVL_1);
            MAP_GPIOIntRegister(GPIOA3_BASE, GPIOs2IntHandler);
    #endif
    
            //
            // Enable Interrupt
            //
            MAP_GPIOIntClear(GPIOA3_BASE,GPIO_PIN_2);
            MAP_GPIOIntClear(GPIOA3_BASE,GPIO_PIN_3);
            MAP_GPIOIntEnable(GPIOA3_BASE,GPIO_INT_PIN_2);
            MAP_GPIOIntEnable(GPIOA3_BASE,GPIO_INT_PIN_3);
    
        }
    }

    I use a function used in the email example (the zero crossing pin is associated to S3InterruptHdl handler)

    I call this function only when my program initialize, after webserver starts

  • I've solved writing a thread always in execution,
    that pend on a semaphore (initialized to 0). When there is a webserver event, it post on the same semaphore of this function that disable all interrupts, disable all timers, turn off the gpio, wait for less than half second and enable again the interrupt on the pin. The only problem now is that when the interrupt is enabled, his handler start on falling edge, but I need to catch the rising edge. Can anyone suggest me a solution for this problem?
    Thanks in advance.
  • Hi,

    Change, GPIO_FALLING_EDGE to GPIO_RISING_EDGE at Button_IF_Init().

    - kel
  • Hi,
    I must handle two different interrupts, one on falling edge and another one on rising edge.
    I handle the interrupt on the pin 5 on rising edge
    MAP_GPIOIntTypeSet(GPIOA1_BASE,GPIO_PIN_5,GPIO_RISING_EDGE);
    but I get interrupt on both edge

  • Thanks Kel for the response.

    Aeromechs,
    Did it help? Let me know if you need additional information.

    -/Praneet
  • Hi,
    I want to know if this behaviour is normal... I think this is a problem of interrupt mask, so when there is a httpevent the interrupt on my GPIO is masked. There is a way to set an interrupt unmaskable?