P1.00 GPIO on 4x3 keypad not detecting Col

Good day

I have the NRF_desktop keyboard application running on the NRF52840 Dongle,  Zephyr 2.6.1. I would like to us the nrf52840 ProMicro as it has a battery charger build in. I have modified rows and columns accordingly. All my buttons are working except P1.00. I can use any other pin for  col 2  and it will work but for some reason not  P1.00.  It does not appear to be used anywhere else, and I don't get any warnings. Below is my Button_def.h and App.overlay files. I do need to use P1.00  as its the Keypad membrane header col 2.

Any suggestions would be welcomed. Thanks in advance 

app.overlay

/ {
    chosen {
        nordic,pm-ext-flash = &mx25r64;
    };
};

/ {
    chosen {
        /*
         * In some default configurations within the nRF Connect SDK,
         * e.g. on nRF52840 and nRF9160, the chosen zephyr,entropy node
         * is &cryptocell. This devicetree overlay ensures that default
         * is overridden wherever it is set, as this application uses
         * the RNG node for entropy exclusively.
         */
        zephyr,entropy = &rng;
    };
   //     vbatt {
   //        compatible = "voltage-divider";
   //        io-channels = <&adc 31>; // pin no of the ADC channel
           //output-ohms = <22000>;
           //full-ohms = <(560000 + 22000)>;
           //power-gpios = <&sx1509b 4 0>;
    //   };
     
    zephyr,user {
        io-channels = <&adc 7>;
 };
	//remember to check buttons_def.h for corresponding ports
//   for Dongle
rows {      
	compatible = "gpio-leds";
	
 //   row1: row_1 {
 //       gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
//        label = "keypadrow1";
//    };
	row2: row_2 {
		gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;//1.00 //remember to change buttons_def
		label = "keypadrow2";
	};
	row3: row_3 {
		gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;//0.24//remember to change buttons_def
		label = "keypadrow3";
	};
	row4: row_4 {
		gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;//0.22//remember to change buttons_def
		label = "keypadrow4";
	};
 };
 
col {
	compatible = "gpio-keys";

	col1: col_1 {
		gpios = <&gpio0 24(GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;//0.20//remember to change buttons_def
		label = "keypadcol1";
	};
	col2: col_2 {
		gpios = <&gpio1 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;//0.17//remember to change buttons_def
		label = "keypadcol2";
	};
	col3: col_3 {
		gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;//0.15//remember to change buttons_def
		label = "keypadcol3";
	};
	col4: col_4 {
		gpios = <&gpio1 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; //0.13//remember to change buttons_def
		label = "keypadcol4";
	};
};


    pwmleds1 {
        compatible = "pwm-leds";
        status = "okay";

        pwm_led1: led_pwm_1 {
            status = "okay";
            pwms = <&pwm1 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
            label = "LED Conn State";
        };
    };

    pwmleds2 {
        compatible = "pwm-leds";
        status = "okay";

        pwm_led2: led_pwm_2 {
            status = "okay";
            pwms = <&pwm2 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
            label = "LED Caps Lock";
        };
    };

    pwmleds3 {
        compatible = "pwm-leds";
        status = "okay";

        pwm_led3: led_pwm_3 {
            status = "okay";
            pwms = <&pwm3 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
            label = "LED Num Lock";
        };
    };
};

&pwm0 {
    status = "okay";
    pinctrl-0 = <&pwm0_default_alt>;
    pinctrl-1 = <&pwm0_sleep_alt>;
    pinctrl-names = "default", "sleep";
};

&pwm1 {
    status = "okay";
    pinctrl-0 = <&pwm1_default_alt>;
    pinctrl-1 = <&pwm1_sleep_alt>;
    pinctrl-names = "default", "sleep";
};

&pwm2 {
    status = "okay";
    pinctrl-0 = <&pwm2_default_alt>;
    pinctrl-1 = <&pwm2_sleep_alt>;
    pinctrl-names = "default", "sleep";
};

&pwm3 {
    status = "okay";
    pinctrl-0 = <&pwm3_default_alt>;
    pinctrl-1 = <&pwm3_sleep_alt>;
    pinctrl-names = "default", "sleep";
};

&pwm_led0 {
    status = "okay";
    pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
    label = "LED System State";
};

&qspi {
    status = "disabled";
};

&pinctrl {
    pwm0_default_alt: pwm0_default_alt {
        group1 {
            psels = <NRF_PSEL(PWM_OUT0, 0, 13)>;
            nordic,invert;
        };
    };

    pwm0_sleep_alt: pwm0_sleep_alt {
        group1 {
            psels = <NRF_PSEL(PWM_OUT0, 0, 13)>;
            low-power-enable;
        };
    };

    pwm1_default_alt: pwm1_default_alt {
        group1 {
            psels = <NRF_PSEL(PWM_OUT0, 0, 14)>;
            nordic,invert;
        };
    };

    pwm1_sleep_alt: pwm1_sleep_alt {
        group1 {
            psels = <NRF_PSEL(PWM_OUT0, 0, 14)>;
            low-power-enable;
        };
    };

    pwm2_default_alt: pwm2_default_alt {
        group1 {
            psels = <NRF_PSEL(PWM_OUT0, 0, 15)>;
            nordic,invert;
        };
    };

    pwm2_sleep_alt: pwm2_sleep_alt {
        group1 {
            psels = <NRF_PSEL(PWM_OUT0, 0, 15)>;
            low-power-enable;
        };
    };

    pwm3_default_alt: pwm3_default_alt {
        group1 {
            psels = <NRF_PSEL(PWM_OUT0, 0, 16)>;
            nordic,invert;
        };
    };

    pwm3_sleep_alt: pwm3_sleep_alt {
        group1 {
            psels = <NRF_PSEL(PWM_OUT0, 0, 16)>;
            low-power-enable;
        };
    };
};

&adc {
    status = "okay";
};

&spi1 {
    status = "disabled";
};

&temp {
    status = "disabled";
};

&spi3 {
    status = "disabled";
};

&uart0 {
    status = "disabled";
};

&i2c0 {
    status = "disabled";
};



&gpio0 {
	status = "okay";
	gpio-reserved-ranges = <0 2>;
	gpio-line-names = "XL1", "XL2";
};

&gpio1{
	status = "okay";
	gpio-reserved-ranges = <0>;
	gpio-line-names = "";
};


&led3 {
    gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
};

&pwm3_default_alt {
    group1 {
        psels = <NRF_PSEL(PWM_OUT0, 0, 6)>;
    };
};

&pwm2_sleep_alt {
    group1 {
        psels = <NRF_PSEL(PWM_OUT0, 0, 6)>;
    };
};

&pwm3_sleep_alt {
    group1 {
        psels = <NRF_PSEL(PWM_OUT0, 0, 6)>;
    };
};

&pwm2_default_alt {
    group1 {
        psels = <NRF_PSEL(PWM_OUT0, 0, 8)>;
    };
};

&led2 {
    gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
};

&pwm2_sleep_alt {
    group1 {
        psels = <NRF_PSEL(PWM_OUT0, 0, 8)>;
    };
};

&pwm1_default_alt {
    group1 {
        psels = <NRF_PSEL(PWM_OUT0, 1, 9)>;
    };
};

&pwm1_default_alt {
    group1 {
        psels = <NRF_PSEL(PWM_OUT0, 0, 12)>;
    };
};

&led1 {
    gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
};

&pwm1_sleep_alt {
    group1 {
        psels = <NRF_PSEL(PWM_OUT0, 0, 12)>;
    };
};



&led0 {
    gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
};

&pwm0_default_alt {
    group1 {
        psels = <NRF_PSEL(PWM_OUT0, 1, 9)>;
    };
};

&pwm0_default {
    group1 {
        psels = <NRF_PSEL(PWM_OUT0, 0, 9)>;
    };
};

&pwm0_default {
    group1 {
        psels = <NRF_PSEL(PWM_OUT0, 1, 9)>;
    };
};

&pwm0_sleep {
    group1 {
        psels = <NRF_PSEL(PWM_OUT0, 1, 9)>;
    };
};

&pwm0_sleep_alt {
    group1 {
        psels = <NRF_PSEL(PWM_OUT0, 1, 9)>;
    };
};

&button0 {
    gpios = <&gpio0 29 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
};

&button1 {
    gpios = <&gpio1 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
};

&button2 {
    gpios = <&gpio1 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
};

&button3 {
    gpios = <&gpio1 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
};

 
buttons_def.h
/*
 * Copyright (c) 2021 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

#include <caf/gpio_pins.h>

/* This configuration file is included only once from button module and holds
 * information about pins forming keyboard matrix.
 */

/* This structure enforces the header file is included only once in the build.
 * Violating this requirement triggers a multiple definition error at link time.
 */
const struct {} buttons_def_include_once;

static const struct gpio_pin col[] = {

    { .port = 1, .pin = DT_GPIO_PIN(DT_NODELABEL(col4), gpios) },//0.20 remember to look at the app over lay map
    { .port = 1, .pin = DT_GPIO_PIN(DT_NODELABEL(col2), gpios) },//0.17 remember to look at the app over lay map
    { .port = 0, .pin = DT_GPIO_PIN(DT_NODELABEL(col3), gpios) },//0.15 remember to look at the app over lay map
    { .port = 0, .pin = DT_GPIO_PIN(DT_NODELABEL(col1), gpios) },//0.13 remember to look at the app over lay map
  

};

static const struct gpio_pin row[] = {
    { .port = 0, .pin = DT_GPIO_PIN(DT_NODELABEL(button0), gpios) },
    { .port = 1, .pin = DT_GPIO_PIN(DT_NODELABEL(button1), gpios) },
    { .port = 1, .pin = DT_GPIO_PIN(DT_NODELABEL(button2), gpios) },
    { .port = 1, .pin = DT_GPIO_PIN(DT_NODELABEL(button3), gpios) },
// dont use row 1 for 12 button
  //  { .port = 0, .pin = DT_GPIO_PIN(DT_NODELABEL(row1), gpios) }, //0.09 remember to look at the app over lay map
    { .port = 0, .pin = DT_GPIO_PIN(DT_NODELABEL(row2), gpios) }, //1.00 remember to look at the app over lay map
    { .port = 0, .pin = DT_GPIO_PIN(DT_NODELABEL(row3), gpios) }, //0.24 remember to look at the app over lay map
    { .port = 1, .pin = DT_GPIO_PIN(DT_NODELABEL(row4), gpios) }, //0.20 remember to look at the app over lay map
};


Parents
  • Hello,

    You can download the schematic and layout from here if you haven't already:
    https://www.nordicsemi.com/Products/Development-hardware/nRF52840-Dongle/Download?lang=en#infotabs

    I don't see any reason why P1.00 should not be possible to use for any purpose no. If you just make a simple application toggling the IO, does that work? Maybe the pin have been damaged in some way?

    Kenneth

  • HI Kenneth, I have tried another board. same thing. I suspect it has something to do with the reserved pins.

    I initially had this problem with gpio0 .  I then unreserved as below but not sure I did it correctly with gpio1

    &gpio0 {
    	status = "okay";
    	gpio-reserved-ranges = <0 2>;
    	gpio-line-names = "XL1", "XL2";
    };
    
    &gpio1{
    	status = "okay";
    	gpio-reserved-ranges = <0>;
    	gpio-line-names = "";
    };
    

    The original device tree looked as follow

    &gpio0 {
    	status = "okay";
    	gpio-reserved-ranges = <0 2>, <6 1>, <8 3>, <17 7>;
    	gpio-line-names = "XL1", "XL2", "AREF", "A0", "A1", "RTS", "TXD",
    		"CTS", "RXD", "NFC1", "NFC2", "BUTTON1", "BUTTON2", "LED1",
    		"LED2", "LED3", "LED4", "QSPI CS", "RESET", "QSPI CLK",
    		"QSPI DIO0", "QSPI DIO1", "QSPI DIO2", "QSPI DIO3","BUTTON3",
    		"BUTTON4", "SDA", "SCL", "A2", "A3", "A4", "A5";
    };
    
    &gpio1 {
    	status = "okay";
    	gpio-line-names = "", "D0", "D1", "D2", "D3", "D4", "D5", "D6",
    		"D7", "", "D8", "D9", "D10", "D11", "D12", "D13";
    };

    Although nothing reserved in GPIO1 it does not allow me to toggle or read P1.00

Reply
  • HI Kenneth, I have tried another board. same thing. I suspect it has something to do with the reserved pins.

    I initially had this problem with gpio0 .  I then unreserved as below but not sure I did it correctly with gpio1

    &gpio0 {
    	status = "okay";
    	gpio-reserved-ranges = <0 2>;
    	gpio-line-names = "XL1", "XL2";
    };
    
    &gpio1{
    	status = "okay";
    	gpio-reserved-ranges = <0>;
    	gpio-line-names = "";
    };
    

    The original device tree looked as follow

    &gpio0 {
    	status = "okay";
    	gpio-reserved-ranges = <0 2>, <6 1>, <8 3>, <17 7>;
    	gpio-line-names = "XL1", "XL2", "AREF", "A0", "A1", "RTS", "TXD",
    		"CTS", "RXD", "NFC1", "NFC2", "BUTTON1", "BUTTON2", "LED1",
    		"LED2", "LED3", "LED4", "QSPI CS", "RESET", "QSPI CLK",
    		"QSPI DIO0", "QSPI DIO1", "QSPI DIO2", "QSPI DIO3","BUTTON3",
    		"BUTTON4", "SDA", "SCL", "A2", "A3", "A4", "A5";
    };
    
    &gpio1 {
    	status = "okay";
    	gpio-line-names = "", "D0", "D1", "D2", "D3", "D4", "D5", "D6",
    		"D7", "", "D8", "D9", "D10", "D11", "D12", "D13";
    };

    Although nothing reserved in GPIO1 it does not allow me to toggle or read P1.00

Children
Related