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

GPIO pin configuration parameters

Hi,

 

I am using nRF52840 S140 V7.0.1. I have few queries on GPIO configurations.

 

Below are my PULLUP/PULLDOWN macros.

#define BUTTON_PULLUP        NRF_GPIO_PIN_PULLUP
#define BUTTON_PULLDOWN      NRF_GPIO_PIN_PULLDOWN
#define BUTTON_NOPULLUP      NRF_GPIO_PIN_NOPULL
 

As per my understanding

 

1) In below settings, pin is configured as PULLDOWN. So by default pin will be in low state. If there is change in pin from Low to High then only wake-up.

    {FMD_WAKEUP_PIN, APP_BUTTON_ACTIVE_HIGH, BUTTON_PULLDOWN, button_event_handler}, // Pull-Down, Active High

 

2) In below settings, pin is configured as PULLDOWN. So by default pin will be in low state. If there is change in pin from High to Low then only wake-up.

    {FMD_WAKEUP_PIN, APP_BUTTON_ACTIVE_LOW, BUTTON_PULLDOWN, button_event_handler}, // Pull-Down, Active Low

 

I could not find much explanation about Active High/Low in app_button_cfg_t structure. Correct me if I am wrong in my understanding.

 

Thanks & Regards

Vishnu Beema

Parents
  • Hi,

     

    Sorry for confusion and further queries. Currently I don’t have CRO to see the level on pin.

     

    Below is button_event_handler() code.

    static void button_event_handler(uint8_t pin_no, uint8_t button_action)
    {
        ret_code_t err_code;
        
        switch (pin_no)
        {
            case FMD_WAKEUP_PIN:
            {
                if(button_action == APP_BUTTON_PUSH)
                {
                    NRF_LOG_INFO("Wakeup High");
                }
                else
                {
                    NRF_LOG_INFO("Wakeup Low");
                }
            }
            break;
            
            default:
                APP_ERROR_HANDLER(pin_no);
                break;
        }
    }
    

    Because of GPIOTE_CONFIG_IN_SENSE_TOGGLE(), I will be receiving interrupt for both High to Low and Low to High.

    Since I configured BUTTON_PULLDOWN, I connected P1.01 to VDD for getting interrupts.

     

    My confusion / queries are

     

    1) For below configuration, by default P1.01 will be low. When I connect pin P1.01 to VDD, I am getting interrupt but button_action is 0. Does that mean, level on pin is low. Actuall I am connecting P1.01 to VDD where pin level should be High. When I remove P1.01 from VDD I will get one more interrupt with button_action as 1. Hear ideally I am disconnecting from VDD and pin level will be 0.

     

    Whether buttion_action is different from actual pin level.

     

    {FMD_WAKEUP_PIN, APP_BUTTON_ACTIVE_LOW, BUTTON_PULLDOWN, button_event_handler}, // Pull-Down, Active Low

     

    2) For above configuration, when will debounce logic will execute. Is it from High to Low or Low to High or both.

     

    Thanks & Regards

    Vishnu Beema

Reply
  • Hi,

     

    Sorry for confusion and further queries. Currently I don’t have CRO to see the level on pin.

     

    Below is button_event_handler() code.

    static void button_event_handler(uint8_t pin_no, uint8_t button_action)
    {
        ret_code_t err_code;
        
        switch (pin_no)
        {
            case FMD_WAKEUP_PIN:
            {
                if(button_action == APP_BUTTON_PUSH)
                {
                    NRF_LOG_INFO("Wakeup High");
                }
                else
                {
                    NRF_LOG_INFO("Wakeup Low");
                }
            }
            break;
            
            default:
                APP_ERROR_HANDLER(pin_no);
                break;
        }
    }
    

    Because of GPIOTE_CONFIG_IN_SENSE_TOGGLE(), I will be receiving interrupt for both High to Low and Low to High.

    Since I configured BUTTON_PULLDOWN, I connected P1.01 to VDD for getting interrupts.

     

    My confusion / queries are

     

    1) For below configuration, by default P1.01 will be low. When I connect pin P1.01 to VDD, I am getting interrupt but button_action is 0. Does that mean, level on pin is low. Actuall I am connecting P1.01 to VDD where pin level should be High. When I remove P1.01 from VDD I will get one more interrupt with button_action as 1. Hear ideally I am disconnecting from VDD and pin level will be 0.

     

    Whether buttion_action is different from actual pin level.

     

    {FMD_WAKEUP_PIN, APP_BUTTON_ACTIVE_LOW, BUTTON_PULLDOWN, button_event_handler}, // Pull-Down, Active Low

     

    2) For above configuration, when will debounce logic will execute. Is it from High to Low or Low to High or both.

     

    Thanks & Regards

    Vishnu Beema

Children
No Data
Related