element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Software Application Development Configuring gpio-keys
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 7 replies
  • Subscribers 330 subscribers
  • Views 2638 views
  • Users 0 members are here
Related

Configuring gpio-keys

oscargomezf
oscargomezf over 8 years ago

Hi everyone,

 

I'm trying to configure the SW1, SW2, SW3, SW4 and SW5 of my PicoZed FMC Carrier FMC V2. But it doesn't work and right know I'm stucked. This is part of my device tree dts file where I configure this pins:

...
  amba_pl {
  #address-cells = <0x1>;
  #size-cells = <0x1>;
  compatible = "simple-bus";
  ranges;
   
  ...
   
  ps7_gpio_buttons: gpio@41210000 {
  #gpio-cells = <0x2>;
  compatible = "xlnx,xps-gpio-1.00.a";
  gpio-controller;
  reg = <0x41210000 0x10000>;
  xlnx,all-inputs = <0x1>;
  xlnx,all-inputs-2 = <0x0>;
  xlnx,all-outputs = <0x0>;
  xlnx,all-outputs-2 = <0x0>;
  xlnx,dout-default = <0x0>;
  xlnx,dout-default-2 = <0x0>;
  xlnx,gpio-width = <0x5>;
  xlnx,gpio2-width = <0x20>;
  xlnx,interrupt-present = <0x0>;
  xlnx,is-dual = <0x0>;
  xlnx,tri-default = <0xffffffff>;
  xlnx,tri-default-2 = <0xffffffff>;
  };
  };
...
 
keypad {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
sw1 {
label = "sw1";
gpios = <&ps7_gpio_buttons 0 0>;
linux,code = <100>; /* up */
};
sw2 {
label = "sw2";
gpios = <&ps7_gpio_buttons 1 0>;
linux,code = <101>; /* down */
 
};
sw3 {
label = "sw3";
gpios = <&ps7_gpio_buttons 2 0>;
linux,code = <102>; /* right */
 
};
sw4 {
label = "sw4";
pios = <&ps7_gpio_buttons 3 0>;
linux,code = <103>; /* left */
};
sw5 {
label = "sw5";
gpios = <&ps7_gpio_buttons 4 0>;
linux,code = <104>; /* center */

...

I can see the associated gpio  in /sys/class/gpio897

 

But I've got this error and it doesn't work:

 

gpio-keys keypad: Unable to get irq number for GPIO 897, error -6

 

 

Could anyone help me?

 

Best regards.

  • Sign in to reply
  • Cancel
Parents
  • oscargomezf
    0 oscargomezf over 8 years ago

    Hi everyone,

     

    I've tried to do the same but using a GPIO from PS, the PS_MIO51 due to the fact the picoZed FMC Carrier V2 has a SW called SW6, and it's very easy to try it. This is my device tree:

    ...

    ps7_gpios: gpio@e000a000 {
        compatible = "xlnx,zynq-gpio-1.0";
        #gpio-cells = <0x2>;
        #interrupt-cells = <0x2>;
        clocks = <0x1 0x2a>;
        gpio-controller;
        interrupt-controller;
        interrupt-parent = <0x3>;
        interrupts = <0x0 0x14 0x4>;
        reg = <0xe000a000 0x1000>;
        emio-gpio-width = <0x40>;
        gpio-mask-high = <0x0>;
        gpio-mask-low = <0x5600>;
        linux,phandle = <0x5>;
        phandle = <0x5>;
    };

    ...

    keypad {
        sw6 {
            label = "sw6";
            gpios = <&ps7_gpios 51 0>;
            linux,code = <150>; /* SW6: PS_PB */
        };
    };

    ...

    And it works perfectly, I can see the file event0:

    root@picoted:/dev/input# ls -l
    crw-rw----    1 root     root       13,  64 Jan  1 00:00 event0
    crw-rw----    1 root     root       13,  63 Jan  1 00:00 mice
     

    And I can see thw SW6 interrupt in the file /proc/interrupts:

    root@picoted:/dev/input# cat /proc/interrupts
               CPU0       CPU1       
     16:          1          0       GIC  27 Edge      gt
     17:          0          0       GIC  43 Level     ttc_clockevent
     18:       2436       4051       GIC  29 Edge      twd
     21:         43          0       GIC  39 Level     f8007100.adc
     74:         53          0  zynq-gpio  51 Edge      sw6
    141:          0          0       GIC  57 Level     cdns-i2c
    142:          0          0       GIC  80 Level     cdns-i2c
    144:          0          0       GIC  35 Level     f800c000.ocmc
    145:        761          0       GIC  82 Level     xuartps
    146:          0          0       GIC  51 Level     e000d000.spi
    147:        554          0       GIC  54 Level     eth0
    148:         75          0       GIC  56 Level     mmc0
    149:          0          0       GIC  45 Level     f8003000.dmac
    150:          0          0       GIC  46 Level     f8003000.dmac
    151:          0          0       GIC  47 Level     f8003000.dmac
    152:          0          0       GIC  48 Level     f8003000.dmac
    153:          0          0       GIC  49 Level     f8003000.dmac
    154:          0          0       GIC  72 Level     f8003000.dmac
    155:          0          0       GIC  73 Level     f8003000.dmac
    156:          0          0       GIC  74 Level     f8003000.dmac
    157:          0          0       GIC  75 Level     f8003000.dmac
    158:          0          0       GIC  40 Level     f8007000.devcfg
    165:          0          0       GIC  41 Edge      f8005000.watchdog
    IPI1:          0          0  Timer broadcast interrupts
    IPI2:        843       1413  Rescheduling interrupts
    IPI3:          0          0  Function call interrupts
    IPI4:         24         24  Single function call interrupts
    IPI5:          0          0  CPU stop interrupts
    IPI6:          0          0  IRQ work interrupts
    IPI7:          0          0  completion interrupts
    Err:          0
     
    So I think it's something related to the type of GPIO used, PS (Processing System) vs PL (Programmble Logic).
     
    Any suggestion?
     
    Best regards.
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • oscargomezf
    0 oscargomezf over 8 years ago

    Hi everyone,

     

    I've tried to do the same but using a GPIO from PS, the PS_MIO51 due to the fact the picoZed FMC Carrier V2 has a SW called SW6, and it's very easy to try it. This is my device tree:

    ...

    ps7_gpios: gpio@e000a000 {
        compatible = "xlnx,zynq-gpio-1.0";
        #gpio-cells = <0x2>;
        #interrupt-cells = <0x2>;
        clocks = <0x1 0x2a>;
        gpio-controller;
        interrupt-controller;
        interrupt-parent = <0x3>;
        interrupts = <0x0 0x14 0x4>;
        reg = <0xe000a000 0x1000>;
        emio-gpio-width = <0x40>;
        gpio-mask-high = <0x0>;
        gpio-mask-low = <0x5600>;
        linux,phandle = <0x5>;
        phandle = <0x5>;
    };

    ...

    keypad {
        sw6 {
            label = "sw6";
            gpios = <&ps7_gpios 51 0>;
            linux,code = <150>; /* SW6: PS_PB */
        };
    };

    ...

    And it works perfectly, I can see the file event0:

    root@picoted:/dev/input# ls -l
    crw-rw----    1 root     root       13,  64 Jan  1 00:00 event0
    crw-rw----    1 root     root       13,  63 Jan  1 00:00 mice
     

    And I can see thw SW6 interrupt in the file /proc/interrupts:

    root@picoted:/dev/input# cat /proc/interrupts
               CPU0       CPU1       
     16:          1          0       GIC  27 Edge      gt
     17:          0          0       GIC  43 Level     ttc_clockevent
     18:       2436       4051       GIC  29 Edge      twd
     21:         43          0       GIC  39 Level     f8007100.adc
     74:         53          0  zynq-gpio  51 Edge      sw6
    141:          0          0       GIC  57 Level     cdns-i2c
    142:          0          0       GIC  80 Level     cdns-i2c
    144:          0          0       GIC  35 Level     f800c000.ocmc
    145:        761          0       GIC  82 Level     xuartps
    146:          0          0       GIC  51 Level     e000d000.spi
    147:        554          0       GIC  54 Level     eth0
    148:         75          0       GIC  56 Level     mmc0
    149:          0          0       GIC  45 Level     f8003000.dmac
    150:          0          0       GIC  46 Level     f8003000.dmac
    151:          0          0       GIC  47 Level     f8003000.dmac
    152:          0          0       GIC  48 Level     f8003000.dmac
    153:          0          0       GIC  49 Level     f8003000.dmac
    154:          0          0       GIC  72 Level     f8003000.dmac
    155:          0          0       GIC  73 Level     f8003000.dmac
    156:          0          0       GIC  74 Level     f8003000.dmac
    157:          0          0       GIC  75 Level     f8003000.dmac
    158:          0          0       GIC  40 Level     f8007000.devcfg
    165:          0          0       GIC  41 Edge      f8005000.watchdog
    IPI1:          0          0  Timer broadcast interrupts
    IPI2:        843       1413  Rescheduling interrupts
    IPI3:          0          0  Function call interrupts
    IPI4:         24         24  Single function call interrupts
    IPI5:          0          0  CPU stop interrupts
    IPI6:          0          0  IRQ work interrupts
    IPI7:          0          0  completion interrupts
    Err:          0
     
    So I think it's something related to the type of GPIO used, PS (Processing System) vs PL (Programmble Logic).
     
    Any suggestion?
     
    Best regards.
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube