9 Replies Latest reply on Sep 1, 2017 5:33 AM by axel.lin_1746341

    Interrupt based Button doesn't work with CYW943907AEVAL1F board

    naman.trivedi_2654081

      Hi,

       

      I am using CYW943907AEVAL1F development board. I am using GPIO buttons 1 and 2 in interrupt mode. I am facing an issue that when I press the button, the registered handler is not called and the application gets crashed. However, the polling mode is wotking fine, so there is no problem with the hardware I guess. Can you please let me know what I am missing?

       

      Below is my application code. Whenever I press Button 2, the application crashes.

       

      #include "wiced.h"

       

      wiced_semaphore_t semaphore;

       

      void _SwitchHandler(void* arg) {

          if (wiced_rtos_set_semaphore(&semaphore) != WICED_SUCCESS) {

              return;

          }

      }

       

      void application_start( )

      {

          /* Initialise the WICED device */

          wiced_init();

       

          if (wiced_rtos_init_semaphore(&semaphore) != WICED_SUCCESS)

          {

              return;

          }

       

          wiced_gpio_init(WICED_BUTTON2, INPUT_PULL_UP);

          if (WICED_SUCCESS != wiced_gpio_input_irq_enable(WICED_BUTTON2, IRQ_TRIGGER_RISING_EDGE,

                  _SwitchHandler, NULL)) {

              WPRINT_APP_INFO(("Failed to register handler\n"));

              return;

          }

       

          while (wiced_rtos_get_semaphore(semaphore, 100) != WICED_SUCCESS) {

              wiced_rtos_delay_milliseconds(100);

          }

          WPRINT_APP_INFO(("Button pressed.\n"));

      }