This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Interrupt when Signal is low-to-high

I have a project, where I try to trigger an interrupt when I get a low-to-high tranistion and high-to low transition.

My setup:

-nRF51DK

-SDK8.1

-SoftDevice 8.0

#define low_to_high                25                                         
#define high_to_low                28

Both are defined as inputs, but one as PULLDOWN(low_to_high) and the other PULLUP(high_to_low).

nrf_gpio_cfg_input(low_to_high,NRF_GPIO_PIN_PULLDOWN);
nrf_gpio_cfg_input(high_to_low,NRF_GPIO_PIN_PULLUP);

At the beginning I just want to control two leds with this Signals:

if(button_action == APP_BUTTON_PUSH) -> nrf_gpio_pin_set(LED_1)

else if (button_action == APP_BUTTON_RELEASE) -> nrf_gpio_pin_clear(LED_2)

The buttons are initialized like this:

static void buttons_init(void)
{
    uint32_t err_code;

    static app_button_cfg_t buttons[] =
    {
        {Switch_up, APP_BUTTON_ACTIVE_HIGH, BUTTON_PULL, button_event_handler},
		{Switch_down, false, BUTTON_PULL, button_event_handler}
    };

    app_button_init(buttons, sizeof(buttons) / sizeof(buttons[0]), BUTTON_DETECTION_DELAY);
	
	err_code = app_button_enable();
    APP_ERROR_CHECK(err_code);
	
}

The high_to_low interrupt works fine. PIN 28 is on 2.8V and when I change it to 0V, the Interrupt will occur and the LED will change the state.

The problem is, PIN 25 is also on 2.8V even when I defined it as PULLDOWN. And the interrupt is also not working. Maybe the interrupt is not working because there is no rising edge. But why is on PIN 25 2.8V?

Nothing is connected on PIN 25. So it has to be a problem with the configuration of the PIN

Related