SPICoder® SA01 UR5HCSPI-SA01 Very Low-Power Keyboard Encoder and Power Management IC for H/PCs HID & SYSTEM MANAGEMENT PRODUCTS, KEYCODER® FAMILY The SPICoder® SA01 UR5HCSPI-SA01, a member of Semtech’s KeyCoder® product family, is a keyboard encoder and power management IC designed specifically for handheld PCs (H/PCs), web phones and other systems that run Microsoft® Windows® CE and utilize the Intel StrongARM™ processor. The SPICoder® SA01 offers several features necessary to H/PCs, including extremely low power consumption, real estatesaving size, and special keyboard modes. The IC consumes an extremely small amount of power (less than 2 µA at 3 V) and provides the host system both power management and I/O flexibility, with minimal battery drainage. FEATURES • SPI-compatible keyboard encoder and power management IC • Ideal for use with the Intel StrongARM™ processor • Patented technology for extremely low power consumption — typically less than 2 µA between 3-5 V • Offers overall system power management capabilities • Available in low-profile QFP package • Implements high-reliability twoway protocol • Fully compatible with the Windows® CE keyboard specification • Works in harmony with the power management modes of Windows® CE • Provides special modes of operation for H/PCs, including programmable “wake-up” keys • Scans an 8 x 14 matrix; controls discrete switches and LED indicators • Compatible with “system-on silicon” CPUs for H/PCs APPLICATIONS • StrongARM™ handheld PCs • Windows® CE platforms • Web phones • Personal digital assistants (PDAs) • Wearable computers • Internet appliances PIN ASSIGNMENTS _ATN _SS SCK MOSI MISO XSW SW0 C8 C9 C10/WUKO C11 DESCRIPTION PRELIMINARY Special keyboard modes and builtin power management features allow the SPICoder® SA01 to operate in harmony with the power management modes of Windows® CE, resulting in greater user flexibility, and longer battery life. PWR_OK NC0 OSCO OSCI Vcc NC NC _RESET _WKU Vx C7 The IC scans, debounces and encodes an 8 x 14 keyboard matrix. It communicates with the host over the SPI channel, implementing a high-reliability twoway protocol. The SPICoder® SA01 also offers programmable features for wake-up keys and general purpose I/O pins. 33 34 23 22 QFP 12 11 1 C6 C5 C4 C3 C2 C1 C0 R0 R1 R2 R3 44 UR5HCSPI-SA01-FB 44-pin QFP (0.80 mm pitch (10x10 mm) Semtech, SPICoder, and KeyCoder are registered trademarks of Semtech Corporation. Self-Power Management is a trademark of Semtech Corporation. All other trademarks belong to their respective companies. Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 1 www.semtech.com NC C12 C13 GIO0 _IOTEST Vss NC R7 R6 R5 R4 ORDERING CODE Package options 44-pin plastic QFP Pitch 0.8 mm TA = -40°C to +85°C UR5HCSPI-SA01-FB BLOCK DIAGRAM MISO R0-R8 MOSI SCK SS SPI Communication Channel Keyboard Scanner ATN GIO0 Keyboard Matrix & Keyboard State Control C0-C13 Programmable I/O PWR_OK WKUP IOTEST WKU System Monitor Input Signals Power Management Unit WUKO Wake-Up Keys Only Signal XSW Switch External to Case SWO Switch UR5HCSPI-SA01 Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 2 www.semtech.com FUNCTIONAL DESCRIPTION The SPICoder® SA01 consists functionally of five major sections (see the block diagram). These are the Keyboard Scanner and State control, the Programmable I/O, the SPI Communication Channel, the System Monitor and the Power Management unit. All sections communicate with each other and operate concurrently. PIN DEFINITIONS Mnemonic VCC VSS VX OSCI OSCO _RESET QFP 38 17 43 37 36 41 Type I I I I O I Name and Function Power supply: 3-5V Ground Tie VX to VCC Oscillator input Oscillator output Reset: apply 0V to provide orderly start-up MISO MOSI SCK _SS 29 30 31 32 O I I I SPI interface signals _IOTEST _WKU 18 42 O I Wake-up control signals Slave Select: If not used tie to VSS R0-R4 R5-R7 8-12 13-15 I I Row data inputs Port provides internal pull-up resistors C0-C5 C6-C7 C8-C9 C11 C12 C13 7-2 1,44 26-25 23 21 20 O O O O O O Column select outputs C10/WUKO 24 Multi-function pin I/O C10 & “Wake-Up Keys Only” input GI00 XSW SWO 19 28 27 Miscellaneous functions I/O General programmable I/O I External discrete switch I Discrete switch _ATN PWR_OK 33 34 O I NC NC0 16, 22 39, 40 35 Power management pins CPU attention output Power OK input No Connects: these pins are unused NC0 should be tied to VSS or GND Note: An underscore before a pin mnemonic denotes an active low signal. Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 3 www.semtech.com PIN DESCRIPTIONS VCC and VSS MOSI, MISO, SCK, _SS, _ATN C0 to C9 and C11 VCC and VSS are the power supply and ground pins. The SPICoder® SA01 operates from a 3-5 Volt power supply. To prevent noise problems, provide bypass capacitors placed as close as possible to the IC with the power supply. VX, where available, should be tied to Vcc. These five signals implement the SPI interface. The device acts as a slave on the SPI bus. The _SS (Slave Select) pin must go high between successive characters in an SPI message or a write collision error results. The _ATN pin is asserted low each time the SPICoder® SA01 has a packet ready for delivery. For a more detailed description, refer to the SPI Communication Channel section of this document. Pins C0 to C9 are bi-directional pins and are connected to the columns of the scanned matrix. When a column is selected, the pin outputs an active low signal. When the column is de-selected, the pin turns into high-impedance. OSCI and OSCO OSCI and OSCO provide the input and output connections for the onchip oscillator. The oscillator can be driven by any of the following circuits: - Crystal - Ceramic resonator - External clock signal The frequency of the on-chip oscillator is 2.00 MHz. _RESET A logic zero on the _RESET pin forces the SPICoder® SA01 into a known start-up state. The reset signal can be supplied by any of the following circuits: _IOTEST and _WKU The_IOTEST and _WKU pins (“Input Output Test” and “Wake Up”) pins control the stop mode exit of the device. The designer can connect any number of active low signals to these two pins through a 15 KΩ resistor, in order to force the device to exit the stop mode. A sample circuit is included in this document. All the signals are “wire-anded.” When any one of these signals is not active, it should be floating (i.e., these signals should be driven from “open-collector” or “open-drain” outputs). C10 / WUKO The C10 / WUKO pin acts alternatively as column scan output and as an input. As an input, the pin detects the “Wake-Up Keys Only” signal, typically provided by the host CPU to indicate that the user has turned the unit off. When the device detects an active high state on this pin, it feeds this information into the “Keyboard State Control” unit, in order to disable the keyboard and enable the programmed wake-up keys. To achieve maximum power savings, the resistor connected to WUKO can be as large as 1.5 MΩ. R0 - R7 - Resistor/capacitor - Voltage monitor - Master system reset Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 The R0-R7 pins are connected to the rows of the scanned matrix. Each pin provides an internal pullup resistor, eliminating the need for external components. 4 www.semtech.com PIN DESCRIPTIONS (CONT’D) THE WINDOWS® CE KEYBOARD C12 and C13 The following illustration shows a typical implementation of a Windows® CE keyboard. C12 and C13 are used as additional column pins in order to accommodate larger-size keyboards, such as the Fujitsu FKB1406 palmtop keyboard. power GIO0 GIO0 is a programmable input/output switch or LED pin; it can also be used as a wake-up signal. Its programming is explained in the General Purpose I/O Pin section of this document. XSW The SW0 pin is a dedicated input pin for a switch. PWR_OK The PWR_OK is an active low pin that monitors the battery status of the unit. When the SPICoder® SA01 detects a transition from high to low on this pin, it immediately enters the STOP mode, turns the LED off, and remains in this state until the batteries of the unit are replaced and the signal is deasserted. Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) - ~ ` Q W E R T Y U I O P =+ tab shift ctrl A S Z F D X C G V alt J H B N K M ; : L , < . > [{ ]} \ | ' " / ? enter shift Windows® CE does not support the following keyboard keys typically found on desktop and laptop keyboards: The XSW pin is dedicated to an external switch. This pin is handled differently than the rest of the switch matrix and is intended to be connected to a switch physically located on the outside of the unit. SW0 _ esc INSERT SCROLL LOCK PAUSE NUM LOCK Function Keys (F1-F12) PRINT SCREEN If the keyboard implements the Windows key, the following key combinations are supported in the Windows® CE environment: Key Combination Result Windows Windows+K Windows+I Windows+C Windows+E Windows+R Windows+H Ctrl+Windows+A Open Start Menu Open Keyboard Tool Open Stylus Tool Open Control Panel Explore the H/PC Display the Run Dialog Box Open Windows® CE Help Select all on desktop 5 www.semtech.com “GHOST” KEYS KEYBOARD SCANNER In any scanned contact switch matrix, whenever three keys defining a rectangle on the switch matrix are pressed at the same time, a fourth key positioned on the fourth corner of the rectangle is sensed as being pressed. This is known as the “ghost” or “phantom” key problem. The encoder scans a keyboard organized as an 8 row by 14 column matrix for a maximum of 112 keys. Smaller size matrixes can be accommodated by simply leaving unused pins open. The SPICoder® SA01 provides internal pull-ups for the row input pins. When active, the encoder selects one of the column lines (C0-C13) every 512 µs and then reads the row data lines (R0-R7). A key closure is detected as a zero in the corresponding position of the matrix. Actual key presses A complete scan cycle for the entire keyboard takes approximately 9.2 ms. Each key found pressed is debounced for a period of 20 ms. Once the key is verified, the corresponding key code(s) are loaded into the transmit buffer of the SPI communication channel. KEYBOARD SCANNING “Ghost” Key Figure 1: “Ghost” or “Phantom” Key Problem Although the problem cannot be totally eliminated without using external hardware, there are methods to neutralize its negative effects for most practical applications. Keys that are intended to be used in combinations should be placed in the same row or column of the matrix, whenever possible. Shift keys (Shift, Alt, Ctrl, Windows) should not reside in the same row (or column) as any other keys. The SPICoder® SA01 has built-in mechanisms to detect the presence of “ghost” keys. Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 N-Key Rollover In this mode, the code(s) corresponding to each key press are transmitted to the host system as soon as that key is debounced, independent of the release of other keys. When a key is released, the corresponding break code is transmitted to the host system. Several keys can be held pressed at the same time. However, two or more key closures, occurring within a time interval of less than 5 ms, raise an error flag and are not processed. This feature iprotects against the effects of accidental key presses. 6 www.semtech.com KEYBOARD STATES ND 1) A KO= ress) U (W ey P (K et Res Soft Send Wake-Up Keys Only (PW AND R_OK = AND (WUK0 1) =0 (Key Pres ) s) Send All Keys PWR _OK PWR_OK Send No Keys (PWR_OK = 1) AND (Key Press) Figure 2: The SPICoder® SA01 implements three modes of keyboard and switch operation These states of operation refer only to the keyboard functionality and, although they are related to power states, they are also independent of them. "Send All Keys" Entry Conditions: Power on reset, soft reset, PWR_OK =1, {(WUKO=0)} Exit Conditions: PWR_OK = 0 -> "Send No Keys"(WUKO=1) AND (Key Press) -> "Send Wake-Up Keys Only"(LID = 0) AND (WUKO=0) AND (Key Press) -> "Send XSW Key Only" Description: This is the SPICoder® SA01’s normal state of operation, accepting and transmitting every key press to the system. This state is entered after the user powers on the unit and it is sustained while the unit is being used. “Send Wake-Up Keys Only” Entry Conditions:(WUKO=1) AND (Key or Switch press) Exit Conditions: Soft Reset -> “Send All Keys”PWR_OK = 0 -> “Send No Keys” Description:This state is entered when the user turns the unit off. A signal line driven by the host notifies the SPICoder® SA01 about this state transition. While in this state, the SPICoder® SA01 transmits only keys programmed to be wake-up keys to the system. It is not necessary for the SPICoder® SA01 to detect this transition in real time, since it does not affect any operation besides buffering keystrokes. “Send No Keys" Entry Conditions:PWR_OK transition from high to low Exit Conditions: (PWR_OK = 1) AND (Matrix key pressed OR Switch OR _WKUP) Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 7 Description: This state is entered when a PWR_OK signal is asserted (transition high to low), indicating a critically low level of battery voltage. The PWR_OK signal causes an interrupt to the SPICoder® SA01, which guarantees that the transition is performed in real time. In this state, the SPICoder® SA01 performs as follows: 1. The LED is turned off. Nevertheless, its state is saved and restored after exiting the disabled state (change of batteries). 2. The SPICoder® SA01 enters the STOP mode for maximum energy conservation. 3 Stop mode time-out entry is shortened to conserve energy further. 4. In this state all interrupts are disabled. The SPICoder® SA01 exits this state on the next interrupt event that detects the PWR_OK line has been de-asserted. www.semtech.com KEY MAP FOR THE FUJITSU FKB1406 (SPICODER® SA01) 0 1 LAlt ` 0 2 \ Columns (C0–C13) 6 7 8 3 4 5 LCtrl FN Esc LSft 1 F1 2 F2 T Del 9 F9 Y 9 10 11 12 0 F10 U Pad 4 NmLk I Pad 5 + Bk Enter 13 BkSp RShift PgDn Rows (R0–R6) 1 TAB Q W Z CapLk E R O Pad 6 P Ins [ Pause ] ScrLk K Pad 2 L Pad 3 ; PrtScr ‘ SysReq PgUp G H J Pad 1 / / Home Spc 2 3 A S D F 4 X C V B N Pad 0 M , . 3 F3 4 F4 5 F5 6 F6 7 F7 8 F8 Prog 5 6 End KEYBOARD LAYOUT FOR THE FUJITSU FKB1406 Esc @ # $ % ^ & 1 F2 2 F2 3 F3 4 F4 5 F5 6 F6 7 F7 Q Del 7 ! Cap Lock Fn Shift Ctrl Alt W A E S R D Z X ~ ` : ; Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 T F C V B 8 ( 8 F8 U4 Y G * H N J 9 9 F9 I5 1 M0 ) _ + - Num = Bk Lk * 0 F10 O6 < , .. > Home 8 : ; ] [ Pause Ins K2 L3 } { _ P + " Prt Scr ' ? / / PgUp www.semtech.com Sys Req Prog Scr Lk Enter Shift PgDn End KEY CODES GENERAL PURPOSE I/O PIN Key codes range from 0x01 to 0x73 and are arranged as follows: The SPICoder® SA01 provides a general purpose I/O pin, GIO0, that can be programmed as Input, Output, Debounced Switch Input or LED Output. The programmable I/O pin can be configured to the desired mode through a command from the system. After the I/O pin is configured, the host system can read or write data to it. If the pin is configured as a Debounced Switch, it returns scan codes. Make code = column_number * 8 + row_number + 1 Break code = Make code OR 0x80 For Pin GIO0: Discrete Switches transmit the following codes: I/O Number = 0 LED Number = 0 XSW = 0x71 SW0 = 0x72 Input Mode GIO0 = 0x73 While in the Input Mode, the GIO0 pin detects input signals and reports the input status to system as required. Output Mode In the Output Mode, the SPICoder® SA01 controls the output signal level according to the system command. When the pin is set at Output Mode, the default output is low. Switch Input Mode In Switch Input Mode, the SPICoder® SA01 generates an individual make key code when the switch closes (pin goes low), and a break key code when the switch returns to open (pin goes to high). The switches generate key codes outside of those generated by the key matrix, from 0x71 - 0x73. When the switch is closed, the SPICoder® SA01 does not fall asleep. Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 9 www.semtech.com PIN CONFIGURATIONS LED MODES When prototyping, caution should be taken to ensure that programming of the GIO0 pin does not conflict with the circuit implemented. A series protection resistor is recommended for protection from improper programming of the pin. After a power-on or soft reset, GIO0 defaults to the Input state. The following drawing illustrates the suggested interface to the general purpose input/output pin. Input Output GIX GIX Circuit determined by the specific application Series protection resistor Circuit determined by the specific application Switch 1 2 on on off 3 meta blink count on on off off interval on interval on off meta blink off 1 blinking cycle Figure 4: Timing chart: the behavior of an LED using the settings,1: LED on; 0: LED off There are three LED modes: off, on, and blinking. The LED can be individually set to one of these modes. In the Blinking Mode, both the oninterval and the off-interval can be individually set. Additionally, a meta blink count and meta blink interval may be specified. This describes an interval of a different length which may be inserted after each specified number of blinks. All intervals are multiples of 1/16th of a second. When the LED is on or blinking, the SPICoder® SA01 does not enter the STOP Mode unless the PWR_OK signal is asserted low; in this case, the device saves the status of the LED and turns it off. The default LED mode is off. The above timing chart describes the behavior of an LED using these settings,1: LED on; 0: LED off. 150K _WKU LED GIX _IOTEST 15K GIX Wake-up interrupt generating switch Figure 3: Suggested interface of general purpose input/output pin Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 10 www.semtech.com SPI COMMUNICATION CHANNEL SPI data transfers can be performed at a maximum clock rate of 500 kHz. When the SPICoder® SA01 asserts the _ATN signal to the host master, the data is already loaded into the data register waiting for the clocks from the master. One _ATN signal is used per each byte transfer. If the host fails to provide clock signals for successive bytes in the data packet within 120 ms, the transmission is aborted and a new session is initiated by asserting a new _ATN signal. In such a case, the whole packet is re-transmitted. If the SPI transmission fails 20 times consecutively, the synchronization between the master and slave may be lost. In this case, the SPICoder® SA01 enters the reset state. When CPHA = 0, the shift clock is the OR of _SS with SCK; therefore, _SS must go high between successive characters in an SPI message. The master can assert _SS low only when it is getting ready to transmit or receive. After the last bit is shifted out, _SS must go high within 60 µs. The SPICoder® SA01 implements the SPI communication protocol according to the following diagram: CPOL = 0 ---------- SCK line idles in low state CPHA = 0 ---------- SS line is an output enable control tATN :SA T SCK _ATN SCK (CPOL=0) tSS :HD _SS Sample Input Data Output (CPHA=0) ? MSB BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 LSB Not to Scale Figure 5: SPI Communication Protocol When the host sends commands to the keyboard, the SPICoder® SA01 requires that the minimum and maximum intervals between two successive bytes be 200 µs and 5 ms respectively. _ATN _SS SCK MISO Not to Scale Figure 6: Transmitting Data Waveforms tWKUP _WKUP _SS tIB tSCK:SA _SCK MOSI MISO Not to Scale Figure 7: Receiving Data Waveforms Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 11 www.semtech.com DATA / COMMAND BUFFER SPI COMMUNICATION TABLE The SPICoder® SA01 implements a data buffer that contains the key code/command bytes waiting to be transmitted to the host. If the data buffer is full, the whole buffer is cleared and an "Initialize" command is sent to the host. At the same time, the keyboard is disabled until the "Initialize" or "Initialize Complete" command from the host is received. The following table describes the specific timing referenced in the timing diagrams. Signal Name tATN:SA _ TSCK tSS:HD tWKUP tSCK:SA tIB Description ATN to first clock pulse Clock period Last clock pulse to _SS de-assertion _WKUP pulse width _WKUP to first clock pulse Inter-byte period Min 2 125 5 0.2 Max 120 60 150 5 Units ms µs µs ns ms ms POWER MANAGEMENT UNIT The SPICoder® SA01 supports two modes of operation. The following table lists the typical and maximum supply current (no DC loads) for each mode at 3.3 Volts (+/-10%). Current RUN Typical 1.5 1 Max 3.0 Unit mA STOP 2.0 20 µA Description Entered only while data/commands are in process and if the LEDs are blinking Entered after 125 ms of inactivity if LEDs are low Power consumption of the keyboard sub-system is determined primarily by the use of the LEDs. While the SPICoder® SA01 is in the STOP mode, an active low wake-up output from the master must be connected to the edge-sensitive _WKU pin of the SPICoder® SA01. This signal wakes up the SPICoder® SA01 in order to receive data from the master host. The master host must wait a minimum of 5 ms prior to providing clocks to the SPICoder® SA01. The SPICoder® SA01 enters the STOP mode after a 125 ms period of keypad and/or host communications inactivity, or anytime the PWR_OK line is asserted low by the host. Note that while one or more keys are held pressed, the SPICoder® SA01 does not enter the STOP mode until every key is released. - Keyboard Switch Input transaction System wake-up Stop Run After reset or 125 ms of inactivity While processing current task and/or LED(s) are active - After 125 ms of inactivity and LEDs are off Figure 8: Power states of the SPICoder® SA01 Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 12 www.semtech.com COMMUNICATION PROTOCOL There are eight commands that may be sent from the SPICoder® SA01 to the host, and ten commands that may be sent from the host to the SPICoder® SA01. Each command from SPICoder® SA01 to the host is composed of a sequence of codes. All commands start with <CONTROL> code (0x80) and end with LRC code (see the description of the LRC calculation on page 14). Command details are listed below. Commands to the Host - Summary Command Name Code Initialize Request 0xAO Initialize Complete 0xA1 Heartbeat Response 0xA2 Identification Response 0xF2 LED Status Report 0xA3 Resend Request 0xA5 Input/Output Mode Status Report 0xA7 Input/Output Data Report 0xA8 Description Sent to the host when the data buffer is full Issued upon completion of the “Initialize” command issued by the host Response to “Heartbeat Request” issued by the host Response to “Identification Request” issued by the host Response to “LED Status Request” Issued upon error during the reception of a packet Reports the status of GIO0 pin Response to “I/O Data Request” command from the host LRC CALCULATION COMMANDS TO THE HOST ANALYTICALLY The LRC byte is calculated for the whole message packet, including the Command Code and the Command Prefix. The LRC is calculated by first taking the bitwise exclusive OR of all bytes from the message. If the most significant bit (MSB) of the LRC is set, the LRC is modified by clearing the MSB and changing the state of the next most significant bit. Thus, the packet check byte can never consist of a valid LRC with the most significant bit set. Initialize Request <CONTROL> <INIT> <LRC> 0x80 0xA0 0x20 The SPICoder® SA01 sends the Initialize Request Command to the host when its data buffer is full. Initialization Complete <CONTROL> <INIT COMPLETE> <LRC> 0x80 0xA1 0x21 The SPICoder® SA01 sends the Initialize Complete Report to the host when it finishes the initialization caused by Initialize Command from the host. Heartbeat Response <CONTROL> <ONLINE> <LRC> 0x80 0xA2 0x22 The SPICoder® SA01 sends the Heartbeat Response to the host when it receives the Heartbeat Request Command from the host. Identification Response <CONTROL> <ID> <Vendor> <Revision> <Switch> <LRC> 0x80 0xF2 0x02 0x08 0x00 0x7E --- Semtech --- Rev 0.8A . The SPICoder® SA01 sends the Identification Response to the host when it receives the Identification Request Command from the host. Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 13 www.semtech.com LRC CALCULATION, (CONT’D) COMMANDS TO THE HOST FROM THE SPICODER® SA01 The following C language function is an example of an LRC calculation program. It accepts two arguments: a pointer to a buffer and a buffer length. Its return value is the LRC value for the specified buffer. LED Status Report <CONTROL> <LED> <Status 0> 0x80 0xA3 0xnn <Status 1> 0xnn <Status 2> 0xnn <LRC> 0xnn char Calculate LRC (char buffer, size buffer) { char LRC; size_t index; /* * Init the LRC using the first two message bytes. */ LRC = buffer [0] ^ buffer [1]; /* * Update the LRC using the remainder of the buffer. */ for (index = 2; index < buffer; index ++) LRC ^ = buffer[index]; /* * If the MSB is set then clear the MSB and change the next most significant bit */ if (LRC & 0x80) LRC ^ = 0xC0; /* * Return the LRC value for the buffer.*/} LED0 status:( 0=OFF; 1=ON; 2=BLINKING; 3=NO LED MODE ) LED1 status:( 0=OFF; 1=ON; 2=BLINKING; 3=NO LED MODE ) LED2 status:( 0=OFF; 1=ON; 2=BLINKING; 3=NO LED MODE) The SPICoder® SA01 sends the LED Status Report to the host when it receives the LED Status Request Command from the host. Resend Request <CONTROL> <RESEND> <LRC> 0x80 0xA5 0x25 The SPICoder® SA01 sends this Resend Request Command to the host when its command buffer is full, or if it detects either a parity error or an unknown command during a system command transmission. Input/Output Mode Status Report <CONTROL> 0x80 <MODIO> 0xA7 <IO NUMBER> 0xnn IO number, 0 <IO MODE> 0xnn IO mode: (0=input; 1=output; 2=switch; 3=LED ) <LRC> 0xnn The SPICoder® SA01 sends the I/O Mode Status Report to the host when it receives the I/O Mode Status Request Command from the host, in order to report the status of the GIO0 pin. Input/Output Data Report <CONTROL> 0x80 <MODIO> 0xA8 <IO NUMBER> 0xnn <IO DATA> 0xnn <LRC> 0xnn IO number, 0 IO data: ( 0=low, 1=high ) The SPICoder® SA01 sends the I/O Data Report to the host when it receives the I/O Data Request Command from the host. Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 14 www.semtech.com COMMANDS FROM THE HOST TO THE SPICODER® SA01 Each command to SPICoder® SA01 is composed of a sequence of codes. All commands start with <ESC> code (1BH) and end with the LRC code (bitwise exclusive OR of all bytes). Commands from the host - summary Command name Code Initialize 0xAO Initialization Complete 0xA1 Heartbeat Request 0xA2 Identification Request 0xF2 LED Status Request 0xA3 LED Modify 0xA6 Resend Request 0xA5 Input/Output Mode Modify 0xA7 Output Data to I/O pin 0xA8 Set Wake-Up Keys 0xA9 Description Causes the SPICoder® SA01 to enter the power-on state Issued as a response to the “Initialize Request” The SPICoder® SA01 responds with “Heartbeat Response” The SPICoder® SA01 responds with “Identification Response” The SPICoder® SA01 responds with “LED Status Response” The SPICoder® SA01 changes the LED accordingly Issued upon error during the reception of a packet The SPICoder® SA01 modifies or report the status of the GIO0 pin The SPICoder® SA01 outputs a signal to the GIO0 pin Defines which keys are “wake-up” keys COMMANDS FROM THE HOST TO THE SPICODER® SA01 ANALYTICALLY Initialize <ESC> <INIT> <LRC> 0x1B 0xA0 0x7B When the SPICoder® SA01 receives this command, it clears all buffers and returns to the power-on state. Initialization Complete <ESC> <INIT COMPLETE> <LRC> 0x1B 0xA1 0x7A When the SPICoder® SA01 receives this command, it enables transmission of keyboard data. Keyboard data transmission is disabled if the TX output buffer is full (32 bytes). Note that if the transmit data buffer gets full the encoder issues an "Initialize Request" to the host. Heartbeat Request <ESC> <ONLINE> <LRC> 0x1B 0xA2 0x79 When the SPICoder® SA01 receives this command, it replies with the Heartbeat Response Report. Identification Request <ESC> <ID> <LRC> 0x1B 0xF2 0x29 The SPICoder® SA01 replies to this command with the Identification Response Report. LED Status Request <ESC> <LED> <LRC> 0x1B 0xA3 0x78 When SPICoder® SA01 receives this command, it replies with the LED Status Report. Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 15 www.semtech.com COMMANDS FROM THE HOST TO THE SPICODER® SA01 (CONT’D) Set Wake-Up Keys <ESC> 0x1B <SETMATRIX> 0xA9 <COL0> 0xnn (R7 R6 R5 R4 R3 R2 R1 R0 Bitmap: 0-enabled 1-disabled) <COL1> 0xnn <COL2> 0xnn <COL3> 0xnn <COL4> 0xnn <COL5> 0xnn <COL6> 0xnn <COL7> 0xnn <COL8> 0xnn <COL9> 0xnn <COL10> 0xnn <COL11> 0xnn <COL12>* 0xnn <COL13>* 0xnn <SWITCHES> 0xnn (where SWITCHES bit assignments are = x x x x GIO0 SW0 XSW) <LRC> 0xnn The "Set Wake-Up Keys" command is used to disable specific keys from waking up the host. Using this command, the host can set only a group of keys to act as "power-on" switches. The host can change the keyboard behavior dynamically according to the system power management requirements. The default after power on is “All Keys Enabled.” LED Modify <ESC> <MODLED> <LED NUMBER> <LED STATE> 0x1B 0xA6 0xnn 0xnn <ON INTERVAL> 0xnn <OFF INTERVAL> 0xnn <META COUNT> 0xnn <META INTERVAL> 0xnn <LRC> 0xnn LED number (0) (0=LED OFF; 1=LED ON; 2=LED BLINKING) Time in 1/16ths of a second for LED to be on Time in 1/16ths of a second for LED to be off Number of blinks after which to apply meta blink interval Time in 1/16ths of a second for LED to be off after <META COUNT> blinks When the SPICoder® SA01 receives this command, it changes the LED mode accordingly. I/O Mode Modify <ESC> <MODIO> <IO NUMBER> <IO MODE> <LRC> 0x1B 0xA7 0xnn 0xnn IO number: 0 IO mode: ( 0=input, 1=output, 2=switch, 3=LED, 4=current mode request) 0xnn When the SPICoder® SA01 receives this command, it changes the I/O pin's mode accordingly. If the <IO MODE> =4, the SPICoder® SA01 sends the I/O Mode Status Report to the host. Output Data to I/O Pin <ESC> <MODIO> <IO NUMBER> <IO DATA> <LRC> 0x1B 0xA8 0xnn 0xnn IO number: 0 IO data: ( 0=low, 1=high, 2=current I/O data request) 0xnn When the SPICoder® SA01 receives this command, it changes the value of the output pin accordingly. If the addressed pin is not configured as an output pin, the command is ignored. If <IO DATA> =2, the SPICoder® SA01 responds by issuing the I/O Data Status Report to the host. Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 16 www.semtech.com Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 17 _WKUP 15KΩ 150KΩ GND NC0 VSS PWR_OK ATN WKU IOTEST OSCO 2MHz 1MOhm R7 R6 R5 R4 R3 R2 R1 R0 XSW SW0 GIO0 C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 C10/WUKO C11 C12 C13 UR5HCSPI-SA01-FB Ceramic resonator circuit with built in capacitors Alternatively a 2MHz CMOS signal can be tied directly to OSCI 35 17 Power OK Signal 34 33 SS SCK RESET PWR_OK Attention Signal 32 31 MOSI VDD VX _ATN _SS SCK Vin MISO 41 30 Vout MOSI 29 38 43 MISO Reset IC For 5V operation: TC54C4302ECB (Microchip) For 3V operation: TC54C2702ECB (Microchip) (Alternatively, a resistor-capacitor circuit or a master reset signal can be used) VCC 28 27 19 7 6 5 4 3 2 1 44 26 25 24 23 21 20 15 14 13 12 11 10 9 8 www.semtech.com 15KΩ 15KΩ 1.5MΩ DISCRETE SWITCHES COLUMN OUTPUTS WUKO TO SWITCH MATRIX ROW INPUTS SAMPLE CONFIGURATION UR5HCSPI-SA01 42 18 OSCI 37 36 Power OK Signal Wake Up Signal BILL OF MATERIALS FOR UR5HCSPI-SA01-FB SAMPLE SCHEMATIC Quantity 3 1 1 2 1 1 Manufacture Generic Generic Generic Generic Microchip AVX Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 Part# N/A N/A N/A N/A TC54VC4302ECB TC54VC2702ECB PBRC-2.00BR 18 Description 15 KΩ resistors 150 KΩ resistor 1 MΩ resistor 1.5 Ω resistors IC volt detector CMOS 4.3 V SOT23, for 5 V operation IC volt detector CMOS 2.7 V SOT23, for 3.3 V operation 2.00 MHz ceramic resonator with built in capacitors, SMT www.semtech.com MECHANICALS FOR THE UR5HCSPI-SA01-FB L 23 B Detail A 44 H A-B S V B M B L Detail A 12 1 11 Notes D A 0.20 (0.008) M C A-B S 0.05 (0.002) A-B D S F S 0.20 (0.008) M H A-B S Base Metal D S J 0.20 (0.008) T Datum Plane N D M M C A-B S D S MILLIMETERS H K W Detail C Q X M Detail C C Seating Plane E H Datum Plane 0.01 (0.004) G M H Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 1. Dimensioning and tolerancing per Ansi Y14.5-M, 1982 2. Controlling dimension: Millimeter 3. Datum Plane "H" is located at the bottom of the lead and is coincident with the lead where the lead exits the plastic body at the bottom of the parting line. 4. Datums -A-, -B-, and -D- to be determined at Datum Plane -H-. 5. Dimensions S and V to be determined at seating plane -C-. 6. Dimensions A and B do not include Mold protusion. Allowable protusion is 0.25 (0.010) per side. Dimensions A and B do include mold mismatch and are determined at Datum Plane -H-. 7. Dimension D does not include Danbar protrusion. Allowable Danbar protrusion is 0.08 (0.003) total in excess of the D dimension at Maximum Material Condition. Danbar cannot be located on the lower radius or the foot. Section B-B R C A,B,D 0.20 (0.008) A D S D S 22 0.20 (0.008) M C A-B S 0.05 (0.002) A-B 33 34 19 DIM A B C D E F G H J K L M N Q R S T U V W X MIN MAX 9.90 10.10 9.90 10.10 2.10 2.45 0.30 0.45 2.00 2.10 0.30 0.40 0.80 BSC - 0.25 0.13 0.23 0.65 0.95 8.00 REF 50 10 0 0.13 0.17 0 0 70 0.13 .30 12.95 13.45 0.13 00 12.95 13.45 0.40 1.6 REF www.semtech.com INCHES MIN MAX 0.390 0.398 0.390 0.398 0.083 0.096 0.012 0.018 0.079 0.083 0.012 0.016 0.031 BSC - 0.010 0.005 0.009 0.026 0.037 0.315 REF 50 10 0 0.005 0.007 0 0 7 0 0.005 0.012 0.510 0.530 0.005 00 0.510 0.530 0.016 0.063 REF ELECTRICAL SPECIFICATIONS Absolute Maximum Ratings Ratings Supply voltage VDD Input voltage Current drain per pin (not including VSS or VDD) Operating temperature UR5HCSPI-SA01 Storage temperature range ESD rating (human body model) Thermal Characteristics Characteristic Thermal resistance Plastic Symbol Value -0.3 to +7.0 Vss -0.3 to Vdd +0.3 25 VIN I Ta TSTG VESD - Symbol Tja Unit V V mA T low to T high -40 to +85 65 to +150 TBD °C Value Unit °C per W °C KV 60 DC Electrical Characteristics (VDD=3.3 VDC +/-10%, VSS=0 VDC, Temperature range=TLOW to THIGH unless otherwise noted) Characteristic Symbol Min Typ Max Unit Output voltage (I load<10µA) Vol 0.1 V VOH VDD–0.1 V Output high voltage (I load=0.8mA) VOH VDD–0.8 Output low voltage (I load=1.6mA) VOL 0.4 V V 0.7xVDD VDD Input high voltage VIH 0.2xVdd V Input low voltage VIL VSS User mode current IPP 5 10 mA 2.0 V Data retention mode (0 to 70°C) VRM Supply current (Run) IDD 1.53 3.0 mA (Wait) 0.711 1.0 mA (Stop) 2.0 20 µA +/-10 µA I/O ports hi-Z leakage current IIL Input current IIN +/- 1 µA I/O port capacitance CIO 8 12 pF Control Timing (VDD=3.3 VDC +/-10%, VSS=0 VDC, Temperature range=TLOW to THIGH unless otherwise noted) Characteristic Symbol Min Max Frequency of operation fOSC Crystal option 2.0 External clock option dc 2.0 Cycle time tcyc 1000 Crystal oscillator startup time toxov 100 Stop recovery startup time tilch 100 RESET pulse width trl 8 Interrupt pulse width low tlih 250 Interrupt pulse period tilil * OSC1 pulse width toh, tol 200 Unit MHz ns ms ms tcyc ns tcyc ns *The minimum period tlil should not be less than the number of cycle times it takes to execute the interrupt service routine plus 21 tcyc. Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 20 www.semtech.com This Page Left Intentionally Blank Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 21 www.semtech.com For sales information and product literature, contact: Semtech Corporation Human Interface Device (HID) and System Management Division 200 Flynn Road Camarillo, CA 93012-8790 [email protected] http://www.semtech.com/ (805)498-2111 Telephone (805)498-3804 Fax Copyright ©1998-2002 Semtech Corporation. All rights reserved. SPICoder, KeyCoder, and Semtech are registered trademarks of Semtech Corporation. Self-Power Management is a trademark of Semtech Corporation. All other trademarks belong to their respective companies. INTELLECTUAL PROPERTY DISCLAIMER This specification is provided "as is" with no warranties whatsoever including any warranty of merchantability, fitness for any particular purpose, or any warranty otherwise arising out of any proposal, specification or sample. A license is hereby granted to reproduce and distribute this specification for internal use only. No other license, expressed or implied to any other intellectual property rights is granted or intended hereby. Authors of this specification disclaim any liability, including liability for infringement of proprietary rights, relating to the implementation of information in this specification. Authors of this specification also do not warrant or represent that such implementation(s) will not infringe such rights. Copyright ©1998-2002 Semtech Corporation DOC5-SPI-SA01-DS-107 2002-07 22 www.semtech.com