msm8909+android5.1.1 Keyboard Driver---sn7326 introduction

Source: Internet
Author: User

msm8909+android5.1.1 Keyboard Driver---sn7326 introduction

1. Sn7326 Overview

The SN7326 is a keyboard expansion chip with intelligent self-scanning and supports up to 8*8 keys. The action of pressing/releasing the key is encoded into a byte of data stored in the key event register, which can read the key event register via the I²c serial bus.

The SN7326 has a de-jitter function to lower the interrupt output pin when any key is pressed, to reduce power consumption and SN7326 automatically into a low-power mode when no key action is in place.

Key features of the SN7326

(1) operating voltage from 2.4V to 5.5V

(2) 400kHz I²c serial Interface

(3) can detect multiple keys at the same time press

(4) Standby current as low as 0.3uA (Vdd Typ. 3.3V)

2. Schematic design

Our device has a QWERTY keyboard and a simple keyboard to extend the chip through the SN7326 key, and then the level conversion chip NLSX4378 connected to the CPU, such as


Figure 1

SCL---Gpio_11

SDA---gpio_10

Key_int---gpio_98

Key_rst---gpio_2

KEY_UP---gpio_90

Key_down---gpio_91

The CPU uses the Key_int pin to know if the button is pressed, and then reads the value of the SN7326 register through the i²c to determine which key is pressed and then reported to the system.

3. sn7326 Device From address


Figure 2

A0 is a read-write flag bit, a0=0 indicates the Write command, A0=1 instructs the Read command. Our design AD1 and AD0 are connected to VDD, so ad1=ad0=0, so the device address is 1011000+a0 bit

4. sn7326 Register Introduction

There are configuration registers and key state registers.


Figure 3

(1) configuration register (0x08)

The de bit can be used to control whether to enable the Jitter function.

Lt bit can set long key detection delay time

(2) Key State Register (0X10)

The DN bit can be judged by one or more keystrokes pressed

KS bit to know if the button is pressed or released

KM refers to the key position coded bit, which represents up to 64 key codes, when the key State Register is read (dn=0), the register is set to 00000000, and the/int pin is high.

The key mapping table is as follows:


Figure 4

It is important to note that when the interrupt is generated, you must read the key State register value, that is, when reading the key state register DN bit =0, stop reading the key State register.

5. Typical applications

5.1 Power-on reset

The SN7326 contains a full power-on reset circuit to ensure that all registers are reset to a known state at power-up, and when the vdd>2.4v, the power-on circuit releases the register and the I²c interface is working properly. When Vdd<vpor (2.35V), SN7326 resets the contents of all registers to the default values.

5.2 I²c Reset Control

When the I²c bus is locked, a low level is sent to the RST pin to allow the I²C bus reset to continue to communicate, and this reset action does not affect the interrupt output.

5.3 Standby mode

When the bus is idle, the SN7326 automatically enters standby mode, reducing the supply current.

5.4-button Auto-scan

SN7326 can support a 8*8 matrix keyboard scan, 8 column input ports (OD ports) require a 100kω, 8 line Input ports (PP ports) are pulled down when in standby state.

If a keyboard state change is detected, the keyboard scans 3 times within the bounce delay (debounce delay) time. When the key is captured and pressed/released, the key event is encoded and written to the key-State register, and an interrupt is generated through the/int. The key event is reported by reading the key state register from the lowest encoded value to the highest encoded value.

The/int pin remains low until the key event has been read, except in the case where the ability to automatically empty the/int is not read all the key event data at programming time (determined by the SD bit of the 08H register) and the/int pin becomes high when the programming time arrives. However, the temporary key State register will remain unchanged and the key event data can continue to be read until another key is detected before it is detected.

5.5 de-jitter (debounce)

When the configuration register (08h) SD=0/1 and keyboard state changes, the keyboard scan and save the data to the temporary register for the 1th time, waiting for 6/3MS to do the 2nd scan, and then wait for the 8/4ms for the 3rd scan, if the results of these scans, the key event data is latched to the temporary key State Register and/ int low, otherwise, the scan stops and the device returns to standby mode, no data is saved to the temporary key State register and the/int remains high.

5.6 Long key detection (long-pressed key Detect)

When the configuration register (08h) is le=1, the long button function is turned on. When the key is long and on time, the chip will automatically repeat the interrupt signal and Scan button, knowing that the key is released, the time interval of long key detection is determined by the LT bit of the configuration register (08h).

5.7 Key Event Interrupt

Once the key event code is latched into the temporary key State register, an interrupt signal is output to the MCU, and the/int remains low until the keyboard time has been read, and any changes to the keyboard state are ignored. Except in one case: if the/int auto-purge function is enabled, the/int pin becomes high when the programming time arrives. However, the temporary key State register will remain unchanged and the key event data can continue to be read until another key is detected before it is detected.

5.8 Auto Clear int function

This function is enabled if the ACI=01/10 of the Configuration register (08h) is available. After the interrupt is generated, even if the value of the key state register is not read, the 5/10ms automatically resets the high/int. When the/int is low, the data of the key State register is not changed, and the value of the Anin status register can be read regardless of whether the/int is high or low. However, if a new keystroke event creates a new interrupt, the new data is written to the key and mailed to you, the old data will be lost and only new data can be read.

5.9 Input Port Filter

Configure to send out your de=1, enable input port filtering function. When de=0, the input port filtering function is turned off and the chip responds to any changes in the input port. When de=1, any pulses less than 100ns will be filtered out, and if the input pulse width is greater than 100ns, the chip will respond to the signal.


Figure 5

msm8909+android5.1.1 Keyboard Driver---sn7326 introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.