Use Reset pin as a normal GPIO - nRF52832

Hi, I am using a custom nrf52832 device. In that device , button is connected with reset pin P0.21. due to reset functionality I am not able get interrupt from button.

how can I use P0.21 as normal gpio??
Can I implement long-press functionality on P0.21 pin??

below is schematic of button and reset pin.

I have tried below possibilities
- used longpress node.

- disabled uicr node from dts.

- Remove GPIO as nRESET properties.


according to the documentation of nRESET.


while in nrf5 sdk it is working as gpio. why not in nrf connect sdk??

  • , I want to use reset pin as normal gpio. when I press single time it should be hard reset by calling NVIC_SystemReset(); and when pressed for >=10 sec it should be hard reset and erase an eeprom ( I have external eeprom in my custom nrf52832 board.

    case if(pins & BIT(button_0.pin)){  // detect p0.21
            printk("button 0 pressed");
            LOG_INF("reset pressed\n\r");
            read_time(rtc_dev,(time_t *)&unix_time);   // read time from mcp7940
            uint32_t reset_pressed_epoch_time = unix_time;
            while (!gpio_pin_get_dt(&button_0) && (unix_time - reset_pressed_epoch_time) <= 10) //if time <10 sec while loop wii execute 
            {
                k_msleep(100);
                read_time(rtc_dev,(time_t *)&unix_time);
            }
            if (unix_time - reset_pressed_epoch_time > 10)  // if time >10 this condition will be true
            {
                Reset_Flag=1;
                eeprom_write(i2c_dev,EEPROM_RESET_FLAG_ADDRESS, &Reset_Flag, 1); // write reset flag value in eeprom
                eeprom_write(i2c_dev,EEPROM_RESET_TIME_FLAG, &current_epoch_time, 4); // write reset time in eeprom 
                guide_flag=1;
                eeprom_write(i2c_dev,EEPROM_DEVICE_GUIDE_ADDRESS,&guide_flag,1);
                reset_hardware_locally();  // erase some portion of eeprom
                //reset_hardware();
                k_msleep(1000);
                NVIC_SystemReset();  // hard reset
            }
            else
            {
                k_msleep(1000);
                NVIC_SystemReset(); // if button pressed <10 sec else statement will execute
            }
            break;

  • I understand, but in your last reply you said that the reset pin now worked as a GPIO, but that there were some other issues with your device after flashing. Do you also see these issues after a power cycle of the board when flashing? What exactly is the issue you're currently facing on your end?

    Best regards,

    Simon

Related