67B Hall Effect Joystick I2C User Manual

67B Hall Effect Joystick I2C User Manual
rev. 1.4
67B Hall Effect Joystick
I2C User Manual
1 Introduction
The 67B joystick is a proportional output joystick which provides an X,Y coordinate (0-50) proportional to the
joystick location. The X,Y coordinates are read from the joystick via an I2C bus. Features include:
•
•
•
•
•
Proportional Joystick
I2C Interface (other interfaces available)
Low Operating Current (3 mA, max.@ VDD = 3.3V)
Low Power “Sleep Mode” (110 µA, max. @ VDD = 3.3V)
Push button and 3 Position Momentary (Rotary) Switch options available.
2 Hardware Interface
2.1
Connector - Two options are available – header or ribbon cable with connector.
A. Ribbon cable with Molex 14-56-2084 connector (Mates with Molex 70543 Series headers or
standard 0.100” pin headers with 0.025” sq. pins).
B. Header (1x8) – 0.10” centers with 0.025” sq. pins.
Pin #
1
2
3
4
5
6
7
8
Signal
VDD
SDA
I/O
I/O
INTn
PBn
A1
SCL
VSS
Out
Out
In
In
-
Description
Power Supply
I2C Data Line
Spare
Interrupt Out (Open Drain. Active Low)
Pushbutton Out (Open Drain – Active Low) if installed
A1 (LSB) of 7 bit I2C address
I2C Clock Line
Ground
Table 1- 67B Connector Signals
The 67B is an I2C (Slave) with 7 bit I2C address of 42h (A1n floating) or 40h (A1n tied to Gnd).
I2C speed: up to 400 KHz.
External pull-up resistors are required for I2C signals (SDA & SCL- See Sec 2.3 for recommended pull-up
resistors for I2C signals) , INTn and PBn (Recommended value 2K-10K). (See Figure 1)
INTn – Interrupt Out (Active Low) - Goes low only when a different X, Y value is available, or for units with a
switch option, if a switch position has changed. Reading the Y value causes INTn to go high (inactive). For
most efficient use of the I2C bus and processor resources it is recommended that the INTn signal be used to
trigger reading of the X, Y value from the joystick. If INTn is not used, X, Y values should be read
continuously at a rate of 50 samples/sec. An external pull-up resistor in the range of 2K - 10K (see Figure 1)
is required for INTn.
1
67B Hall Effect Joystick I2C User Manual
rev. 1.4
VDD
67B JOYSTICK
10K* Rp* Rp* 10K*
Hall
Effect
Sensor
VDD
I²C
Slave
PB
µC
(OPTION)
3 POS
MOM SW
(OPTION)
HOST CPU
SDA
INTn
PBn
A1
SCL
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
SDA
SCL
I²C
Master
INTn
PBn
A1
µC
SELECT I2C ADDRESS
JUMPER OUT = 42H
JUMPER IN = 40H
CCW
CW
* PULL-UP RESISTORS REQUIRED
Figure 1 - 67B Electrical Connection Diagram
2.2 Cable/PCB Trace Length
Cable/PCB Trace Length: Varies with I2C frequency. The I2C Spec. specifies a maximum capacitance per
signal line (SCL or SDA) of 400 pF. The bus capacitance is the total of wire, PCB traces and pins. The longer
the cable/PCB trace length the higher the bus capacitance and thus, the lower the operating frequency that
can be used.
2.3
Pull-up Resistors
2.3.1 I2C Signals (SCL, SDA) Pull-up Resistors
The two I2C signals (SDA & SCL) must be pulled up to the power supply voltage at the Host CPU. The pullup resistor value depends on the bus capacitance and SCL frequency. See Table 2 below for recommended
pull-up resistor values vs. SCL frequency and bus capacitance:
SCL Frequency
Standard Mode (100 KHz)
Fast Mode (400 KHz)
Rp recommended
Bus Load Capacitance
100 pF
200 pF
300 pF
400 pF
6.49KΩ
3.48KΩ
2.49KΩ
2KΩ
2.26KΩ
1.4KΩ
1.1KΩ
Table 2 - Recommended Pull-up Resistors for SCL, SDA vs. Frequency & Bus Capacitance
To determine if a proper pull-up value is being check the low and high voltage levels for SCL and SDA during
I2C bus activity. The signal levels should meet the following requirements with at least a 0.1V margin:
2
67B Hall Effect Joystick I2C User Manual
rev. 1.4
VL, MAX < 0.3 VDD
VH, MIN > 0.7 VDD
For more on choosing the I2C pull-up resistors see: Sec. 7.1 in I2C-bus specification and user manual, Rev.
03 (NXP UM10204).
2.3.2 INTn and Pushbutton (PBn) Pull-up Resistor
The pull-up for the INTn and Pushbutton (if installed) signals should be between 2K-10KΩ.
3 I2C Interface
The 67B joystick communicates over an I²C bus (2-wire bi-directional serial interface). The host CPU
(master) must initiate the data transfers, as the 67B is a slave device.
I²C address - The I²C address consists of 7 bits (D7-D1) and a bit (D0) indicating whether it is a Read (1) or
Write (0) cycle. The 67B is shipped from the factory with the 7-bit device I²C address of 42H (‘0100 001X’)
when A1 (pin 6) is left floating (not connected). The I²C address may be changed to 40H (‘0100 000X) by
pulling A1n to Gnd. If A1n is changed after power-up then a reset command needs to be sent to the joystick
to make active the new value (A1n is only read by the joystick after a power-up or reset command).
Changing the I2C address would be necessary if two 67B joysticks are connected to the same I2C bus or if
another component connected to the I2C bus shared the same I2C address. To request a custom I²C address
contact Grayhill.
.
SDA is a bi-directional signal and is used to read and write the serial data. The SCL signal is the clock
generated by the host CPU, to synchronize the SDA data in read and write mode. The maximum I²C clock
frequency is 400 KHz with data triggered on the rising edge of SCL.
Clock Stretching - Clock stretching occurs when a device on the bus holds the SCL line low effectively
pausing communication. The joystick (slave) may stretch the clock to allow more time to load data to be read
by the master device. It is important that the I2C Master interfacing with the 67B implement clock stretching
on a byte level for reliable operation with the joystick. See Sec 5.1.1 for more on clock stretching.
3.1
3.1.1
I2C Registers
X Register
Bit 7
X(7) sign
R
Bit 6
X(6) MSB
R
Bit 5
X(5)
R
Bit 4
X(4)
R
Bit 3
X(3)
R
Bit 2
X(2)
R
Bit 1
X(1)
R
Bit 0
X(0) LSB
R
Reset value: 0000 0000
• Bit7-0: X coordinate
X coordinate, 2’s complement format (signed –50 to +50).
Note: After every complete I2C transaction the register pointer in the joystick is set to point at the X register
so that X register value can be read without writing to register pointer (See Sec 3.2).
IMPORTANT: In order to keep X & Y values paired together or “in synch.”, X register data should be read in
an I2C sequence which reads both the X & Y registers as described in Sec. 3.2.1 and Figure 2.
3.1.2
Y Register
Bit 7
Y(7) sign
R
Bit 6
Y(6) MSB
R
Bit 5
Y(5)
R
Bit 4
Y(4)
R
Bit 3
Y(3)
R
Reset value: 0000 0000
3
Bit 2
Y(2)
R
Bit 1
Y(1)
R
Bit 0
Y(0) LSB
R
67B Hall Effect Joystick I2C User Manual
rev. 1.4
• Bit7-0: Y coordinate
Y coordinate, 2’s complement format (signed –50 to +50)
Reading the Y register will reset INTn output to Hi-Z.
The Y register should be read in a single I2C sequence that reads the X Register first immediately followed
by the Y register as described in Sec. 3.2.1 and Figure 2.
3.1.3
Error/Switch Register
Bit 7
Bit 6
PB
CCW
R
R
X = Do Not Care
Reset value: 0000 000X
Bit 5
CW
R
Bit 4
Com
R
Bit 3
WD
R
Bit 2
BOR
R
Bit 1
Ovr
R
Bit 0
Parity
R
When the Ext. Host (I2C Master) executes a 3 byte I2C read sequence the 3rd byte read is the Error/Switch
byte. This byte contains bits which indicate joystick errors and bits which indicate the switch positions (if
installed).
D0 – Parity – The joystick generates a parity bit for the 3 data bytes of the I2C message. Odd parity is used.
(Read Only)
D1 – Overrun (Ovr) – When this bit is set (1) indicates that X or Y data has changed before it was read. This
error indicates that the Ext. Host is not reading the data at a fast enough rate (up to 50 samples/sec.).
Reading the Error/Switch byte clears this bit. (Read Only).
D2 – (BOR) Brown-Out Reset indicator (1 = Brown Out occurred) Indicates that supply voltage dropped to
below brownout threshold voltage (2.7V) and caused a joystick reset . Cleared by reset of joystick. (Read
Only).
D3 - (WD) Watchdog Timer time out indicator (1 = time out occurred). Joystick internal program malfunction
caused a reset. Cleared by reset of joystick. (Read Only).
D4 – (Com) Internal Communication Error - When set (1) indicates that an internal comm. error occurred
when the joystick microcontroller tried to read or write to the Hall Sensor. Cleared by reset of joystick. (Read
Only).
D5 – Clockwise (CW) (if option installed) – The internal microcontroller reads the 3 Position Momentary
Switch and debounces the signal. When active (1) indicates the switch is in the Clockwise (CW) position. (if
option not installed – set to 0). (Read Only).
D6 – Counter-Clockwise (CCW) (if option installed) – The internal microcontroller reads the 3 Position
Momentary Switch and debounces the signal. When active (1) indicates the switch is in the Counter
Clockwise (CCW) position. (if option not installed – set to 0). (Read Only).
D7 – Pushbutton (PB) (if option installed) – The internal microcontroller reads the pushbutton and debounces
the signal. When active (1) indicates that the pushbutton has been pressed (if option not installed – set to 0).
(Read Only).
3.1.4
Bit 7
X
Control Register (76h)
Bit 6
X
Bit 5
X
Bit 4
X
Bit 3
X
Bit 2
X
Bit 1
Reset
W
Bit 0
X
X = Do Not Care
Reset value: 1001 1010 (9Ah)
Writing to this register with Reset (Bit 1) high resets joystick and sets all registers to default values. The
Reset bit is set low by the joystick after completing the reset sequence. Note: there is a start-up time (TP,W)
which must be observed after resetting the joystick.
4
67B Hall Effect Joystick I2C User Manual
rev. 1.4
I2C Read and Write Cycles
3.2
Read X, Y and Error/Switch Bytes – When INTn goes low there are new X & Y values available. To
read the three bytes the external I2C Master should perform a read sequence of 3 bytes without
providing a register address (Joystick always sends X register value followed by Y register value and
then the Error/Switch byte for any 3 byte read without a register address). INTn will go high (inactive)
at the beginning of the read of the Y value (see Figure 2).
3.2.1
I2C Start Command
41h or 43h (Joystick I2C Address with D0 set for read)
X Byte (Data from Joystick)
Y Byte (Data from Joystick)
Error/Switch Byte (Data from Joystick)
I2C Stop Command
Important Note: If a new X & Y value is available before the previous values are read the new values will
over-write the old (with the loss of the oldest values). However, in order to keep the X & Y values paired
together or “in sync”, it is important that the user read the X, Y and Error/Switch bytes in the a single I2C
sequence as shown in Figure 2. This is also the fastest and most efficient use of the I2C bus.
SCL
SDA
MSB
Start
I2C Address (42h)
R/W ACK
MSB
X Reg, Value
ACK
Y Reg, Value
ACK
PB CCW CW Com WD BOR Ovr Parity ACK
Error/Switch Byte
INTn
Figure 2 – Read X, Y & Error/Switch Bytes over I2C Bus
3.2.2
Reset Joystick – To reset the joystick the I2C Master should perform a write sequence of 1 byte and
must provide the register address for Control Reg. :
I2C Start Command
40h or 42h (Joystick I2C Address with D0 low for write)
76h (Register Address for Control Reg.)
9Ah (Data)
I2C Stop Command
Note: after sending the reset command the I2C Master must wait 300 ms before attempting to access
the 67B. At the end of the Nominal Startup Time (TP,W ) the 67B generates the first XY pair of values
and sets INTn low. Thereafter INTn goes low only if the X or Y value changes.
SCL
SDA
Start
I2C Address
R/W ACK
Control Reg, Value = 76h
ACK
Data = 9Ah
Figure 3 – Send Reset Command over I2C Bus
5
ACK
Stop
Stop
67B Hall Effect Joystick I2C User Manual
rev. 1.4
4 Power Modes & Sleep Threshold
4.1
Power-Up Sequence – During a power-up once the power supply voltage reaches 3.0V the user must
wait the Nominal Startup Time (TP,W ) before communicating with the joystick over the I2C bus (also
applies to a reset joystick command). At the end of the Nominal Wakeup Time the 67B generates the
first pair of XY values and sets INTn low. Thereafter INTn goes low only if the X or Y value changes or
for cases with a switch option, if a switch position has changed.
3 .3 V
3 .0 V
V DD
IN T n
T
P ,W
Figure 4 – Power-Up Sequence
4.2
Low Power (Sleep) Mode: When the joystick position is within a circle defined as the Sleep Zone for
ten consecutive measurements the joystick goes to the Low Power mode where power consumption is
significantly lower. The Sleep Zone typically extends to a joystick shaft angle of 5° from the center
(See Figure 6). The last XY value output before entering the Low Power mode is (0,0). As long as the
joystick remains within the Sleep Zone circle, it will remain in the Low Power Mode and INTn will stay
in the float state. Low Power (Sleep Mode) current may be higher if supply voltage drops below 2.0V.
4.3
Full Power Mode: When the joystick position is moved outside of the Low Power (Sleep) zone the
joystick switches to the Full Power Mode where an internal measurement occurs every 20 ms. If either
the X or Y value changes from the last values measured, the INTn output (Pin 5) is set low signaling
new X & Y values are ready to be read. INTn is cleared (Hi-Z) while the Y value is read. Power
consumption is higher in this mode.
6
67B Hall Effect Joystick I2C User Manual
rev. 1.4
+Y
(0,50)
(35,35)
45°
(-50,0)
+X
(50,0)
MAX JOYSTICK
OUTPUT
(0,-50)
- LOW POWER (SLEEP ZONE) - ALL VALUES (0,0)
Figure 5 - Sleep Zone & Max Output Circle
7
67B Hall Effect Joystick I2C User Manual
rev. 1.4
Figure 6 – Joystick Output Along X or Y Axis vs. Shaft Angle (Typical)
8
67B Hall Effect Joystick I2C User Manual
rev. 1.4
5 SPECIFICATIONS
NOTICE: Stresses above those listed under “Absolute Maximum Ratings may cause permanent damage to the device. This is a stress
rating only and functional operation of the device above those listed in the operation listings of this specification is not implied. Exposure
above maximum ratings conditions for extended periods may affect device reliability.
Table 3- Absolute Maximum Ratings (non operating)
Parameter
DC Supply Voltage
Sym.
VDD
Min
-0.3
Max
4.0
Unit
V
VIN
-0.3
Tstrg
-55
VDD + 0.3
25
+100
V
mA
°C
Voltage on all other pins with respect to Vss
Max current sunk by any I/O pin
Storage temperature
Note
Table 4 - Operating Conditions
Parameter
Sym.
Min
Typ
Max
Unit
DC Supply Voltage
VDD
3.0
3.3
3.6
V
High level input voltage
VIH
Low level input voltage
VIL
Leakage Current
IIL
Low level output voltage
Current Consumption, Full Power
mode (Average current VDD pin)
Current Consumption, Low Power
(sleep) mode (Average current VDD
pin)
Current Consumption (with Mom.
Turn Option) (Average current VDD
pin)
0.7 VDD
V
SCL, SDA
0.25 VDD
+ 0.8
V
A1
0.3 VDD
V
SCL, SDA
0.15 VDD
V
A1n
±125
nA
0.6
V
-
±5
VOL
2.5
3.0
mA
VDD = 3.30V, Note 1
IDD2
50
110
µA
VDD = 3.30V. Notes 1, 3
IDD3
4.0
6.0
mA
VDD = 3.30V. Notes 1, 5.
Operating temperature range
Sample
s/sec
50
Response Time (Full Power Mode)
Response Time (Low Power Mode)
Output with Joystick Released
(Center)
Low Power (Sleep) Threshold
Nominal Startup Time
VSS ≤ VPIN ≤ VDD, Pin at
high impedance at 85°C
INTn , SDA
IOL = 6mA, VDD = 3.30V
IDD1
Measurement Frequency, (Full
Power mode)
Output with Max. Joystick Deflection
Note
XMAX or
YMAX
XMIN, or
YMIN
20
80
ms
ms
±49
±50
±50
Units
-
0
0
Units
300
Deg.
ms
+85
°C
5
TP,W
Tamb
-40
Note 2
Note 2
Notes 4, 6
Note 1: Measured with SDA, SCL, INTn and PBn terminated with pull-up resistors (See Sec 2.3). Does not include
current in external pull-up resistors.
Note 2: Response time is the time from joystick movement to when new X,Y position data is available (INTn goes low).
Note 3: For VDD < 2.0V current will exceed 110 µA.
Note 4: Maximum values along X or Y axis in positive and negative directions.
Note 5: Full Power Mode Only (No sleep mode with 3 Pos. Mom. Sw Option).
9
67B Hall Effect Joystick I2C User Manual
rev. 1.4
Note 6: Positive value is for movement in the positive X or Y direction. Negative value is for movement in the negative X
or Y direction. Moving the joystick toward the cable will result in positive Y values.
5.1
I2C Bus Timing Requirements
THIGH
TF
TR
TLOW
SCL
THD:DAT
THD:STO
TSU:DAT
THD:STA
TSU:STO
SDA in
TBUF
TAA
TAA
SDA out
Figure 7 - I2C Bus Data Requirements
Table 5 - I2C Bus Data Requirements
Parameter
100 kHz mode
Start condition
Hold time
400 kHz mode
Stop condition
Setup time
400 kHz mode
Stop condition
Hold time
400 kHz mode
Clock high time
Clock low time
100 kHz mode
100 kHz mode
100 kHz mode
400 kHz mode
100 kHz mode
400 kHz mode
Sym.
T HD:STA
T SU:STO
T HD:STO
T HIGH
T LOW
Min
Typ
Max
4000
—
—
600
—
—
4700
—
—
600
—
—
4000
—
—
600
—
—
4.0
—
—
0.6
—
—
4.7
—
—
1.3
—
—
Unit
Note
ns
After this period, the first clock
pulse is generated
ns
ns
µs
µs
SDA and SCL rise
time
—
—
1000
400 kHz mode
TR
20 + 0.1CB
—
300
ns
CB is specified to be from
10-400 pF
SDA and SCL fall
time
100 kHz mode
400 kHz mode
TF
—
20 + 0.1CB
—
—
250
250
ns
CB is specified to be from
10-400 pF
Data input hold time
Data input setup
time
Output valid from
clock
Bus free time
SCL delay from
Clock Stretching
Bus capacitive loading
100 kHz mode
100 kHz mode
400 kHz mode
100 kHz mode
400 kHz mode
100 kHz mode
400 kHz mode
100 kHz mode
400 kHz mode
Full Power
Mode
Low Power
Mode
T HD:DAT
T SU:DAT
T AA
T BUF
0
—
—
ns
0
—
0.9
µs
250
—
—
ns
100
—
—
ns
—
—
3.5
µs
—
—
—
ns
4.7
—
—
1.3
—
—
—
20
—
—
45
—
—
—
400
T DEL
CB
10
(Note 2)
(Note 1)
µs
Time the bus must be free
before a new transmission
can start
µs
See Figure 8
pF
67B Hall Effect Joystick I2C User Manual
rev. 1.4
Note 1: As a transmitter, the device must provide this internal minimum delay time to bridge the undefined region (min.
300 ns) of the falling edge of SCL to avoid unintended generation of Start or Stop conditions.
Note 2: A Fast mode (400 kHz) I2C bus device can be used in a Standard mode (100 kHz) I2C bus system, but the
requirement TSU:DAT ≥ 250 ns must then be met. This will automatically be the case if the device does not stretch the low
period of the SCL signal. If such a device does stretch the low period of the SCL signal, it must output the next data bit to
the SDA line TR max. + TSU:DAT = 1000 + 250 = 1250 ns (according to the Standard mode I2C bus specification), before
the SCL line is released.
5.1.1 Clock Stretching
As mentioned previously the I2C Master that interfaces with the joystick must be capable of clock stretching
on a byte level. The joystick is able to transmit a byte of data at a fast rate, but may need more time to
prepare the next byte to be transmitted. The joystick (slave) holds the SCL line LOW after transmission and
acknowledgment of a byte to force the master into a wait state until the slave is ready for the next byte
transfer in a type of handshake procedure (See Figure 8 below). See I2C Spec. UM10204, Rev. 3, Sec. 3.9
for more on clock stretching.
TDEL
SCL
SDA
Start
I2C Address or Data
ACK
Data
Figure 8 – Clock Stretching by Joystick
Revision History
Date
Rev
06/20/13
09/18/13
1.0
1.1
Name Description of Changes
SAK
SAK
09/24/13
1.2
SAK
12/10/13
02/17/14
1.3
1.4
SAK
SAK
Initial Version
In Table 4 Changed Operating Temp to be one operating temp for all versions (-40 to
+85 °C).
Added Figure 6 (Angle v Output graph).
In Table 4 added current (IDD3) for joystick with 3 Pos. Mom. Sw. option.
In Table 4 added current spec for 5V version of joystick with 3 Position Momentary
Switch option.
In Sec 3.1.1 and 3.1.2 changed X & Y value range to 50 (was 40).
In Table 4 added Typ. & Max current for 3.3V joystick with 3 Position Mom. Sw. (IDD2).
In Table 4 added new Note 1 and changed old Note 1 to Note 6.
Removed all references to 5V unit.
11