This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Utilizing the Pushbuttons on an AM335x Starter Kit

Hello everyone

I am having a hard time finding any sort of information about gaining access to the pushbuttons that are onboard the AM335x-EVM-SK. I know for the android operating system they are accessible, but I am looking to gain access to them in linux for a different reason. I'm using the linux-sdk with Qt. I will be using C/C++ to try to accomplish the following.

I am attempting to gain access to these pushbutton switches in order to use them as an onboard directional keypad. The end goal is to have these buttons generate Qt Key events so that I can send them to my touch screen application. Granted they arranged in a stright line, I was sipmly going to assign them to the following: SW1 = up, SW2 = left, SW3 = right, SW4 = down.

From what I have gather so far, I may be able to access these via the GPIO driver already included in the linux kernel, however I do not know which GPIO pins I would need to access in order to accomplish this, or exactly how I would handle these GPIOs in my code. Alternatively, I noticed that inside the /dev/input folder, there is a file called event3, which seems to respond to the pushbuttons, though it seems to just print a bunch or garbage into the terminal screen.

Any advice? And thanks in advanced.

  • In order from SW1 to SW4, they are connected to the following pins on the AM335x:

    SW1  GPMC_BEn0_CLE
    SW2  GPMC_OEn_REn
    SW3  GPMC_ADVn_ALE
    SW4  GPMC_WAIT0

    Please see the schematic for more details.

  • Yes, I saw this in one of the pin muxing documents I found while attempting to solve this. What header file (or other files) do I need to include in my C file in order for these ports to be accessible? All I need to do is poll them and read each time.

    edit: I Checked the schematic as you said, and now I see what the GPIO pins would be. This puts me on track to accessing them, but I'm still not 100% sure how I should go about doing this. According to the linux-sdk wiki, I need to navigate on the target device to the /sys/class/gpio folder, and then export the pin numbers to enable the port? From there I can change the direction of it to an in or out. While I think I get that, how do I actually poll this in code? Should I just access the newly "opened" pin as a file or something?

    Thanks.

  • Kindly look at the evtest sample application. It is an excellent example for handling input events.

    http://www.freedesktop.org/wiki/Evtest

    http://cgit.freedesktop.org/evtest/

    http://processors.wiki.ti.com/index.php/Evtest

    regards

    Gururaja