Interfacing a matrix keypad to a Beagleboard using GPIO.

Hi Everyone,

As part of a small project, I'm planning to connect a matrix keypad to
a Beagleboard. From what I've read so far, the basic steps I would
need to take are:

1) Configure pin-mux on the expansion port to give me the needed GPIOs
2) Hook up the output configured pins along the keypad rows, and the
input ones along the keypad columns.
3) Take each output high for a certain period of time, and check the
state of the input pins.
4) By knowing what row was set high, and on what input column that was
detected, work out which key was pressed.

Any comments? I've also seen that there is a GPIO matrix keypad kernel
driver sitting in the tree. Has anyone had any experience using this?

Many Thanks,

Hi Frederico,

You are at the completely right track. I however have a couple of comments.

1) When no keys are pressed you normally pull all rows rows high (in your
logic) in order to detect if a key is pressed. This way you only have to
scan the matrix when a key is known pressed. When no keys are pressed you
can just lean back and wait for and interrupt to happen... :slight_smile:

2) Normally I think this is done with default column state high and then
pulling a single row low at a time. You can however do it the other way
around as well - I see no issues with this...

3) Remember to enable pull up/down on the input pint in order for the pins
to nor float then no keys are pressed.

4) You know that you can get chips doing this for you which you can
interface over i.e. I2C. One such chips is ADP5588 from Analog which I'm
successfully using with one of mine OMAP3 setups... (TI have a similar
part, but I can't remember it's part number right now).

I have unfortunately no experience with the kernel IO driver, but I guess it
working pretty OK...

Best regards - Good luck