GPIOTE internal pull-up does not work on GPIO1.x

Hello.

I tried to implement GPIOTE on GPIO1.x, but it seems to not work.

How to reproduce at below.

At first, I generate nrfx sample project.

Just be sure, I compile it and confirm that a callback is called when button 1 is pressed.

static void button_handler(nrfx_gpiote_pin_t pin,
			   nrfx_gpiote_trigger_t trigger,
			   void *context)
{
	LOG_INF("GPIO input event callback");
}

Then, I make a new file as 'app.overlay' with below contents.

/ {
	buttons {
		button0: button_0 {
			gpios = <&gpio1 14 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
			label = "Push button switch 0";
		};
	};
};

This changes the config of button1 to GPIO1.14.

I compile again and short GPIO1.14. but no callback occurs. When I check GPIO 1.14 on the tester, the pull-up is not enabled.

For reference, GPIO0.x pull-ups work fine. (I just confirmed this with a sample project.)

I think this is a bug.

Parents
  • Hi,

     

    The problem is that the example assumes gpio0. You can add a if in the INPUT_PIN definition:

    /* Check if INPUT_PIN is on gpio1 and offset the input to nrfx calls with +32 */
    #if DT_PROP(DT_GPIO_CTLR(DT_NODELABEL(button0),gpios), port) == 1
    #define INPUT_PIN	DT_GPIO_PIN(DT_ALIAS(sw0), gpios) + 32
    #else 
    /* Assume gpio0 */
    #define INPUT_PIN	DT_GPIO_PIN(DT_ALIAS(sw0), gpios)
    #endif

     

    Could you try this and see if that works for you?

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    The problem is that the example assumes gpio0. You can add a if in the INPUT_PIN definition:

    /* Check if INPUT_PIN is on gpio1 and offset the input to nrfx calls with +32 */
    #if DT_PROP(DT_GPIO_CTLR(DT_NODELABEL(button0),gpios), port) == 1
    #define INPUT_PIN	DT_GPIO_PIN(DT_ALIAS(sw0), gpios) + 32
    #else 
    /* Assume gpio0 */
    #define INPUT_PIN	DT_GPIO_PIN(DT_ALIAS(sw0), gpios)
    #endif

     

    Could you try this and see if that works for you?

     

    Kind regards,

    Håkon

Children
Related