Keyencoder IC BU1852GUW can monitor up to 8x12 matrix (96 keys), which means to be adaptable to Qwerty keyboard.
We adopt the architecture that the information of the only key which status is changed, like push or release, is encoded into
the 8 bits data. This can greatly reduce the CPU load which tends to become heavier as the number of keys increase.
(Previously, all key's status is stored in the registers.) When the number of keys is small, the extra ports can be used as
GPIO. Furthermore, auto sleep function contributes to low power consumption, when no keys are pressed. It is also
equipped with the various functions such as ghost key rejection, N-key Rollover, Built-in power on reset and oscillator.
●Features
1) Monitor up to 96 matrix keys.
2) Under 3µA Stand-by Current
3) Built-in Power on Reset.
4) Ghost key rejection.
5) Keyscan / GPIO selectable
6) 3 volt tolerant Input
●Absolute maximum ratings (Ta=25℃)
Parameter Symbol Ratings Unit Conditions
VDD -0.3 ~ +2.5 V VDD≦VDDIO
Supply Voltage
VDDIO -0.3 ~ +4.5 V
1
※
VI1 -0.3 ~ VDD +0.3
V XRST, XI, TW, PORENB
1
Input voltage
VI2 -0.3 ~ VDDIO +0.3
※
V ADR
VIT -0.3 ~ +4.5 V
Storage temperature range Tstg -55 ~ +125 ℃
2
Package power PD 272
※ This IC is not designed to be X-ray proof.
※1 It is prohibited to exceed the absolute maximum ratings even including +0.3 V.
※2 Package dissipation will be reduced each 2.72mW/℃ when the ambient temperature increases beyond 25℃.
1. Power mode
The device enters the state of Power Down when XRST=”0”. When XRST becomes High after powered, the device
enters the standby state.
Power On Reset
A Power On Reset logic is implemented in this device. Therefore, it will operate correctly even if the XRST port is not
used. In this case, the XRST port must be connected to “1” (VDD), and the PORENB port must be connected to “0”
(VSS). If you don’t want to use Power On reset, you must connect PORENB port to “1” (VDD).
Power Down State
The device enters Power Down state by XRST=”0”. An internal circuit is initialized, and key encoding and 3wire/I
interface are invalid. Power On Reset becomes inactive during this state.
Stand-by State
The device enters the stand-by state by setting XRST to "1". In this state, the device is waiting for keys pressed or
2
C communication (TW=”0”). When a key is pressed or I2C start condition, the state will change to operation. Power
I
On Reset is active in this state if PORENB = “0”.
Operating State
The device enters the operating state by pressing keys. The device will scan the key matrix and encode the key code,
and then the 3wire/I
After communicating with host device, when no keys are pressed, the device returns to the stand-by state. Power On
Reset is active in this state if PORENB=”0”.
2. Protocol of serial interface
2
C
I
When set to TW=”0”, SCL and SDA are used for I
accessed through I
GPO or key scan, proper register setting should be done through I
3 wire (Original)
When set to TW=”1”, SCL and SDA are used for original 3wire communication, which is not the standard interface.
Any register shown in section 4 cannot be accessed through 3wire. With TW=”1”, only keyscan and key encoding
are supposed to be performed. GPIO function is inactive. When the application needs kind of complex system (for
instance, GPO+keyscan or GPIO+keyscan…), I2C mode is recommended.
See appendix for the details.
Technical Note
2
2
C interface tries to start communication by driving XINT “0”. See next section for the details.
2
2
C. Initially, all GPIO ports are set to GPI and pull-up/down ON. When the application requires
C communication. Any register shown in section 4 can be
Each function of GPIO is controlled by internal registers. The I
registers. The device supports 400kHz Fast-mode data transfer rate.
Slave address
Two device addresses (Slave address) can be selected by ADR port.
2
C Slave interface is used to write or read those internal
ADR=0 0 0 0 1 0 1 0
ADR=1 0 0 0 1 1 0 1
Data transfer
One bit of data is transferred during SCL = “1”. During the bit transfer SCL = “1” cycle, the signal SDA should keep
the value. If SDA changes during SCL = “1”, START condition or STOP condition occur and it is interpreted as a
control signal.
A7 A6 A5 A4 A3 A2 A1 R/W
1/0
SDA
SCL
Data is valid
when SDA is stable
Fig.9 Data transfer
START・STOP・Repeated START conditions
When SDA and SCL are “1”, the data isn’t transferred on the I2C bus. If SCL remains “1” and SDA transfers from “1”
to “0”, it means “Start condition” is occurred and access is started. If SCL remains “1” and SDA transfers from “0” to
“1”, it means “Stop condition” is occurred and access is stopped. It becomes repeated START condition (Sr) the
START condition enters again although the STOP condition is not done.
After start condition is occurred, 8 bits data will be transferred. SDA is latched by the rising edge of SCL. After 8 bits
data transfer is finished by the “Master”, “Master” opens SDA to “1”. And then, “Slave” de-asserts SDA to “0” as
“Acknowledge”.
Writing protocol
Register address is transferred after one byte of slave address with R/W bit. The 3rd byte data is written to internal
register which defined by the 2
be reset to (00h) after the byte transfer.
S
SDA output
from “Master”
Not acknowledge
SDA output
from “Slave”
SCL1289
S
START condition
Acknowledge
Clock pulse
For Acknowledgs
Fig.11 Acknowledge
nd
byte. However, when the register address increased to the final address (18h), it will
After Writing the slave address and Read command bit, the next byte is supposed to be read data. The reading
register address is the next of the previous accessed address. Reading address is incremented one by one. When
the incremented address reaches the last address, the following read address will be reset to (00h).
Technical Note
XXX XX X XD7D6D5D4D3D2D1D0D7D6D5D4D3D2D1D0
Salve address
Transmit from master
Transmit from slave
1SAP
data
R/W=1(Read)
Register Address
A
increment
A=acknowledge
=not acknowledge
A
S=Start condition
P=Stop condition
A
data
Register address
increment
Fig.13 Readout protocol
Complex reading protocol
There is the complex reading protocol to read the specific address of registers that master wants to read.
After the specifying the internal register address as writing command, master occurs repeated START condition with
read command. Then, the reading access of the specified registers is supposed to start. The register address
increment is the same as normal reading protocol. If the address is increased to the last, it will be reset to (00h).
C
When illegal access happens, the data is annulled.
The illegal accesses are as follows.
・The START condition or the STOP condition is continuously generated.
・When the Slave address and the R/W bit are written, repeated START condition or the STOP condition are
generated.
・Repeated START condition or the STOP condition is generated while writing data.
4. Register configuration
Table1 shows the register map and Table2 indicates each function in the corresponding bit. Only when TW is “0”, these
registers can be accessed with I
register map.
*1 Do not write more than 0x7F in KS_RATE
※ Do not write “1” in the reserved resisters. The write commands to 13h-18h addresses’ registers are ignored.
Software reset. All registers are initialized by writing "1".
This register value is returned to "0" automatically.
Exceptionally, GPIn register is not initialized.
CLKSEL 01h
KS_RATE 02h Key scan rate control
KS_Cx 03h-04h
KS_Ry 05h
IODn 06h-08h
INTENn 09h-0Bh Interrupt of GPIOn port is enabled by "1". It is masked by "0".
GPOn 0Ch-0Eh Output value of GPIOn port.
XPDn 0Fh-10h Pull-down of GPIOn port is on by "0" and off by "1". GPIOn should be input.
XPUn 11h Pull-up of GPIOn port is on by "0" and off by "1". GPIOn should be input.
“1” : External clock from XI is used.
“0” : Internal CR oscillator is used.
When set to “1”, port is used as COLx for key scan.
When set to “0”, it is used as GPIO port.
When set to “1”, port is used as ROWy for key scan.
When set to “0”, it is used as GPIO port.
GPIOn’s IO direction.
When set to “1”, GPIOn direction is output. When set to “0”, GPIOn direction is input.
INTFLT 12h
keycode 14h Keycode that Host can read currently
fifo_ind 15h When there are keycode data in FIFO, fifo_ind is set to “1”. “0” means fifo empty.
fifo_ovf 15h When FIFO overflow happens, fifo_ovf is set to “1”. Initially “0” is stored.
GPIn 16h-18h
※"n" is the number of GPIO[19:0] ports. “x” is the number of COL[11:0]. “y” is the number of ROW[7:0].
“1” : interrupt filter ON (1us pulse rejection)
“0” : interrupt filter OFF (bypass)
Input value of GPIOn port. Write command is ignored.
When interrupt happens, these registers must be read.
5. GPIO function
GPIO configuration
When some ports of COL[11:0] and ROW[7:0] are needed to be used as GPIO, TW must be “0”. Then, set the proper
value in the appropriate registers through I2C. ROW[7:0] and COL[11:0] correspond to GPIO[7:0] and GPIO[19:8],
respectively. By default, GPIO[19:0] ports are set to input(IODn=0) and Pull-up/down ON(XPUn/XPDn=0).
(n is the number of GPIO[19:0] ports.)
Refer to the following for the configuration of GPIO.
Table3 GPIO configuration
Input, Pull-up/down ON * 0 0
Input, Pull-up/down OFF * 0 1
Output, H drive 1 1 *
Output, L drive 0 1 *
Output, Hi-Z
※1 It is required to pull-up to more than VDD potential.
How to deal with GPIO ports which are not using
When set to output, GPIO port must be open.
When set to input, don’t make GPIO port open. It must be forced by "0" or Pull-up/down on.
Interrupt configuration
The initial XINT output is Hi-Z, so it should be pull-up. When interrupt is generated, XINT port outputs L. By default,
interrupt is masked with INTEN register "0". The bit to be used is made "1", and then the mask is released. In this
case, IOD register should be "0"(input).
Write to GPIO port
After master sets the internal register address for write, the data is sent from MSB.
After Acknowledge is returned, the value of each GPIO port will be changed.
Write Configuration Pulse, which is trigger of changing registers, is generated at the timing of Acknowledge.
State of GPIO
Register
GPOn IODn XPDn/XPUn
1
※
0 0 1
Technical Note
SDA
Write Configuration
Write Configuration
Pulse
GPIO[7:0]
SCL
S X X X X X X X 0 AckAckReg AddressMSBLSBAckData1 (GPO[7:0])MSBLSBAckWRSEL = Write ModeMSBLSBP
SDA
Start Condition
Pulse
GPIO[7:0]
123456789SCL
S X X XX X X X0 AckAckReg AddressMSBLSBAckData1 (GPO[7:0])MSBLSBP
After writing of the Slave address and R/W bits by master, reading GPIO port procedure begins.
All ports’ status that is set to the input by IOD registers are taken into the GPI register when ACK is sent.
Technical Note
SCL
SDA
GPI[7:0] Reg
[7:0]D1
GPIO
123456789
SXXXXXXX1Ac
Start Condition
Read
D1
[7]D1[6]D1[5]
cknowledge From Slave
D1
[4]D1[3]D1[2]D1[1]
D1
D1
[0]
D2
P
NA
Stop Condition
No Acknowledge From Maste
Fig.16 Read from GPIO port
Interrupt Valid/Reset
When the GPIO interrupt is used, some of INTEN registers are required to be written to "1".
When current GPIO port status becomes different from the value of the GPIn registers, XINT port is changed from
"1" to "0". After reading GPI register, it will return to "1".
When Master detects interrupt, Master must read all GPI registers that is set to input(IODn=0), even if XINT is
changed while reading. It is because BU1852GUW does not latch the XINT status. Fig.13 shows one of the example
of using only ROW[7:0] as GPI. In this case, Master reads only 18h register immediate after detecting XINT.
XINT cannot distinguish whether just one port is different or multi ports are different from the previous value. Master
is necessary to store the previous GPI register value and compare it with the current value after XINT is asserted.
SCL
SDA
GPIOn
XINT
123456789
SX XXXXXX1 AckNA
Start Condition
Data1Data2
Data1Data2GPIn Reg
ReadAcknowledge From Slave
Data2 (GPI[7:0])MSBLSB
tIVtIR
P
Stop Condition
No Acknowledge From Master
Data3Data2
tIVtIR
Fig.17 Interrupt Valid/Reset (Example : ROW[7:0] as GPI with interrupt)
6. Key code Assignment
Table 4 shows the key code assignment. These key codes are sent through 3wire or I2C corresponding to the pushed
or released keys.
Table4 Key codes
COL 0
COL 1
Technical Note
ROW 0ROW1ROW2ROW3ROW 4ROW5ROW6ROW7
0x010x110x210x310x410x510x610x71M
0x810x910xA10xB10xC10xD10xE10xF1B
M
0x020x120x220x320x420x520x620x72
0x820x920xA20xB20xC20xD20xE20xF2
B
COL 2
COL 3
COL 4
COL 5
COL 6
COL 7
COL 8
M
B
M
B
M
B
M
B
M
B
M
B
M
B
0x030x130x230x330x430x530x
0x830x930xA30xB30xC30xD30xE30xF3
0x040x140x240x340x440x540x
0x840x940xA40xB40xC40xD40xE40xF4
0x050x150x250x350x450x550x
0x850x950xA50xB50xC50xD50xE50xF5
0x060x160x260x360x460x560x
0x860x960xA60xB60xC60xD60xE60xF6
0x070x170x270x370x470x570x
0x870x970xA70xB70xC70xD70xE70xF7
0x080x180x280x380x480x580x
0x880x980xA80xB80xC80xD80xE80xF8
0x090x190x290x390x490x590x
0x890x990xA90xB90xC90xD90xE90xF9
630x73
640x74
650x75
660x76
670x77
680x78
690x79
B
B
B
0x0
0x8
0x0B0x
0x8B0x
0
x0C0x1C0x2C0x3C0x4C0x5C0x6C0x7C
x8C0x9C0xAC0xBC0xCC0xDC0xEC0xFC
0
0x1
0x2
0x9
0xAA0xBA0xCA0xDA0xEA0xFA
0x3
0x4
0x5
0x6
1B0x2B0x3B0x4B0x5B0x6B0x7B
9B0xAB0xBB0xCB0xDB0xEB0xFB
0x7
M
COL 9
M
COL 10
M
COL 11
M : Make Key (the code when the key is pressed)
B : Break Key (the code when the key is released)
7. Ghost Key Rejection
Ghost key is an inevitable phenomenon as long as key-switch matrices are used. When three switches located at the
corners of a certain matrix rectangle are pressed simultaneously, the switch that is located at the last corner of the
rectangle (the ghost key) also appears to be pressed, even though the last key is not pressed. This occurs because the
ghost key switch is electrically shorted by the combination of the other three switches (Fig.18). Because the key
appears to be pressed electrically, it is impossible to distinguish which key is the ghost key and which key is pressed.
The BU1852GUW solves the ghost key problem to use the simple method. If BU1852GUW detects any three-key
combination that generates a fourth ghost key, and BU1852GUW does not report anything, indicating the ghost keys
are ignored. This means that many combinations of three keys are also ignored when pressed at the same time.
Applications requiring three-key combinations (such as <Ctrl><Alt><Del>) must ensure that the three keys are not
wired in positions that define the vertices of a rectangle (Fig. 19). There is no limit on the number of keys that can be
pressed simultaneously as long as the keys do not generate ghost key events.
Figure 22 shows the original 3wire protocol of BU1852GUW. When this 3wire protocol is used, TW must be “1”. Note
that this 3wire interface is completely different from I
2
C and other standard bus interface.
Procedure
1. When BU1852GUW detects key events, XINT interrupt is generated to host with driving Low.
2. After the host detects XINT interrupt, the host is supposed to send start bit.
3. After BU1852GUW detects start bit, the 8bit data (key code) transmission on SDA will start synchronized with
the rising edge of SCL clock signal, which is sent from the host.
4. 8 bit data are followed by “0” (9
th
bit is always “0”), and then BU1852GUW drives High on XINT line.
See also section “3wire interface AC characteristics”.
No copying or reproduction of this document, in part or in whole, is permitted without the
consent of ROHM Co.,Ltd.
The content specied herein is subject to change for improvement without notice.
The content specied herein is for the purpose of introducing ROHM's products (hereinafter
"Products"). If you wish to use any such Product, please be sure to refer to the specications,
which can be obtained from ROHM upon request.
Examples of application circuits, circuit constants and any other information contained herein
illustrate the standard usage and operations of the Products. The peripheral conditions must
be taken into account when designing circuits for mass production.
Great care was taken in ensuring the accuracy of the information specied in this document.
However, should you incur any damage arising from any inaccuracy or misprint of such
information, ROHM shall bear no responsibility for such damage.
The technical information specied herein is intended only to show the typical functions of and
examples of application circuits for the Products. ROHM does not grant you, explicitly or
implicitly, any license to use or exercise intellectual property or other rights held by ROHM and
other parties. ROHM shall bear no responsibility whatsoever for any dispute arising from the
use of such technical information.
The Products specied in this document are intended to be used with general-use electronic
equipment or devices (such as audio visual equipment, ofce-automation equipment, communication devices, electronic appliances and amusement devices).
The Products specied in this document are not designed to be radiation tolerant.
While ROHM always makes effor ts to enhance the quality and reliability of its Products, a
Product may fail or malfunction for a variety of reasons.
Please be sure to implement in your equipment using the Products safety measures to guard
against the possibility of physical injur y, re or any other damage caused in the event of the
failure of any Product, such as derating, redundancy, re control and fail-safe designs. ROHM
shall bear no responsibility whatsoever for your use of any Product outside of the prescribed
scope or not in accordance with the instruction manual.
The Products are not designed or manufactured to be used with any equipment, device or
system which requires an extremely high level of reliability the failure or malfunction of which
may result in a direct threat to human life or create a risk of human injury (such as a medical
instrument, transportation equipment, aerospace machinery, nuclear-reactor controller, fuelcontroller or other safety device). ROHM shall bear no responsibility in any way for use of any
of the Products for the above special purposes. If a Product is intended to be used for any
such special purpose, please contact a ROHM sales representative before purchasing.
If you intend to export or ship overseas any Product or technology specied herein that may
be controlled under the Foreign Exchange and the Foreign Trade Law, you will be required to
obtain a license or permit under the Law.