cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Smart Bluetooth

Anonymous
Not applicable

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.

0 Likes
Reply
1 Solution
Employee

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.

View solution in original post

3 Replies
Contributor

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.

Anonymous
Not applicable

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.

0 Likes
Reply
Employee

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.

View solution in original post