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
  • Former Member
    0 Former Member over 8 years ago

    Oscar, 

      Depending on the version of Linux you are using, the answers are different, so please supply  which distribution (Pulsar 7, Pulsar 8, PetaLinux, other) and what version of the kernel you are using (uname -a) when asking a question.

    Now having said that, there are working examples using user board components for both Pulsar and PetaLinux posted.  For PetaLinux, this is part of the default BSPs supplied for each release and posted on this site.  If you refer to some of the posted tutorials for Linux, there is an example that shows how to access the components from command line.  

    For Pulsar, there is a software repository at:

    www.github.com/Avnet/Software

    If you clone this repository and look at the Bluemix or Quickstart source code, you will see gpio code that accesses the LED and pushbutton. Using the switch block follows the same procedure in source and device tree.

    Ron

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 8 years ago

    Oscar, 

      Depending on the version of Linux you are using, the answers are different, so please supply  which distribution (Pulsar 7, Pulsar 8, PetaLinux, other) and what version of the kernel you are using (uname -a) when asking a question.

    Now having said that, there are working examples using user board components for both Pulsar and PetaLinux posted.  For PetaLinux, this is part of the default BSPs supplied for each release and posted on this site.  If you refer to some of the posted tutorials for Linux, there is an example that shows how to access the components from command line.  

    For Pulsar, there is a software repository at:

    www.github.com/Avnet/Software

    If you clone this repository and look at the Bluemix or Quickstart source code, you will see gpio code that accesses the LED and pushbutton. Using the switch block follows the same procedure in source and device tree.

    Ron

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • oscargomezf
    0 oscargomezf over 8 years ago in reply to Former Member

    Hi hockeyman1972,

     

    I'm using petalinux v2016.2 and the kernel version is:

    root@picoted:~# uname -a

    Linux picoted 4.4.0-xilinx #34 SMP PREEMPT Thu Oct 13 10:33:12 CEST 2016 armv7l GNU/Linux 

     

    I've managed to run the gpio from the PS like a gpio-keys, and now I can see the /dev/input/event0 file and I can see this in the file /proc/interrupts:

     

    root@picoted:~# cat /proc/interrupts 
               CPU0       CPU1       
     16:          1          0       GIC  27 Edge      gt
     17:          0          0       GIC  43 Level     ttc_clockevent
     18:       1605        593       GIC  29 Edge      twd
     21:         43          0       GIC  39 Level     f8007100.adc
     74:          0          0  zynq-gpio  51 Edge      sw6
    141:          0          0       GIC  57 Level     cdns-i2c
    142:          0          0       GIC  80 Level     cdns-i2c
    ...
     
    I 've used this .dts file:
     
    ...
      keypad {
      compatible = "gpio-keys";
      #address-cells = <1>;
      #size-cells = <0>;
          sw6 {
              label = "sw6";
              gpios = <&ps7_gpios 51 0>;
              linux,code = <0x105>; /* SW6: PS_PB */
          };
      };
    ...
     
    But I wasn't be able to manage the pins from PL usign the same way. Any suggestion?
     
     
    Best regards.
     
     
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
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