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

App_Beacon and GPIOTE

I having problems to get reliable response once gpiote is detected

If I look at NRF_LOG or show it in the field on MINOR or RSSI, it jumps. i.e. the counter that counts the number of shorts is incrementing - but the result shown jumps

It works with nrf_uart correctly,

Do you have an example of app_beacon that shows the number of detections (i.e. short certain GPIO to ground) and the result is reflected in the MINOR field?

  • Hi,

    I'm not aware of any examples that does this. Can you give an example of how the counter "jumps"?

    Have you verified that the input signal does not "jump" when it is changed? Button presses, etc., can cause bouncing on the signal.

    How do you count the pulses? Can you post your example so that we can help you with suggestions to improve the stability?

    Best regards,
    Jørgen

  • I can see now that it is bouncing issue. 

    What is the recommended way to solve the debounce just with the GPIOTE (i.e. not using Button)?

  • Ideally it would be best if you remove the bouncing from the incoming signal.

    What is the frequency of the incoming signal? You need to either add a delay before the next GPIOTE transition is counter, or count after a given delay if you want the signal to stabilize first. This is some pseudocode to show you the concepts:

    bool debounce_flag = false;
    
    GPIOTE_evt_handler()
    {
    	if(debounce_flag == false)
    	{
    		count++;	//Count here if you are interested in first signal
    		debounce_flag = true;
    		app_timer_start(1ms);	//start timer for debounce period
    	}
    }
    
    timer_handler()
    {
    	if(check that state of GPIO is still the desired state)
    	{
    		//count++;	//Count here if you only want to count if signal have settled during debounce
    	}
    	debounce_flag = false;
    }

Related