3 Replies Latest reply on Aug 15, 2014 12:10 PM by ArvindS_76

    Problem with interrupt

      In SDK 2.1.0 in hello_client app I noticed that interrupt handler is called always twice on very event. Why is that ?

      Hello_sensor app from the same SDK does not have this issue.

       

      The button in hello_client is configured additionally with:

      GPIO_BOTHEDGE_INT

      and as a result the interrupt handler is called twice when the button is pressed and twice when released.

        • 1. Re: Problem with interrupt
          StBa_721356

          Do you have a pull-up or pull-down resistor connected to the GPIO pin?

          If not then you can enable an internal pull-up functionality with the GPIO_PULL_UP flag.

          Here an example:

          gpio_configurePin(SW1_INTERRUPT_PORT, SW1_INTERRUPT_PIN, GPIO_INPUT_ENABLE | GPIO_EN_INT_BOTH_EDGE | GPIO_PULL_UP, GPIO_PIN_INPUT_LOW);

          You might also need some sort of debouncing code if necessary.

          1 of 1 people found this helpful
          • 2. Re: Problem with interrupt

            I do have a pull-down resistor connected to GPIO.

            This is not a button bouncing - this is triggered always twice.

            Also hello_sensor in the same board works fine, its just hello_client is problematic.

            • 3. Re: Problem with interrupt
              ArvindS_76

              In hello_client_create(), remove calls to bleprofile_Init() and bleprofile_GPIOInit(). blecen_Create() called later invokes these. This will cause two callbacks (both pointing to the same callback function) to be registered with the GPIO driver for interrupts on the 'button' GPIO.

              1 of 1 people found this helpful