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

[nRF52832] Unable to configure InterruptIn + PullDown on P0_1

Hello !

I am currently working on a custom board on which I don't need 32.768kHz. I want to use P0_1 as an interruption pin connected to a pushbutton. The button is connected to VCC so when it's pressed it imposes a high logical level on the GPIO. I configured configured the GPIO to enable the internal pull-down so the low logical level is supposed to be forced when pushbutton is not pressed.

bool pressed = false;
 
void pushbutton1_handler( void )
{
   pressed = true;
}
 
InterruptIn bp1( P0_1 );
 
int main( void )
{
   bp1.rise( &pushbutton1_handler );
   bp1.mode( PullDown );
 
   while(1) {
 
      if( pressed == true ) {
         LOG("pressed\r\n");
         pressed = false;
      }
   }
}

I run this code and measure the voltage on P0_1, which is supposed to be grounded, but I measure 3.3V

Is there a known issue related to this situation ?

Thanks

Parents
  • I tried this:

    nrf_gpio_cfg(
        1,
        NRF_GPIO_PIN_DIR_INPUT,
        NRF_GPIO_PIN_INPUT_CONNECT,
        NRF_GPIO_PIN_PULLDOWN,
        NRF_GPIO_PIN_S0S1,
        NRF_GPIO_PIN_NOSENSE);
    
    NRF_GPIOTE->CONFIG[0] =    (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos) | 
                            (1 << GPIOTE_CONFIG_PSEL_Pos) |
                            (GPIOTE_CONFIG_POLARITY_LoToHi << GPIOTE_CONFIG_POLARITY_Pos) |
                            (GPIOTE_CONFIG_OUTINIT_Low << GPIOTE_CONFIG_OUTINIT_Pos);
    

    and it worked as it should. I also tried your hex file and saw the same thing as you. Maybe the mbed driver doesn't allow using pin 1 or 2? Did you try forcing the pin high and low externally? Does that trigger interrupts?

Reply
  • I tried this:

    nrf_gpio_cfg(
        1,
        NRF_GPIO_PIN_DIR_INPUT,
        NRF_GPIO_PIN_INPUT_CONNECT,
        NRF_GPIO_PIN_PULLDOWN,
        NRF_GPIO_PIN_S0S1,
        NRF_GPIO_PIN_NOSENSE);
    
    NRF_GPIOTE->CONFIG[0] =    (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos) | 
                            (1 << GPIOTE_CONFIG_PSEL_Pos) |
                            (GPIOTE_CONFIG_POLARITY_LoToHi << GPIOTE_CONFIG_POLARITY_Pos) |
                            (GPIOTE_CONFIG_OUTINIT_Low << GPIOTE_CONFIG_OUTINIT_Pos);
    

    and it worked as it should. I also tried your hex file and saw the same thing as you. Maybe the mbed driver doesn't allow using pin 1 or 2? Did you try forcing the pin high and low externally? Does that trigger interrupts?

Children
No Data
Related