- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.