DATA SHEET MOS INTEGRATED CIRCUIT µPD6708 IEBus (Inter Equipment Bus) PROTOCOL CONTROL LSI DESCRIPTION The µPD6708 is a peripheral LSI for microcontrollers that controls the protocol of the IEBus. This LSI processes the protocol of the IEBus. Because it is provided with a transmit/receive buffer, the microcontroller can concentrate on the application processing of the IEBus. Because the µPD6708 also contains an IEBus driver/receiver, it can be directly connected to the bus. FEATURES • Protocol control of IEBus • On-chip IEBus driver/receiver • Multi-master system • Broadcast communication function (commu- • Transmit/receive buffer Transmit: 4-byte FIFO nication between one unit and multiple units) • Choice of three modes with different trans- Receive: 20-byte FIFO • Interface with microcontroller mission speeds • Three-line serial I/O (SCK, SO, SI pins) • Transfer with MSB first At 12 MHz At 12.58 MHz Mode 0 Approx. 3.9 Kbps Approx. 4.1 Kbps Mode 1 Approx. 17 Kbps Approx. 18 Kbps Mode 2 Approx. 26 Kbps Approx. 27 Kbps • Oscillation frequency (fX): 12 MHz, 12.58 MHz • In modes 0 and 1: ±1.5 % • In mode 2: ±0.5 % • Supply voltage: VDD = 5 V ±10 % ORDERING INFORMATION Part Number µPD6708CX µPD6708GS Package 16-pin plastic DIP (300 mil) 16-pin plastic SOP (300 mil) APPLICATION FIELD Fields where a small-scale digital data transfer system is required between equipment, such as automobile electronic systems and industrial equipment The information in this document is subject to change without notice. Document No. U10680EJ2V0DS00 (2nd edition) (Previous No. IC-3282) Date Published January 1996 P Printed in Japan The mark ★ shows major revised points. © 1993 µPD6708 PIN CONFIGURATION (TOP VIEW) • 16 pin plastic DIP (300 mil) µPD6708CX • 16 pin plastic SOP (300 mil) µPD6708GS 2 SCK 1 16 VDD SI 2 15 TEST SO 3 14 RESET IRQ 4 13 CS R/W 5 12 C/D XI 6 11 AVDD XO 7 10 BUS+ GND 8 9 BUS– SCK : Serial clock input SI SO : Serial data input : Serial data output IRQ R/W : Interrupt request output : Read/write switchover input XI, XO GND : System clock : Ground BUS–, BUS+ AVDD : IEBus input/output : IEBus analog power supply (connected to VDD pin) C/D CS : Command/data switchover input : Chip select input RESET TEST : Reset input : Test input (connected to VDD pin) VDD : Positive power supply µPD6708 CONTENTS 1. PIN FUNCTIONS ......................................................................................................................................... 5 1.1 2. IEBus OPERATION .................................................................................................................................... 6 2.1 2.2 2.3 2.4 2.5 3. 4.2 4.3 Accessible Buffers and Registers from Host Controller ........................................................................... 22 4.1.1 Write data buffer (WDB) .................................................................................................................. 22 4.1.2 Read data buffer (RDB) ................................................................................................................... 22 4.1.3 Command register (CMR) ................................................................................................................ 22 4.1.4 Status register (STR) ....................................................................................................................... 23 Host Interface Modes ...................................................................................................................................... 23 4.2.1 Switching through pin control ....................................................................................................... 24 4.2.2 Switching through software control .............................................................................................. 26 Reset Mode ....................................................................................................................................................... 28 Overview of Communication Control Commands....................................................................................... 30 Communication Control Command Functions ............................................................................................ 31 5.2.1 INIT command (command code: 0000).......................................................................................... 31 5.2.2 SETSA command (command code: 0001) .................................................................................... 32 5.2.3 5.2.4 MREQ1 command (command code: 0010) ................................................................................... 33 MREQ2 command (command code: 0011) ................................................................................... 34 5.2.5 5.2.6 ABORT command (command code: 0100) ................................................................................... 34 SETSD command (command code: 0101) .................................................................................... 35 5.2.7 5.2.8 GETSTA command (command code: 0110) .................................................................................. 36 SETREV command (command code: 0111) .................................................................................. 37 RETURN CODES ...................................................................................................................................... 38 6.1 6.2 6.3 6.4 6.5 7. Data Link Layer Controller ............................................................................................................................. 21 Physical Layer Controller ............................................................................................................................... 21 IEBus Driver/Receiver ..................................................................................................................................... 21 Host Interface ................................................................................................................................................... 21 COMMUNICATION CONTROL COMMANDS ......................................................................................... 30 5.1 5.2 6. 2.2.3 Communication address ................................................................................................................... 9 2.2.4 Broadcast communication ................................................................................................................ 9 Transfer Protocol ............................................................................................................................................. 10 Transfer Data (Contents of Data Field) ......................................................................................................... 16 Bit Format ......................................................................................................................................................... 19 INTERFACING WITH HOST CONTROLLER .......................................................................................... 22 4.1 5. Operation Overview ........................................................................................................................................... 6 IEBus Communication Protocol ...................................................................................................................... 7 2.2.1 Bus mastership determination (arbitration) ................................................................................... 8 2.2.2 Communication modes ...................................................................................................................... 8 INTERNAL CONFIGURATION ................................................................................................................. 20 3.1 3.2 3.3 3.4 4. List of Pin Functions ......................................................................................................................................... 5 Return Return Return Return Return Codes Codes Codes Codes Codes in Master/Slave Data Transmission ..................................................................................... 38 in Master Reception ............................................................................................................... 38 in Slave Reception ................................................................................................................. 39 in Broadcast Reception ......................................................................................................... 39 Generation Intervals ............................................................................................................... 40 COMMUNICATING WITH HOST CONTROLLER ................................................................................... 43 7.1 Master Transmission ....................................................................................................................................... 43 7.1.1 Master transmission by MREQ1 command .................................................................................. 43 7.1.2 Master transmission by MREQ2 command .................................................................................. 44 3 µPD6708 7.2 7.3 7.4 7.5 8. EXAMPLE OF HOST CONTROLLER PROCESSING FLOW ................................................................ 48 8.1 8.2 8.3 9. Slave Transmission ......................................................................................................................................... 44 7.2.1 Data transmission ............................................................................................................................ 44 7.2.2 Transmitting slave status address and lock address ................................................................. 45 Master Reception ............................................................................................................................................. 45 Slave Reception ............................................................................................................................................... 46 Broadcast Reception ....................................................................................................................................... 47 Main Routine ..................................................................................................................................................... 48 Interrupt Service Routine ................................................................................................................................ 49 Processing Routine ......................................................................................................................................... 50 8.3.1 µPD6708 initialization routine ......................................................................................................... 50 8.3.2 Communication control command processing routine .............................................................. 51 8.3.3 8.3.4 Master transmission processing routine ...................................................................................... 57 Slave data transmission processing routine ............................................................................... 58 8.3.5 Master reception processing routine ............................................................................................ 59 ELECTRICAL SPECIFICATIONS ............................................................................................................ 63 10. PACKAGE DRAWINGS ............................................................................................................................ 67 11. RECOMMENDED SOLDERING CONDITIONS ....................................................................................... 69 APPENDIX MAJOR DIFFERENCES BETWEEN µPD6708 AND µPD72042A, µPD72042B ................... 70 4 µPD6708 1. PIN FUNCTIONS 1.1 List of Pin Functions Pin No. Pin Name Input/Output Function I/O Format At Reset 1 SCK Input Input for serial clock used to interface with microcontroller. CMOS input Input 2 SI Input Input for serial data used to interface with microcontroller. CMOS input Input 3 SO Output Output for serial data used to interface with microcontroller. CMOS output High level 4 IRQ Output Output used by interrupt request signals generated by communication and command execution results. Used as operation start request signal to microcontroller. The interrupt request signal is output for 8 µs or longer CMOS output Low level at high level. 5 R/W Input Input for switching serial interface read/write mode. When high, it is in the read mode. When low, it is in the write mode. When this pin is low and C/D pin high, the read and write modes can be switched by commands input from the serial interface. CMOS input Input 6 7 XI XO –– Connection pins for system clock resonator. Use a 12- or 12.58-MHz crystal, or ceramic resonator. Frequency precision depends on the communication mode used. Mode 0 : ±1.5 % Mode 1 : ±1.5 % Mode 2 : ±0.5 % –– (Oscillation continues) 8 GND –– Ground –– –– 9 10 BUS– BUS+ Input/output Input/output for IEBus. –– High impedance 11 AVDD –– IEBus driver/receiver analog power supply. Connect to VDD. –– –– 12 C/D Input Input used to switch between processing data input to the serial interface as commands or data. When set to high, data is processed as commands; when low, data is processed as data. When this pin is high and R/W pin low, the read and write modes can be switched by commands input from the serial interface. CMOS input Input 13 CS Input Chip select input. When low, serial interface input is enabled. When high, serial clock (SCK) input is disabled, SO pin becomes high impedance, and the serial clock counter is reset. The status of CS pin is not affected by IEBus transmit and receive operations. CMOS input Input 14 RESET Input System reset signal input pin. Low input effects a reset. Always input the low signal for 6 µs or longer after turning on the power. CMOS input Input 15 TEST Input Always connect this pin to the VDD. CMOS input –– 16 VDD –– Positive power supply input. Apply a voltage of 5 V ±10 %. –– –– 5 µPD6708 2. IEBus OPERATION ★ 2.1 Operation Overview The µPD6708 is an IEBus interface CMOS LSI device. The IEBus is a bus for a small-scale digital data transfer system designed to transfer data between electronic devices. The µPD6708 is connected to a microcontroller incorporated in electronic equipment with a serial interface (SCK, SO, SI pins). The data and commands required to transfer data with the host controller (microcontroller) are set via this serial interface. When the host controller transmits data to the µPD6708 via the serial interface, signals are output from the BUS pins (BUS+ and BUS–). Data received from the BUS pins can be read by the host controller via the serial interface. 6 µPD6708 ★ 2.2 IEBus Communication Protocol An overview of the IEBus is as follows. • Communication system: Half-duplex asynchronous communication • Multi-master system All the units connected to the IEBus can transfer data to the other units. • Broadcast communication function (communication between one unit and multiple units) Group broadcast communication: Broadcast communication with group units General broadcast communication: Broadcast communication with all units. • Three modes with different transfer speeds selectable. fX = 12 MHz fX = 12.58 MHz Maximum Number of Transfer Bytes (bytes/frame) Mode 0 Approx. 3.9 Kbps Approx. 4.1 Kbps 16 Mode 1 Approx. 17 Kbps Approx. 18 Kbps 32 Mode 2 Approx. 26 Kbps Approx. 27 Kbps 128 • Access control: CSMA/CD (Carrier Sense Multiple Access with Collision Detection) The priority order for bus occupancy is as follows. <1> Broadcast communication takes precedence over ordinary communication (i. e., communication between one unit and another). <2> The lowest master address has the highest priority. • Communication scale Number of units: Cable length: MAX. 50 MAX. 150 m (with twisted-pair cable <Resistance: 0.1 Ω/m or less>) Load capacity: MAX. 8000 pF <between BUS– and BUS+>, fX = 12 MHz MAX. 7100 pF <between BUS– and BUS+>, fX = 12.58 MHz Terminating resistor: 120 Ω 7 µPD6708 2.2.1 Bus mastership determination (arbitration) When a unit connected to the IEBus controls another unit, it performs an operation to occupy the bus. This operation ★ is called arbitration. Arbitration is to select one unit, and if several units begin to transmit data simultaneously, gives permission to occupy the bus to that one unit. So that one unit is granted the permission to occupy the bus as a result of the arbitration, the following priority conditions are determined. Remark The units not given permission through arbitration are automatically allowed to get into retransfer mode (number of retransfer times for the µPD6708: 3). (1) Priority according to type of communication Broadcast communication (between a single and multiple units) takes precedence over ordinary communication (between single units). (2) Priority according to master address If the communication devices are of the same type, the unit with the lowest master address has the highest priority. Example The master address comprises 12 bits, and unit 000H has the highest priority while unit FFFH has the lowest priority. 2.2.2 Communication modes The IEBus is provided with three communication modes with different transfer speeds. The transfer speed and maximum number of transfer bytes in a single communication frame in each communication mode are shown in Table 2-1. Table 2-1. Transfer Speed and Maximum Number of Transfer Bytes in Each Communication Mode Communication Mode Maximum Number of Transfer Bytes (bytes/frame) Actual Transfer Speed fX = 12 MHz Note 2 Note 1 (Kbps) fX = 12.58 MHz 0 16 Approx. 3.9 Approx. 4.1 1 32 Approx. 17 Approx. 18 2 128 Approx. 26 Approx. 27 Note 2 Notes 1. Actual transfer speed when the maximum number of bytes is transferred 2. Oscillation frequency when the µPD6708 is used Cautions 1. A communication mode is selected for each unit connected to the IEBus before communication is performed. If the communication mode of the master unit is not the same as that of the unit with which the master unit is to communicate (slave unit), communication cannot be performed correctly. 2. If the oscillation frequency of one unit is fx = 12 MHz and that of the other unit is fx = 12.58 MHz, communication cannot be performed correctly even if the communication mode is the same. Make sure that the oscillation frequencies of the two units to communicate are the same. 8 µPD6708 2.2.3 Communication address With the IEBus, a 12-bit communication address is assigned to each unit. The communication address is made up as follows. Higher 4 bits: Group number (number which identifies the group to which the unit belongs) Lower 4 bits: Unit number (number which identifies a unit within a group) 2.2.4 Broadcast communication In ordinary communication, there is only one master unit and one slave unit, and transmission or reception is performed on an one-to-one basis. In broadcast communication, however, there are a number of slave units and the master unit performs transmission with these slave units. Because there are several slave units, no acknowledge signals is returned from the slave units during communication. Whether broadcast communication or ordinary communication is performed is specified by the broadcast bit (for the broadcast bit, see 2.3 (1) <2> “Broadcast bit”). There are two kinds of broadcast communication, as follows. (1) Group broadcast communication Broadcast communication is performed to the units in a group whose group numbers are the same as that specified by the higher 4 bits of the communication address. (2) General broadcast communication Broadcast communication is performed to all units irrespective of their group numbers. Group broadcast communication or general broadcast communication is identified by the value of a salve address (for the slave address, see 2.3 (3) “Slave address field”). 9 ★ µPD6708 2.3 Transfer Protocol The IEBus transfer signal format is shown in Figure 2-1. Data is transferred as a series of signals called a communication frame. The number of data that can be transferred in one communication frame and the transfer speed differ depending on the communication mode. Figure 2-1. Transfer Signal Format (fx = at 12 MHz) ★ Field Name Number of Bits Header 1 Master Address Field 1 12 1 Slave Address Field 12 1 1 BroadStart cast Master P Slave P Address Bit Bit Address Control Field 4 1 A Control P Bit 1 Message Length Field 8 1 1 Message A Length P Bit A Data Field 8 1 1 8 1 1 Data Bit P A Data Bit P A Transfer Time Mode 0 Approx. 7330 µs Approx. 1590 × N µs Mode 1 Approx. 2090 µs Approx. 410 × N µ s Mode 2 Approx. 1590 µs Approx. 300 × N µ s P: Parity bit (1 bit) A: Acknowledge bit (1 bit) When A = 0: ACK When A = 1: NAK N: Number of data bytes Remark In broadcast communication, the value of the acknowledge bit is ignored. (1) Header A header comprises a start bit and a broadcast bit, as described below. <1> Start bit The start bit is a signal which tells the other units that data transmission will start. The unit which is about to start transmitting data will output the low signal (the start bit) for a specified time, and then outputs the broadcast bit. If another unit is already outputting a start bit before one unit outputs a start bit, the unit will not output the start bit. It will wait until the another unit completely outputs the start bit, and then outputs the broadcast bit. The units other than the one that has started transmission detect this start bit and enters the reception state. <2> Broadcast bit The broadcast bit distinguishes between broadcast communication and ordinary communication. When this bit is ‘0’, it indicates broadcast communication; when it is ‘1’, it indicates ordinary communication. There are two types of broadcast communication: group broadcast and general broadcast. These types are identified by the value of the slave address (for the slave address, see (3) “Slave address field”). In broadcast communication, there are a number of slave units. Therefore, the acknowledge bit is not returned in the fields described in (2) below and onward. If two or more units start to transmit a communication frame simultaneously, broadcast communication takes precedence over ordinary communication, and wins in the arbitration. 10 µPD6708 (2) Master address field The master address field is used to transmit the unit address of the master unit (master address) to the other units. The master address field consists of master address bits and a parity bit. The master address comprises 12 bits and is output from the MSB. If two or more units start transmitting the broadcast bit of the same value simultaneously, the arbitration decision is made by the master address field. The master address field compares the data the master has output with the data on the bus each time the master transmits 1 bit of data. If the master address output by the master unit is different from the data on the bus, the master unit assumes that it has lost in arbitration, stops transmission, and enters the reception state. Because the IEBus has a wired-AND configuration, the unit having the lowest master address of the units participating in the arbitration (arbitration masters) wins in the arbitration. Ultimately, only one unit remains in the transmission state as the master unit after outputting a 12-bit master address. This master unit then outputs a parity bit slave address field. Note Note , makes the other units confirm the master address, and then outputs the Even parity is used. When the number of the bits that are ‘1’ in the master address is odd, the parity bit is ‘1’. (3) Slave address field The slave address field is used to transmit the address (slave address) of a unit (slave unit) with which the master wishes to communicate. The slave address field consists of slave address bits, a parity bit, and an acknowledge bit. The slave address comprises 12 bits and is output from the MSB. After the 12-bit slave address is transmitted, the parity bit is output to prevent the slave address from being received incorrectly. Next, the master unit looks for the acknowledge signal (bit) from the slave unit to confirm that the slave unit exists on the bus. When the master unit detects the acknowledge signal, it starts outputting the control field. In the case of broadcast communication, however, the master unit outputs the control field without waiting for the acknowledge bit. A slave unit outputs the acknowledge signal if it has detected that its slave address coincides with that selected by the master and that the parities of both the master and slave addresses are even. If the parity is odd, the slave unit assumes that the master or slave address has not been correctly received, and does not output the acknowledge signal. In this case, the master unit enters the standby (monitor) state and communication ceases. In the case of broadcast communication, the slave address is used to distinguish between group broadcast and general broadcast as follows: Slave address = FFFH: General broadcast communication Slave address ≠ FFFH: Group broadcast communication Remark In the case of group broadcast communication, the group number is the value of higher 4 bits of the slave address. 11 ★ µPD6708 ★ (4) Control field The control field indicates the type of data and the transfer direction of the subsequent data field. The control field consists of 4 control bits, a parity bit, and an acknowledge bit. The control bits are output from the MSB. A parity bit is output after the control bits. When the parity is even and the slave can execute the function requested by the master unit, the slave unit outputs an acknowledge signal, and then outputs the next message length field. If the slave unit cannot execute the function requested by the master unit even if the parity is even, or if the parity is odd, the slave unit does not output the acknowledge signal but returns to the standby (monitor) state. After the master unit has confirmed the acknowledge signal, it starts outputting the next message length field. If the master unit is cannot confirm the acknowledge signal, it enters the standby state and stops communication. In the case of broadcast communication, however, the master unit starts outputting the message length field without confirming the acknowledge signal. For the functions of the control bits, see Table 2-3. (5) Message length field The message length field is used to specify the number of communication data bytes. The message length field comprises 8 message length bits, a parity bit and, an acknowledge bit. The message length bits are output from the MSB. The message length bits indicate the number of communication data bytes as shown in Table 2-2. Table 2-2. Meaning of Message Length Bits Remark Message Length Bits (hex) Number of Transmission Data Bytes 01H 1 byte 02H 2 bytes : : : : FFH 255 bytes 00H 256 bytes In the communication mode, if the number of bytes exceeding the maximum number of transfer bytes per frame is set, two or more frames are communicated. In this case, the message length bits indicate the number of remaining communication data bytes during the second communication and onward. The operation of this field differs depending on whether the master transmits (bit 3 of control bits is 1) or receives (bit 3 of control bits is 0) data. <1> When master transmits data The message length bits and parity bit are output by the master unit. The slave unit outputs the acknowledge signal and then the next data field if it detects that the parity is even. The slave unit does not output the acknowledge signal in the case of broadcast communication. If the parity is odd, the slave unit assumes that the message length bits have not been received correctly, and returns to the standby (monitor) state without outputting the acknowledge signal. In this case, the master unit also returns to the standby state, and communication ceases. 12 µPD6708 <2> When master receives data The message length bits and parity bit are output by the slave unit. The master unit outputs the acknowledge signal ★ if it detects that the parity bit is even. If the parity is odd, the master unit assumes that the message length bits have not been received correctly, and returns to the standby state without outputting the acknowledge signal. In this case, the slave unit also returns to the standby state, and communication ceases. (6) Data field The data field is used to transmit/receive data to/from the slave units. The master unit uses the data field to transmit data to and receive data from the slave units. The data field consists of 8 data bits, a parity bit, and an acknowledge bit. The data bits are output from the MSB. Following the data bits, the parity bit and acknowledge bit are output from the master unit and the slave unit, respectively. Broadcast communication is performed when only the master unit transmits data. At this time, the acknowledge signal is ignored. The operation differs depending on whether the master performs transmission or reception, as follows. <1> When master transmits data When the master unit writes data to the slave unit, the master unit transmits data bits and a parity bit to the slave unit. The slave unit receives the data bits and parity bit. If the parity is even and the receive buffer is empty, the slave unit outputs the acknowledge signal. If the parity is odd and the receive buffer is not empty, the slave unit denies acknowledgment of the corresponding data and does not output the acknowledge signal. If no acknowledge signal is output from the slave unit, the master unit transmits the same data again. The master unit continues this operation until it detects the acknowledge signal from the slave unit or the data reaches the maximum number of transfer bytes. If the parity is even and the acknowledge signal has been output from the slave unit, and if the master unit has more data to transmit and the maximum number of transfer bytes is not exceeded, the master unit will transmit the next data. In the case of broadcast communication, the slave unit does not output the acknowledge signal, and the master unit transfers data on a byte-by-byte basis. <2> When master receives data When the master unit reads data from the slave unit, the master unit outputs synchronization signals corresponding to all the read bits. The slave unit outputs the contents of the data and parity bits onto the bus in accordance with the synchronization signals from the master unit. The master unit reads the data and parity bit output by the slave unit, and checks the parity. If the parity is odd or the receive buffer is not empty, the master unit denies acknowledgement of that data and does not output the acknowledge signal. If the data is within the maximum number of transfer bytes that can be transmitted in one frame, the master unit repeatedly reads the same data. If the parity is even and the receive buffer is empty, the master unit acknowledges the data and transmits back the acknowledge signal. If the data is within the maximum number of bytes that can be transmitted in one frame, the master unit reads the next data. 13 ★ µPD6708 (7) Parity bits Parity bits are used to check that there is no error in the transfer data. A parity bit is added to the master address bits, slave address bits, control bits, message length bits, and data bits. Even parity is used. If the number of the bits that are ‘1’ bits in data is odd, the parity bit is ‘1’, and if the number of the bits that are ‘1’ bits is even, the parity bit is ‘0’. (8) Acknowledge bits In ordinary communication (between two units), an acknowledge bit is added to the following places to confirm that data has been acknowledged correctly. • • At the end of the slave address field. At the end of the control field. • • At the end of the message length field. At the end of a data field. The definition of the acknowledge bit is as follows. • ‘0’: Indicates that transfer data has been acknowledged (ACK). • ‘1’: Indicates that transfer data has not been acknowledged (NAK). Note that the value of the acknowledge bit is ignored in broadcast communication. <1> Acknowledge bit at the end of the slave field When any of the following conditions is met, the acknowledge bit at the end of the slave field is NAK, and communication is discontinued. • • If the parity of the master address bits or slave address bits is incorrect. If a timing error (error in bit format) occurs. • If the slave unit does not exist. <2> Acknowledge bit at the end of the control field When any of the following conditions is met, the acknowledge bit at the end of the control field is NAK, and communication is discontinued. ★ Note 14 • • If the parity of the control bits is incorrect. If bit 3 of the control bits is ‘1’ (write operation) when the slave receive buffer • • If the control bits indicate read operation (3H or 7H) when the slave transmit buffer Note is empty. If 3H, 6H, 7H, AH, BH, EH, or FH of control bits is requested from a unit other than the unit which set the lock when • a lock has been set. If the control bits indicate lock address read (4H) when a lock has not been set. • • If a timing error occurs. If the control bits are undefined. See 2.4 (1) “Reading slave status (SSR) (control bit: 0H, 6H)”. Note is not empty. µPD6708 <3> Acknowledge bit at the end of a message length field When either of the following conditions is met, the acknowledge bit at the end of the message length field is NAK, and communication is discontinued. • • If the parity of the message length bits is incorrect. If a timing error occurs. <4> Acknowledge bit at the end of a data field When any of the following conditions is met, the acknowledge bit at the end of a data field is NAK, and communication is discontinued. Note Note • If the parity of the data bits is incorrect • • If a timing error occurred in or after the previous acknowledge bit transmission. If the receive buffer is full and cannot accept any more data Note. . In this case, if the number of transfer bytes is within the maximum number of bytes which can be transmitted, the transmitting side re-executes transmission of that data field. 15 µPD6708 2.4 Transfer Data (Contents of Data Field) The contents of the data field are data specified by the control bits. Table 2-3. Functions of Control Bits ★ Bit 3 Note 1 Bit 2 Bit 1 Bit 0 Function 0H 0 0 0 0 Reads slave status (SSR) 1H 0 0 0 1 Undefined 2H 0 0 1 0 Undefined 3H 0 0 1 1 Reads and locks data 4H 0 1 0 0 Reads lock address (lower 8 bits) 5H 0 1 0 1 Reads lock address (higher 4 bits) 6H 0 1 1 0 Reads and unlocks slave status (SSR) 7H 0 1 1 1 Reads data 8H 1 0 0 0 Undefined 9H 1 0 0 1 Undefined AH 1 0 1 0 Writes and locks command BH 1 0 1 1 Writes and locks data CH 1 1 0 0 Undefined DH 1 1 0 1 Undefined EH 1 1 1 0 Writes command FH 1 1 1 1 Writes data Note 2 Notes 1. Depending on the value of bit 3 (MSB), the transfer direction of the message length bits of the subsequent message field and data field differs. When bit 3 is “1”, data are transferred from the master unit to the slave unit. When bit 3 is “1”, data are transferred from the slave unit to the master unit. 2. 3H, 6H, AH, and BH are control bits that specify locking or unlocking. If any of undefined values 1H, 2H, 8H, 9H, CH, or DH is transmitted, no acknowledge bit is returned. A unit locked by the master unit rejects acknowledging the control bits and does not output the acknowledge bit if the control bits received from the master unit which requested locking is in any other state than that shown in Table 2-4. Table 2-4. Control Field Corresponding to Locked Slave Unit 16 Bit 3 Bit 2 Bit 1 Bit 0 Function 0H 0 0 0 0 Reads slave status 4H 0 1 0 0 Reads lock address (lower 8 bits) 5H 0 1 0 1 Reads lock address (higher 4 bits) µPD6708 (1) Reading slave status (SSR) (control bit: 0H, 6H) The master unit can learn the reason why the slave unit has not returned the acknowledge bit (ACK) by reading the slave status. The slave status is determined by the results of the last communication performed by the slave unit. All the slave units can provide slave status information. The meanings of the slave status are shown in Table 2-5. ★ Figure 2-2. Bit Configuration of Slave Status (SSR) MSB LSB Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Table 2-5. Meanings of Slave Status Bit Bit 0 Note 1 Value Meaning 0 Slave transmit buffer empty 1 Slave transmit buffer is not empty. 0 Slave receive buffer empty 1 Slave receive buffer is not empty. 0 Unit is not locked. 1 Unit is locked. 0 Fixed to ‘0’ 0 Slave transmission ends 1 Slave transmission enabled Bit 5 0 Fixed to ‘0’ Bit 7 00 Mode 0 Indicates the highest mode the unit Bit 6 01 Mode 1 supports 10 Mode 2 11 For future expansion Bit 1 Note 2 Bit 2 Bit 3 Bit 4 Note 3 Note 4 . Notes 1. The slave transmit buffer is the buffer accessed during data read processing (control bits: 3H, 7H). With the µPD6708, this buffer corresponds to the write data buffer (WDB) when the SETSD command is valid (see 5.2.6 “SETSD command”). 2. The slave receive buffer is the buffer accessed during data write processing (control bits: 8H, AH, BH, EH, FH). With the µPD6708, this buffer corresponds to the read data buffer (RDB). 3. The value of bit 4 can be selected by INIT command (see 5.2.1 “INIT command”). 4. Because the µPD6708 can support mode 2, bits 7 and 6 are fixed at ‘10’. 17 µPD6708 (2) Transferring data command (control bit: read (3H, 7H), write (AH, BH, EH, FH)) During data read (3H, 7H), the data in the data buffer of the slave unit are read to the master unit. During data write (BH, FH) or during command write (AH, EH), the data the slave unit has received are processed according to the operation convention. Remarks 1. 2. (3) ★ The user can voluntarily select data and command as his system requires. Control bits 3H, AH, and BH may be locked depending on the communication condition and status. Reading lock address (control bits: 4H, 5H) When the lock address is read processing (4H, 5H), the address (12 bits) of the master unit that has issued the lock instruction is read in 1-byte units, as shown below. Figure 2-3. Lock Address Configuration MSB Control Bits : 4H Control Bits : 5H (4) LSB Lower 8 Bits Undefined Higher 4 Bits Locking and unlocking (locking (3H, AH, BH), unlocking (6H)) The lock function is used to transfer a message over two or more frames. A locked unit receives data only from the unit that has locked the unit. Locking and unlocking are performed as described below. <1> Locking After the transmission/reception of the acknowledge bit ‘0’ of the message length field by the control bits (3H, AH, BH) which specify the lock has ended, if the communication frame is completed without completing the transmission or reception of the number of data bytes specified by the message length bits, the slave unit is locked by the master unit. At this time, the bit (bit 2) relating to the locking of the byte which indicates the slave status is set to ‘1’. <2> Unlocking After completion of transmission or reception of data in one frame by the number of data bytes specified by the message length bits with control bits (3H, AH, or BH) specifying locking or control bits (6H) specifying unlocking, the slave unit is unlocked by the master unit. At this time, the bit (bit 2) relating to the locking of the byte which indicates the slave status is reset to ‘0’. Locking and unlocking are not performed in the case of broadcast communication. Caution To unlock the unit specified to be unlocked by the unit itself, the INIT command (see 5.2.1 “INIT command”) must be executed with the µPD6708 (Whether a unit is locked or not can be checked by using the GETSA command (see 5.2.7 “GETSA command”). 18 µPD6708 2.5 Bit Format The IEBus communication frame bit format (concept) is shown in Figure 2-4. ★ Figure 2-4. IEBus Bit Format (Concept) Logic "1" Logic "0" Preparation Period Synchronous Period Data Period Preparation Period Synchronous Period Data Period Logic “1”: Potential difference between bus lines (BUS+ pin and BUS– pin) is 20 mV or lower (low level). Logic “0”: Potential difference between bus lines (BUS+ pin and BUS– pin) is 120 mV or higher (high level). Preparation period: The first or subsequent low-level (logic “1”) period Synchronous period: The next high-level (logic “0”) period Data period: The period that expresses the bit value (logic “1”: low level; logic “0”: high level) The synchronous period and data period have approximately the same length. The IEBus uses bit-by-bit synchronization. The specifications for the total bit time and the periods allocated to the bits depend on the type of transfer bit, and on whether the unit is the master unit or the slave unit. 19 µPD6708 3. INTERNAL CONFIGURATION The µPD6708 is composed of the following four blocks. (1) Data link layer controller (2) Physical layer controller (3) IEBus driver/receiver (4) Host interface Figure 3-1. µPD6708 Internal Blocks Host Interface Status Register (STR) Data Link Layer Controller SCK Read Data Buffer (RDB) 20 Bytes Shift Register Write Data Buffer (WDB) 4 Bytes BUS+ SI Receiver Filter Bit Sequencer BUS– Command Register (CMR) CS IRQ Serial I/O Controller Driver IEBus Driver/Receiver 20 SO Physical Layer Controller C/D R/W µPD6708 3.1 Data Link Layer Controller The data link layer controller performs processing of the IEBus protocol data link layer (frame composition and resolution, communication error detection, etc.), execution of communication control commands set by the host controller, and generate a return code that informs the host controller of the communication status. 3.2 Physical Layer Controller The physical controller performs generation and resolution of bit timing and also converts the signals between the bus lines through the driver/receiver. 3.3 IEBus Driver/Receiver The driver/receiver performs conversion between the logic signals within the µPD6708 and the IEBus signals. The IEBus signals and their relationship to the logic statuses are shown in Table 3-1. Table 3-1. Relationship between IEBus Signals and Logical Statuses 3.4 Logical Status IEBus Signals 0 (BUS+) – (BUS–) ≥ 120mV 1 (BUS+) – (BUS–) ≤ 20mV Host Interface The host Interface is a block which controls the transmission and reception of data to and from the host controller. It accepts communication control commands, passes on return codes, and forwards transmit data. The forwarding of transmit data takes place through the FIFO buffers, 4 bytes of write data buffer (WDB) and 20 bytes of read data buffer (RDB). It also absorbs the differences between IEBus transmission speed and the transmission speed on the serial interface between the µPD6708 and the host controller. 21 µPD6708 4. INTERFACING WITH HOST CONTROLLER This chapter will explain the interfacing that occurs between the µPD6708 and the host controller. 4.1 Accessible Buffers and Registers from Host Controller The host controller, which controls the µPD6708, can access the write data (WDB), the read data buffer (RDB), the command register (CMR), and the status register (STR) within the µPD6708. 4.1.1 Write data buffer (WDB) WDB is a 4-byte FIFO buffer in which the host controller transmit data and the parameters of the communication control commands are written. 4.1.2 Read data buffer (RDB) RDB is a 20-byte FIFO buffer which stores the receive data acknowledged by the data link layer controller in the µPD6708. The host controller reads the µPD6708 receive data from RDB. 4.1.3 Command register (CMR) CMR is an 8-bit register used to write control commands for the µPD6708. As shown in Table 4-1, the host controller sets the reset mode and the host interface mode in higher 4 bits and sets the communication control command code in lower 4 bits. Table 4-1. Contents of Command Register Bit Bit 7 Meaning 1 Entering the reset mode 0 Exiting the reset mode 1 Data of lower 4 bits of CMR is valid. 0 Data of lower 4 bits of CMR is not valid. Bit 5 00 Change of mode through pin control Bit 4 01 Data write mode 10 Data read mode 11 Status read mode Bit 6 Bit 3 to Bit 0 22 Value Switches the host interface mode Set the communication control command codes µPD6708 4.1.4 Status register (STR) STR is an 8-bit register used to determine the status of the µPD6708. The statuses of WDB and RDB and the status of interrupts can be read from higher 4 bits. The return code, which indicates the result of the communication, can be read from lower 4 bits. Table 4-2. Contents of Status Register Bit Bit 7 Bit 6 Bit 5 Bit 4 Value Meaning 1 WDB is full 0 WDB is not full 1 RDB is empty 0 RDB is not empty 1 WDB is empty 0 WDB is not empty 1 Interrupt requested 0 Bit 3 to Bit 0 Interrupt not requested Return code Description Indicates whether data can be written to WDB Indicates whether data can be read from RDB Indicates whether data is in WDB Indicates whether interrupt servicing is being requested (Bit 4 of the status register is reset by STR by the host controller) Return code will be read 4.2 Host Interface Modes The host controller can access WDB, RDB, CMR, and STR within the µPD6708 via the serial interface (SCK, SI, SO). There are four modes for accessing the serial interface, as shown in the Table 4-3. There are two method for switching among these four host interface modes: by using C/D pin and R/W pin, and by writing data to CMR (software control). Table 4-3. Host Interface Mode Mode Operation Data write mode Data input to SI pin is written to WDB from MSB at the rising edge of the serial clock input to SCK pin. Data setting is completed at the eighth serial clock cycle. Data read mode RDB data is output from MSB to SO pin at the falling edge of the serial clock input to SCK pin. A data read is completed by inputting eight serial clock cycles. Data at SI pin is ignored. Command write mode Data input to SI pin is written to CMR from MSB at rising edge of the serial clock input to SCK pin. Data setting is completed at the eight serial clock cycle. Status read mode STR data is output from MSB to SO pin at the falling edge of the serial clock input to SCK pin. A data read is completed by inputting eight serial clock cycles. Data at SI pin is ignored. 23 µPD6708 4.2.1 Switching through pin control With bits 5 and 4 of CMR both ‘0’, the host interface mode can be switched by setting the C/D pin and R/W pin to the values shown in Table 4-4. Table 4-4. Switching Host Interface Mode by Pin Control C/D R/W Host Interface Mode 0 0 Data write mode 0 1 Data read mode 1 0 Command write mode 1 1 Status read mode Figure 4-1. Example of Host Controller Connections by Pin Control 120 Ω Host Controller 5V IEBus µPD6708 5V TEST VDD SCK AVDD BUS+ SCK SI SO SO SI BUS– 12 MHz XI IRQ INT C/D Port R/W Port XO GND CS RESET Port 120 Ω Power Supply Voltage Detection Circuit Caution If the power supply voltage moves out of the 5 V ±5 % range, the RESET pin must be driven low for 6 µs or more in order to reset the µPD6708. 24 Figure 4-2. Host Interface Timing by Pin Control CS C/D R/W SCK SI 0 0 0 0 0 0 0 0 SO Undefined Undefined STR Contents CMR Higher 4 bits RDB Contents 0 0 0 0 Lower 4 bits Undefined WDB Chip Unselect Command Write Mode Status Read Mode Data Write Mode Data Read Mode µPD6708 25 µPD6708 4.2.2 Switching through software control With the C/D pin at the high level and the R/W pin at the low level, the host interface mode can be switched from the host controller by setting bits 5 and 4 of CMR to the values shown in Table 4-5. Table 4-5. Switching Host Interface Mode by Software Control Bit 5 Bit 4 Host Interface Mode 0 0 Mode switching by pin control 0 1 Data write mode 1 0 Data read mode 1 1 Status read mode After one byte of data has been forwarded, the host interface mode will become the command write mode, which is controlled by the C/D and R/W pins. Figure 4-3. Example of Host Controller Connections by Software Control 120 Ω Host Controller 5V IEBus µPD6708 5V TEST VDD SCK SCK AVDD BUS+ SI SO SO SI BUS– 12 MHz IRQ XI 5V C/D XO R/W GND CS 120 Ω 26 RESET Power Supply Voltage Detection Circuit INT Figure 4-4. Host Interface Timing by Software Control SCK SI 0 0 1 1 SO 0 0 0 1 Undefined Undefined STR Contents Higher 4 bits 0 0 1 1 0 0 0 1 CMR Lower 4 bits WDB Command Write Mode Remark Status Read Mode Command Write Mode Data Write Mode Connect C/D and R/W pins to VDD and GND, respectively. µPD6708 27 µPD6708 4.3 Reset Mode When the RESET pin is driven low, the µPD6708 enters the reset mode. To release the reset mode, the RESET pin must be driven high and a reset release command input. There are two methods of resetting the µPD6708, as follows. (1) Resetting with RESET pin If the RESET pin is driven low, the µPD6708 will enter the reset mode. To exit the reset mode, drive the RESET pin high and set bit 7 of CMR to ‘0’. (2) Resetting by software If bit 7 of CMR is set to ‘1’ with the RESET pin fixed high, the µPD6708 will enter the reset mode. To exit the reset mode, set bit 7 to ‘0’. When powering on, the RESET pin must be driven low to execute a reset. The µPD6708 will be in the following condition directly after leaving the reset mode. <1> IEBus slave status is intialized. Table 4-6. Slave Status Values after Leaving Reset Mode Bit Value Meaning Bit 7 1 Up to mode 2 is supported Bit 6 0 Bit 5 0 Always ‘0’ Bit 4 0 The slave transmission section has stopped. Bit 3 0 Always ‘0’ Bit 2 0 Unit is not locked. Bit 1 0 Slave receive buffer is empty. Bit 0 0 Slave transmit buffer is empty. <2> WDB and RDB are empty. <3> Reception is disabled. Slave reception and broadcast reception are not acknowledged. 28 Figure 4-5. Example of RESET Control on Powering on CS RESET C/D R/W SCK SI 0 SO 0 0 0 0 0 0 0 Undefined Higher 4 bits 0 0 0 0 CMR Lower 4 bits Undefined Power On Reset Mode Command Write Mode µPD6708 29 µPD6708 5. COMMUNICATION CONTROL COMMANDS The operation conditions of the µPD6708 can be controlled by giving it a command from the host controller. After a communication using the appropriate procedure (see 8.3.2 “Communication control command processing routine”), it is executed in a period in which communication is not being performed (standby state). 5.1 Overview of Communication Control Commands Table 5-1. Overview of Communication Control Commands Command Name Description INIT (Initialize) Sets local address and initializes. SETSA (Set slave address) Sets the unit to communicate with. MREQ1 (Master request 1) Communicates as a master unit. MREQ2 (Master request 2) Continues in previous condition as the master unit and communicates. ABORT (Abort) Aborts communications. SETSD (Set slave data) Sets data for slave transmission. GETSTA (Get status) Reads communication status. SETREV (Set receive) Sets reception disabled state/enabled state. (1) Write command The command codes and command parameters for the write commands are shown in Table 5-2. Table 5-2. Command Codes and Command Parameters of Write Commands Command Name Command Code (Lower 4 Bits of CMR) Command Parameters (WDB) First Byte Second Byte INIT 0000 Unit address Condition setting code SETSA 0001 Slave address 0000 MREQ1 0010 MREQ2 0011 ABORT 0100 SETSD 0101 Number of slave transmit data bytes SETREV 0111 Reception status code MSB Note Broad- Control bits Number of master transmit data bytes Note cast bits LSB MSB LSB Slave transmit data (first byte) MSB LSB Third Byte Fourth Byte Master transmit data (first byte) Note Master transmit data (second byte) Note Slave transmit data (second byte) Slave transmit data (third byte) MSB LSB MSB LSB Only set when transmitting. Caution Note that even if the host controller makes a mistake in setting the number of command parameter bytes, an error message will not be returned by the µPD6708, and command processing will be performed as though it were a correctly set command. 30 µPD6708 (2) Read command The command code of the read command is shown in Table 5-3. Table 5-3. Command Code of Read Command Command Code (Lower 4 Bits of CMR) Command Name GETSTA Data Placed in RDB after Command Execution First Byte 0110 Lock status MSB Remark 5.2 5.2.1 LSB MSB Second Byte Address of locked unit (12 bits) LSB MSB LSB With a read command, the command execution result is placed in RDB, and therefore it is performed in the reception disabled state. Communication Control Command Functions INIT command (command code: 0000) (1) Functions <1> Unit address setting This command sets the unit address (12 bits), The unit address will be used as the master address when a unit is communicating as the master unit, and as the slave address when a unit is communicating as the slave. <2> Condition setting • The status of bit 4 of IEBus slave status is set. Slave transmission block operation enabled, stopped (bit 4) (Setting of use/non-use of the function that transmits data to the master unit) • The communication mode to be used is set. Table 5-4. Condition Setting Method Condition Setting Code Bits 3 and 2 Condition Setting Contents 00 Communication performed in mode 0 01 Communication performed in mode 1. 10 Communication performed in mode 2. 11 Undefined Bit 1 0 Fixed at ‘0’ Bit 0 0 Slave transmission block stopped 1 Slave transmission block operational The local-station address and condition setting contents set by INIT command retain their set values unless power is turned off or reset mode is entered (see 4.3 “Reset Mode”). <3> Slave status initialization The slave status is initialized as shown in Table 5-5. 31 µPD6708 Table 5-5. Slave Status after Execution of INIT Command Bit Value Meaning Bit 2 0 Unit is not locked. Bit 0 0 Slave transmit buffer is empty. <4> Slave transmission and broadcast reception are enabled. <5> After the 2-byte command parameter (master address and condition setting code) have been read from the write data buffer (WDB), WDB is cleared. (2) Example When INIT command specifies that the master address is ‘012H’ and the condition setting are ‘communication in mode 1’ and ‘slave data transmission section operable’, the contents of WDB and CMR are as shown below. First Byte WDB 0000 0001 Second Byte 0010 5.2.2 0100 Fourth Byte 0101 Condition Setting Code Master Address CMR Third Byte 0000 SETSA command (command code: 0001) (1) Functions <1> Slave address (12 bits) setting The value for the slave address set by the SETSA command remains unchanged until the power is turned off or the reset mode is entered. <2> This command clears WDB after reading the 2-byte command parameter (slave address) from WDB. (2) Example When SETSA command sets the slave address as ‘024H’, the contents of WDB and CMR are as shown below. First Byte WDB 0000 0010 Slave Address CMR 32 0100 0001 Second Byte 0100 0000 Set to 0000 Third Byte Fourth Byte µPD6708 5.2.3 MREQ1 command (command code: 0010) (1) Functions This command executes a master communication (transmission or reception). After execution of the command, the unit begins communication as the master unit. As long as it does not lose in arbitration, the master unit will communicate with the slave unit which has the slave address specified by SETSA command. <1> Selected broadcast communication or ordinary communication Broadcast communication selection Ordinary communication selection : 0H (broadcast bit ‘0’ output) : 8H (broadcast bit ‘1’ output) <2> Sets the control bits (4 bits) <3> Sets the number of transmit data bytes (8 bits) (transmission only) Table 5-6. Number of Transmit Data Bytes Setting Number of Transmit Data Bytes Command Parameter 1 byte 1H 2 bytes 2H : : : : 255 bytes FFH 256 bytes 00H <4> Sets the transmit data (transmission only) (2) Example When the MREQ1 command is used to select ‘ordinary communication’, set the control bit to ‘AH’ (command write and lock), the number of transmit data bytes to 4, and the transmit data to 12H, 34H, 56H, and 78H, the contents of WDB and CMR are shown below. First Byte WDB CMR 1000 1010 Broadcast Bits Control Bits 0100 0010 Second Byte 0000 0100 Number of Transmit Data Bytes Third Byte 0001 0010 First Data Byte Fourth Byte 0011 0100 Second Data Byte Caution Transmit data 56H and 78H should be set when the above command parameters have been read and WDB is empty. 33 µPD6708 5.2.4 MREQ2 command (command code: 0011) (1) Functions This command re-executes a master communication (transmission or reception). If master transmission or reception stops midway, the master communication is re-executed from the stopped condition. (2) Command execution conditions If a communication control command other than an MREQ2 command is executed after the master communication ends midway, the MREQ1 command may not re-execute the communication correctly from the communication interrupted condition. (3) Example When re-execution is performed by the MREQ2 command when communication has been interrupted due to generation of a timing error after transmission of two bytes (12H and 34H) in mode 1, as in the MREQ1 command example, the contents of WDB and CMR are as shown below. First Byte 0101 WDB 0110 Second Byte 0111 Third Byte Fourth Byte 1000 Data to be Transmitted upon Re-Execution of Command 0100 CMR 0011 The previously set MREQ1 command values are used for the broadcast bits, control bits and number of transmit data bytes. Cautions 1. A master communication performed by execution of the MREQ1 and MREQ2 commands is performed in only one frame. However, if the unit loses in arbitration, the frame is automatically reset up twice (three times in total). 2. INIT command must be executed before setting the MREQ1 or MREQ2 command. If MREQ1 or MREQ2 is set before execution of INIT command, master communication will not be performed. 5.2.5 ABORT command (command code: 0100) (1) Functions This command aborts master communications and slave unit data transmissions. <1> It clears the data placed in WDB. <2> It cancels the slave transmit data (SETSD command). (2) Example When the master unit begins communication as in the MREQ1 command example, a communication error is generated and the two bytes of transmit data (12H and 34H) remaining in WDB are canceled by ABORT command, the contents of CMR are as shown below. 34 µPD6708 [Before execution of ABORT command] First Byte Second Byte WDB 0001 0010 CMR 0100 0100 0011 Third Byte Fourth Byte Third Byte Fourth Byte 0100 [After execution of ABORT command] First Byte Second Byte WDB CMR The data placed in WDB is cleared. 5.2.6 SETSD command (command code: 0101) (1) Functions This command specifies the data transmitted to the master unit when a ‘data read and lock’ (control bits: 3H) or a ‘data read’ (control bits: 7H) is received from the master unit. <1> Sets the number transmit data bytes (8 bits) Table 5-7. Number of Transmit Data Bytes Number of Transmit Data Bytes Command Parameter 1 byte 1H 2 bytes 2H : : : : 64 bytes 40H <2> Sets the transmit data 35 µPD6708 (2) Validity of SETSD command When SETSD command is executed, it remains valid until one of the following cases arises. • ‘Data read and lock’ (control bits: 3H) or ‘data read’ (control bits: 7H) is received from the master unit. • ABORT command is executed. • Power is turned off, or the reset mode is entered. When the SETSD command is valid, WDB functions as the slave transmit buffer. Caution The SETSD command can be executed even if the unit is placed in the slave transmission selection halted state by INIT command. (3) Example When the SETSD command is used to set the number of transmit data bytes to 5, and the transmit data to ABH, CDH, EFH, 14H, and 25H, the contents of WDB and CMR are as shown below. First Byte WDB 0000 0101 Second Byte 1010 Number of Transmit Data Bytes CMR 0100 1011 First Data Byte Third Byte 1100 Fourth Byte 1101 1110 Second Data Byte 1111 Third Data Byte 0101 Caution Transmit data 14H and 25H should be set when the above command parameters have been read and WDB is empty. 5.2.7 GETSTA command (command code: 0110) The GETSTA command is used by a unit to check whether it is locked by another unit. (1) Functions <1> Reads the lock status which indicates whether or not this unit is locked by another unit. ‘1J’ is placed in RDB if the unit is locked, and ‘0H’ if not locked. <2> The address (12 bits) of a locked unit is placed in RDB. This data is meaningless when the unit is not locked. After execution of GETSTA command, the data placed in RDB is as follows. First Byte Lock Status Address of Locked Unit (12 Bits) MSB 36 Second Byte LSB µPD6708 (2) Command setting conditions The reception disabled state must be set and RDB emptied before setting the GETSTA command. Caution With the IEBus, the lock function is provided to enable communication to run over a number of frames. However, if a locked unit goes down without being unlocked, the locked unit is unable to receive any further data. To avoid this situation, in a system which uses the lock function it is necessary to execute the GETSTA command periodically to monitor the lock status (a unit lock is released by executing INIT command). 5.2.8 SETREV command (command code: 0111) (1) Functions <1> Set reception enabled/disabled status • When reception status code is 00H : Set to reception disabled status. In the reception disabled status, bit 1 of the slave status is ‘1’, the slave receive buffer becomes virtually empty and no longer exists, and slave reception and broadcast reception are no longer performed. • When reception status code is 01H : Set to reception enabled status. When the prescribed conditions are met, slave reception and broadcast reception are performed. The reception enabled status is also set when a command other than SETREV is executed. <2> This command clears WDB after reading the 1-byte command parameter (reception status code) from WDB. 37 µPD6708 6. RETURN CODES The µPD6708 sets the communication status as a return code in lower 4 bits of the status register (STR) and requests an interrupt (IRQ output). As a result of the interrupt request from the µPD6708, the host controller can ascertain the communication result by reading the return code in the status read mode. 6.1 Return Codes in Master/Slave Data Transmission Table 6-1 shows the return codes placed in the status register when a unit has executed the MREQ1 or MREQ2 command and becomes the master unit (including broadcast communication), and when the SETSD command is executed and the slave unit transmits data. Table 6-1. Return Codes in Master/Slave Transmission Return Code Name Code Description Transmission start 0000 Indicates that master/slave transmission will start. The point of generation differs between master transmission and slave transmission. <1> Master transmission Set when the master address field ends and the unit wins as the master unit. <2> Slave transmission Set when control bits (3H, 7H) which request data transmission are received from the master unit. Transmission normal termination 0010 Indicates that transmission of the number of data bytes specified by the message length bits has ended within one frame. Termination during transmission 0011 Indicates that the communication has ended without completion of transmission of the number of data bytes specified by the message length bits within one frame. In master transmission, termination during transmission is not flagged if the unit loses once in arbitration, and transmission is attempted up to three times. 6.2 Return Codes in Master Reception Table 6-2 shows the return codes placed in STR when a unit has executed the MREQ1 or MREQ2 command and becomes the master unit, and receives data, a status or lock address from a slave unit. 38 µPD6708 Table 6-2. Return Codes in Master Reception Return Code Name Code Description Master reception start 0100 This return code is generated when the master unit correctly receives the message length code from the slave unit, informing the host controller of the start of master reception. Master receive data full 0101 Each time 20 bytes (RDB capacity) of master receive data is received, if RDB is full, this return code makes a request to the host controller for a read of receive data from RDB. Master reception normal termination 0110 Indicates that reception of the number of data bytes specified by the message length bits has ended within one frame. Termination during master reception 0111 Indicates that the communication has ended without completion of transmission of the number of data bytes specified by the message length bits within one frame. Termination during master reception is not flagged if the unit loses once in arbitration, and reception is attempted up to three times. 6.3 Return Codes in Slave Reception Table 6-3 shows the return codes placed in STR when data or a command is received from the master unit. Table 6-3. Return Codes in Slave Reception Return Code Name Code Description Slave reception start 1000 This return code is generated when the slave unit correctly receives the message length codes from the master unit, informing the host controller of the start of slave reception. Slave receive data full 1001 Each time 20 bytes (RDB capacity) of slave receive data is received, if RDB is full, this return code makes a request to the host controller for a read of receive data from RDB. Slave reception normal termination 1010 Indicates that reception of the number of data bytes specified by the message length bits has ended within one frame. Termination during slave reception 1011 Indicates that the communication has ended without completion of transmission of the number of data bytes specified by the message length bits within one frame. 6.4 Return Codes in Broadcast Reception Table 6-4 shows the return codes placed in STR when data or a command is received from the master unit in broadcast communication. 39 µPD6708 Table 6-4. Return Codes in Broadcast Reception Return Code Name Code Description Broadcast reception start 1100 This return code is generated when the slave unit correctly receives the message length codes from the master unit, informing the host controller of the start of slave reception. Broadcast receive data full 1101 Each time 20 bytes (RDB capacity) of slave receive data is received, if RDB is full, this return code makes a request to the host controller for a read of receive data from RDB. Broadcast reception normal termination 1110 Indicates that reception of the number of data bytes specified by the message length bits has ended within one frame. Termination during broadcast reception 1111 Indicates that the communication has ended without completion of transmission of the number of data bytes specified by the message length bits within one frame. 6.5 Return Codes Generation Intervals This section describes the generation order and the minimum generation interval for return codes generated each time communication is performed, Each time a new return code is generated, it is placed in STR without regard to STR read. For this reason, the host controller must take account of the minimum return code generation interval in controlling the µPD6708. (1) Master transmission After execution of the MREQ1 or MREQ2 command, the order of generation of master transmission return codes is as shown in Figure 6-1. Figure 6-1. Return Code Generation Order in Master Transmission T1 Transmission Start (Return Code : 0000) T2 Transmission Normal Termination (Return Code : 0010) Termination During Transmission (Return Code : 0011) Termination During Transmission (Return Code : 0011) T3 New communication return codes • Slave reception start (Return code : 1000) T3 • Broadcast reception start (Return code : 1100) etc. T3 The minimum generation intervals for return codes in master transmission are shown below. Table 6-5. Minimum Generation Intervals for Return Codes in Master Transmission (µs) 40 Time Mode 0 Mode 1 Mode 2 T1 Approx. 6325 Approx. 1605 Approx. 1160 T2 Approx. 10 Approx. 10 Approx. 10 T3 Approx. 7290 Approx. 2050 Approx. 1550 µPD6708 (2) Slave transmission After execution of the SETSD command, the order of generation of slave transmission return codes is as shown in Figure 6-2. Figure 6-2. Return Code Generation Order in Slave Transmission T1 Transmission Normal Termination (Return Code : 0010) T2 Termination During Transmission (Return Code : 0011) Transmission Start (Return Code : 0000) T3 New communication return codes • Slave reception start (Return code : 1000) T3 • Broadcast reception start (Return code : 1100) etc. The minimum generation intervals for return codes in slave transmission are shown below. Table 6-6. Minimum Generation Intervals for Return Codes in Slave Transmission (µs) Time Mode 0 Mode 1 Mode 2 T1 Approx. 1580 Approx. 400 Approx. 290 T2 Approx. 10 Approx. 10 Approx. 10 T3 Approx. 7290 Approx. 2050 Approx. 1550 (3) Master reception After execution of the MREQ1 or MREQ2 command, the order of generation of master reception returns codes is as shown in Figure 6-3. Figure 6-3. Return Code Generation Order in Master Reception T1 Master Receive Buffer Full (Return Code : 0101) T1 Master Reception Start (Return Code : 0100) T2 T3 Termination During Master Reception (Return Code : 0111) T2 T3 Master Reception Normal Termination (Return Code : 0110) Termination During Master Reception (Return Code : 0111) Master Receive Buffer Full (Return Code : 0101) Master Reception Normal Termination (Return Code : 0110) Termination During Master Reception (Return Code : 0111) T4 New communication return codes T4 • Slave reception start (Return code : 1000) T4 • Broadcast reception start (Return code : 1100) etc. T4 T4 The minimum generation intervals for return codes in master transmission are shown below. 41 µPD6708 Table 6-7. Minimum Generation Intervals for Return Codes in Master Reception (µs) Time Mode 0 Mode 1 Mode 2 T1 Note Approx. 8030 Approx. 5800 T2 Approx. 1580 Approx. 400 Approx. 290 T3 Approx. 10 Approx. 10 Approx. 10 T4 Approx. 7290 Approx. 2050 Approx. 1550 Note The mode 0 master receive data consists of up to 19 bytes. Therefore, the receive buffer (20 bytes) does not become full, and a return code is not generated. (4) Slave reception The order of generation of slave reception return codes is as shown in Figure 6-4. Figure 6-4. Return Code Generation Order in Slave Reception T1 Slave Receive Buffer Full (Return Code : 1001) T1 Slave Reception Start (Return Code : 1000) T2 T3 T2 Slave Reception Normal Termination (Return Code : 1010) T3 Slave Receive Buffer Full (Return Code : 1001) Slave Reception Normal Termination (Return Code : 1010) Termination During Slave Reception (Return Code : 1011) T4 New communication return codes T4 • Slave reception start (Return code : 1000) T4 Termination During Slave Reception (Return Code : 1011) • Broadcast reception start (Return code : 1100) etc. T4 The minimum generation intervals for return codes in master transmission are shown below. Table 6-8. Minimum Generation Intervals for Return Codes in Slave Reception (µs) Time Mode 0 Mode 1 Mode 2 T1 Note Approx. 8030 Approx. 5800 T2 Approx. 1580 Approx. 400 Approx. 290 T3 Approx. 10 Approx. 10 Approx. 10 T4 Approx. 7290 Approx. 2050 Approx. 1550 Note The mode 0 master receive data consists of up to 19 bytes. Therefore, the receive buffer (20 bytes) does not become full, and a return code is not generated. (5) Broadcast reception The return code generation order and minimum generation intervals in the case of broadcast reception are the same as for (4) Slave reception as shown above. 42 µPD6708 7. COMMUNICATING WITH HOST CONTROLLER This section explains the flow of data between the µPD6708 and the host controller via the serial interface (SCK, SO, SI pins) during communications. 7.1 Master Transmission Master transmission is the communication data exchange which takes place when a unit becomes a master unit by specifying AH, BH, and FH as control bits and executing the MREQ1 or MREQ2 command, and then transmitting data and commands to slave units. 7.1.1 Master transmission by MREQ1 command (1) The control bits, number of transmit data bytes and transmit data are placed in the write WDB as command parameters as shown in Figure 7-1, and the MREQ1 command (command code: 2H) is executed. (2) When a unit wins in arbitration as the master unit (the end of the master address field), the transmission start return code (0H) is placed in the status register (STR), and an interrupt request is generated for the host controller. At this time, the host controller places the third and following bytes of transmit data in WDB. Figure 7-1. Data Exchange During Master Transmission (Contents of WDB) First Byte WDB Broadcast Bits Control Bits Second Byte Number of Transmit Data Bytes Third Byte Fourth Byte Transmit Data (First Byte) Transmit Data (Second Byte) (3) If the number of data or command bytes specified by “number of transmit data bytes” are transmitted correctly, a “transmission end” return code (2H) will be placed in STR and an interrupt request will be generated. (4) If an error occurs during transmission and the data communication is halted, a “termination during transmission” return code (3H) will be placed in STR and an interrupt request will be generated. The timing at which the µPD6708 reads transmit data from WDB is shown below. Table 7-1. Timing for Reading Transmit Data from WDB (The minimum time after transmission start return code (0H) is set in STR) Timing for Reading Transmit Data from WDB (µs) Transmit Data Mode 0 Mode 1 Mode 2 Transmit data (first byte) Approx. 4745 Approx. 1205 Approx. 870 Transmit data (second byte) Approx. 6325 Approx. 1605 Approx. 1160 : : : Approx. 3165+1580 × N Approx. 805+400 × N Approx. 580+290 × N : Transmit data (N-th byte) 43 µPD6708 7.1.2 Master transmission by MREQ2 command If the MREQ1 command is executed and a communication error occurs during the transmission of data or a command, with the result that not all the data is transmitted, the remaining data can be transmitted by executing the MREQ2 command. (1) The remaining data is placed in WDB as command parameters as shown in Figure 7-2, and the MREQ2 command (command code: 3H) is executed. Figure 7-2. Data Exchange During Master Transmission (Contents of Write Data Buffer) WDB First Byte Second Byte Third Byte Fourth Byte Transmit Data (N-th Byte) Transmit Data (Byte N+1) Transmit Data (Byte N+2) Transmit Data (Byte N+3) The remaining operations are the same as 7.1.1 “Master transmission by MREQ1 command”. 7.2 Slave Transmission 7.2.1 Data transmission When the slave unit receives control bit 3H or 7H from the master unit, it transmits data as follows. (1) It places the number of transmit data bytes and transmit data in WDB as command parameters as shown in Figure 7-3, and executes the SETSD command (command code: 5H). (2) When the unit receives control bit 3H or 7H from the master unit, the “transmission start” return code (0H) is placed in STR, and an interrupt request is generated. At this time, the host controller places the fourth and following bytes of transmit data in WDB. Figure 7-3. Data Exchange During Slave Transmission (Contents of WDB) First Byte WDB Number of Transmit Data Bytes Second Byte Third Byte Fourth Byte Transmit Data (First Byte) Transmit Data (Second Byte) Transmit Data (Third Byte) (3) If the number of data or command bytes specified by “number of transmit data bytes” is transmitted correctly, a “transmission end” return code (2H) will be placed in STR and an interrupt request will be generated. (4) If an error occurs during transmission and the data communication is halted, a “termination during transmission” return code (3H) will be placed in STR and an interrupt request will be generated. The timing at which the µPD6708 reads transmit data from WDB is shown below. 44 µPD6708 Table 7-2. Timing for Reading Transmit Data from WDB (The minimum time after transmission start return code (0H) is set) Timing for Reading Transmit Data from WDB (µs) Transmit Data Mode 0 Mode 1 Mode 2 Transmit data (first byte) Approx. 1580 Approx. 400 Approx. 290 Transmit data (second byte) Approx. 3160 Approx. 800 Approx. 580 : : : Approx. 1580 × N Approx. 400 × N Approx. 290 × N : Transmit data (N-th byte) 7.2.2 Transmitting slave status address and lock address When the µPD6708 receives 0H, 4H, 5H, and 6H as control bits from the master unit, the slave status and lock address are generated automatically and sent to the master unit. As a result, there is no necessity for the host controller to be involved in the transmission of the slave status and lock address. 7.3 Master Reception When a unit becomes a master unit by setting 0H, 3H, 4H, 5H, 6H, and 7H as control bits and executing the MREQ1 or MREQ2 command, and receives data, slave status and lock address from the slave unit, the following will occur. (1) When the master unit returns an acknowledge in the message length field, the slave address, control bits and message length bits are placed in the read data buffer (RDB) by the MREQ1 command as shown in Figure 7-4, the “master reception start” return code (6H) is placed in STR, and an interrupt request is generated. Figure 7-4. Data Exchange During Master Reception (Contents of RDB) First Byte RDB Slave Address (12 Bits) Second Byte Control Bits Third Byte Fourth Byte Onward Message Length Bits (2) Each time one byte of receive data is received, it is placed in RDB. (3) Each time 20 bytes (RDB capacity) of receive data are received, if RDB is full, a “master receive buffer full” return code (5H) is placed in STR, and an interrupt request is generated. (4) After one frame of data is placed in RDB, a “master reception normal termination” return code (6H) is placed in STR and an interrupt request is generated. (5) If a communication error occurs during reception and communication stops without receiving all of the data transmitted from the slave unit, a “termination during master reception” return code (7H) is placed in STR and an interrupt request is generated. The areas where µPD6708 places receive data, etc., in RDB are shown below. 45 µPD6708 Table 7-3. Placing Receive Data in RDB Parameter/ Time (µs) Areas where RDB is read Communication Data Slave address When ACK bit is transmitted in message length field Note Mode 0 Mode 1 Mode 2 0 0 0 Control bits Message length bits Receive data (first byte) When first ACK bit is transmitted in data field Approx. 1580 Approx. 400 Approx. 290 Receive data (second byte) When second ACK bit is transmitted in data field Approx. 3160 Approx. 800 Approx. 580 Receive data (N-th byte) When N-th ACK bit is transmitted in data field Approx. 1580 × N Approx. 400 × N Note 7.4 Approx. 290 × N Minimum time after the “master reception start” return code is placed in STR and an interrupt request is generated. Slave Reception If a slave unit receives AH, BH, EH, or FH as control bits from the master unit and receive data or a command, the following will occur. (1) When the slave unit returns an acknowledge in the message length field, the master address, control bits and message length bits are placed in RDB as shown in Figure 7-5, a “ slave reception start” return code (8H) is placed in STR, and an interrupt request is generated. Figure 7-5. Data Exchange During Slave Reception (Contents of RDB) First Byte RDB Master Address (12 Bits) Second Byte Control Bits Third Byte Fourth Byte Onward Message Length Bits (2) Each time one byte of receive data is received, it is placed in RDB. (3) Each time 20 bytes (RDB capacity) of receive data are received, if RDB is full, a “slave receive buffer full” return code (9H) is placed in STR, and an interrupt request is generated. (4) After the final data of one frame is placed in RDB, a “slave reception normal termination” return code (AH) is placed in STR and an interrupt request is generated. (5) If a communication error occurs during reception and communication stops without receiving all of the data transmitted from the master unit, a “termination during slave reception” return code (BH) is placed in STR and an interrupt request is generated. The areas where the µPD6708 places receive data, etc., in RDB are shown below. 46 µPD6708 Table 7-4. Placing Receive Data in RDB Parameter/ Communication Data Master address Time (µs) Areas where RDB is read When ACK bit is received in message length field Note Mode 0 Mode 1 Mode 2 0 0 0 Control bits Message length bits Receive data (first byte) When first ACK bit is received in data field Approx. 1580 Approx. 400 Approx. 290 Receive data (second byte) When second ACK bit is received in data field Approx. 3160 Approx. 800 Approx. 580 Receive data (N-th byte) When N-th ACK bit is received in data field Note 7.5 Approx. 1580 × N Approx. 400 × N Approx. 290 × N Minimum time after the “slave reception start” return code is placed in STR and an interrupt request is generated. Broadcast Reception (1) When a broadcast reception unit receives the message length field, the master address, control bits and message length bits are placed in RDB as shown in Figure 7-6, a “broadcast reception start” return code (CH) is placed in STR, and an interrupt request is generated. Figure 7-6. Data Exchange During Broadcast Reception (Contents of RDB) First Byte RDB Master Address (12 Bits) Second Byte Control Bits Third Byte Fourth Byte Onward Message Length Bits (2) Each time one byte of receive data is received, it is placed in RDB. (3) Each time 20 bytes (RDB capacity) of receive data are received, if RDB is full, a “slave receive buffer full” return code (DH) is placed in STR, and an interrupt request is generated. (4) After the final data of one frame is placed in RDB, a “broadcast reception normal termination” return code (EH) is placed in STR and an interrupt request is generated. (5) If a communication error occurs during reception and communication stops without receiving all of the data transmitted from the master unit, a “termination during broadcast reception” return code (FH) is placed in STR and an interrupt request is generated. The areas where the µPD6708 places receive data, etc., in RDB are the same as those shown in Table 7-4. 47 µPD6708 8. EXAMPLE OF HOST CONTROLLER PROCESSING FLOW This chapter presents an example of the host controller processing flow for controlling the µPD6708 via the serial interface (SCK, SO, and SI pins). The host controller processing flow comprises the following routines. • Main routine • Interrupt service routine 8.1 Main Routine Start Equipment initialization µPD6708 initialization routine Command processing routine Normal End 0 1 See 8.3.2 Exit Crq Note See 8.3.1 Equipment control routine Note Note 48 The equipment control routine is a routine which performs host controller application processing. When controlling the µPD6708, set the Crq flag when there is a command request. µPD6708 8.2 Interrupt Service Routine This routine is used when an interrupt request is generated from the µPD6708 (when IRQ pin becomes high). This routine reads the contents of the return code, performs flag setting, and reads receive data. Start Disable interrupts from µPD6708 Y Is SIO register used? This processing is not necessary if interrupts are disabled when SIO is used in the main routine. N Save value of I/O port which controls µPD6708 C/D and R/W pins, and value of SIO register in host controller Read STR Return code classification Most significant 2 bits of return code 00 Y Master transmission processing routine Note 1 Master? 01 N Slave data transmission processing routine Note 2 Master reception processing routine Note 3 10 11 Slave reception processing routine Broadcast reception processing routine Restore value of I/O port which controls µPD6708 C/D and R/W pins, and value of SIO register in host controller Notes 1. See 8.3.3. 2. See 8.3.4. Enable interrupts from µPD6708 3. See 8.3.5. RETI End 49 µPD6708 8.3 8.3.1 Processing Routine µPD6708 initialization routine Start Reset µ PD6708 CMR ← 00H INIT command setting Drive the host controller port which controls the µPD6708 RESET pin low for 6 µs or longer, then return it to high. (Not necessary when a hardware reset such as a power-on reset is executed.) Place 00H in the command register. Release reset mode. Set unit address slave unit condition with INIT command. Normal end • INIT command setting flow Start Read STR N WDB empty? Y EXIT Write to WDB Unit Address Setting (Higher 8 Bits) Write to WDB Unit Address (Lower 4 Bits) Slave Unit Condition Setting Write to CMR Set command code (0H). Normal end 50 µPD6708 8.3.2 Communication control command processing routine This processing routine sets the µPD6708 communication control commands SETSA, MREQ1, MREQ2, ABORT, GETSA, and SETREV. Processing starts when there is a command request during equipment control (Crq = 1) (1) SETSA command Start Read STR N WDB empty? Y EXIT Write to WDB Slave Address Setting (Higher 8 Bits) Write to WDB Slave Address (Lower 4 Bits) Communication Mode Setting Write to CMR Set command code (1H). Normal end 51 µPD6708 (2) MREQ1 command When MSB of the control bits is 1 (master transmission) Start Read STR N WDB empty? Y EXIT Write to WDB Set broadcast bits and control bits. Write to WDB Set number of master transmit data bytes. Write to WDB Set master transmit data (first byte). Write to WDB Set master transmit data (second byte). N1 ← (Number of master transmit data bytes) – 2 Write to CMR Normal end 52 Set command code (2H). µPD6708 (3) MREQ2 command After master transmission ends midway Start Read STR WDB full? N Write to WDB Set master transmit data. Y Write to CMR Set command code (3H). Normal end (4) MREQ1 command When MSB of the control bits is 0 (master reception) Start Read STR N EXIT WDB and RDB empty? Y Write to WDB Set broadcast bits and control bits. Write to CMR Set command code (2H). Normal end 53 µPD6708 (5) MREQ2 command When master reception ends midway Start Read STR N EXIT WDB and RDB empty? Y Write to CMR Set command code (3H). Normal end (6) ABORT command Start Write to CMR Normal end 54 Set command code (4H). µPD6708 (7) SETSD command Start Read STR N WDB empty? Y EXIT Write to WDB Set number of slave transmit data bytes. Write to WDB Set slave transmit data (first byte). Write to WDB Set slave transmit data (second byte). Write to WDB Set slave transmit data (third byte). N2 ← (Number of slave transmit data bytes) – 3 Write to CMR Slave transmission timer setting Set command code (5H). If the slave data transmission processing shown in 8.3.4 cannot be completed because control bits (3H, 7H) requesting slave data transmission were not received from the master unit within the prescribed time, an ABORT command is executed and slave data transmission is exited. Normal end 55 µPD6708 (8) GETSTA command Start Read STR N WDB empty? Y Write to WDB Set reception status code (reception disabled : 00H). Write to CMR Set SETREV command code (7H). Read STR N WDB and RDB empty? Y EXIT Write to CMR Set GETSTA command code (6H). Read STR RDB empty? Y N Read RDB Read lock status (4 bits) and lock address (higher 4 bits). Read RDB Read lock address (higher 8 bits). Normal end 56 µPD6708 8.3.3 Master transmission processing routine This processing routine is used when a unit becomes the master unit after executing the MREQ1 or MREQ2 command and transmits data and commands to a slave unit. This routine is an interrupt service routine, and is executed when the return code (higher 2 bits = 00) is read in master transmission. Start Read STR Y Return code 3H? N Note 1 Note 2 Termination during transmission N1 = 0 N Y WDB full? Y N Write to WDB Set master transmit data. Note 2 N1 ← N1 – 1 Return code 2H? N Y Normal end Notes 1. To transmit the remaining data, execute the MREQ2 command (see 8.3.2 (3)). To abort master transmission, execute the ABORT command (see 8.3.2 (6)). 2. N1: Number of master transmit data bytes. 57 µPD6708 8.3.4 Slave data transmission processing routine This processing routine is used when a slave unit transmits data to the master unit after setting the SETSD command. This routine is an interrupt service routine, and is executed when the return code (higher 2 bits = 00) is read in slave data transmission. Start Read STR Y Return code 3H? N Note 1 Note 2 Termination during transmission N2 = 0 N Y WDB full? Y N Write to WDB Set slave transmit data. Note 2 N2 ← N2 – 2 Return code 2H? N Y Normal end Notes 1. Untransmitted data in WDB is cleared by executing the ABORT command (see 8.3.2 (6)). 2. N2: Number of slave transmit data bytes 58 µPD6708 8.3.5 Master reception processing routine This processing routine is used when the master unit receive data, slave status and lock address after execution of the MREQ1 or MREQ2 command. One of four different routines is executed depending on the contents of the return code. (1) Processing in case of master reception start return code (4H) Start Mre ← 1 Set master reception flag (Mre). Read RDB Read slave address (higher 8 bits). Read RDB Read slave address (lower 4 bits) and control bits. Read RDB Read number of master receive data bytes. N3 ← Number of master receive data bytes Normal end 59 µPD6708 (2) Processing in case of master receive buffer full return code (5H) Start I ← 20 Set master receive buffer size. I←I–1 I=0? Y N END Read RDB Read master receive data. Note N3 ← N3 – 1 Note 60 N3: Number of master receive data bytes µPD6708 (3) Processing in case of master reception normal end return code (6H) Start Y Mre = 1 ? N Mre ← 1 Set master reception flag (Mre). Read RDB Read slave address (higher 8 bits). Read RDB Read slave address (lower 4 bits) and control bits. Read RDB Read number of master receive data bytes. N3 ← number of master receive data bytes Read RDB Read master receive data. N3 ← N3 – 1 N N3 = 0 ? Y Mre ← 0 End 61 µPD6708 (4) Processing in case of end during master reception return code (7H) Start Y Mre = 1 ? N Mre ← 1 Set master reception flag (Mre). Read RDB Read slave address (higher 8 bits). Read RDB Read slave address (lower 4 bits) and control bits. Read RDB Read number of master receive data bytes. N3 ← number of master receive data bytes Read STR Note RDB empty ? Y N Read RDB Mre ← 0 Read master receive data. End Note To distinguish data from receive data (slave reception, broadcast reception) newly input in the next communication frame, after reading RDB (inputting one serial clock pulse to SCK pin), STR should be read (inputting one serial clock pulse to SCK pin) within the time shown below. • When the next frame is mode 2 • When the next frame is mode 1 : Approx. 290 µs : Approx. 400 µs • When the next frame is mode 0 : Approx. 1580 µs However, the above time limits for reading STR do not apply if this processing routine is executed in the reception disabled state after executing the SETREV command. The flowcharts for slave reception processing and broadcast reception processing are the same as for master reception processing, and are therefore omitted here. 62 µPD6708 9. ELECTRICAL SPECIFICATIONS Absolute Maximum Ratings (TA = 25 °C) PARAMETER Power supply Logic input voltage SYMBOL VDD, AVDD TEST CONDITIONS RATINGS UNIT –0.5 to +7.0 V –0.5 to VDD + 0.3 V –0.5 to VDD + 0.3 V –0.5 to + 6.0 V | VDD – AVDD | < 0.5 V VI The pin without BUS+ and BUS– Logic output voltage VO Bus input voltage VBI BUS+ and BUS– Bus output voltage VBO –0.5 to + 6.0 V Operating ambient temperature TA –40 to + 85 °C Storage temperature Tstg –65 to + 150 °C DC Characteristics (TA = –40 to +85 °C, VDD = AVDD = 5 V ±10 %) PARAMETER SYMBOL TEST CONDITIONS MIN. TYP. MAX. UNIT Input voltage high VIH 0.8VDD VDD V Input voltage low VIL 0 0.2VDD V Output voltage high VOH IOH = –400 µA Output voltage low VOL IOL = 2.5 mA 0.4 V Input leakage current high ILIH VI = VDD 10 µA Input leakage current low ILIL VI = 0 V –10 µA Output leakage current high ILOH VO = VDD 10 µA Output leakage current low ILOL VO = 0 V –10 µA IDD1 Carrier sense 3.5 10 mA IDD2 Reset mode 1.2 3 mA TYP. MAX. UNIT 0.7VDD V Supply current Capacitance Characteristics (TA = 25 °C, VDD = AVDD = 0 V) PARAMETER SYMBOL TEST CONDITIONS MIN. Input capacitance CI fc = 1 MHz, 15 pF Input/output capacitance CIO unmeasured pins returned to 0 V 15 pF 63 µPD6708 Recommended Ceramic Resonator (12 MHz) Recommended Crystal Resonator (12 MHz) External Capacities [pF] Manufacturer Murata Mfg. CST12.0MT Note 1 CSA12.00MX241 Kyocera Corp. ★ External Capacities [pF] Product Name KBR-12.0M Note 2 Manufacturer C1 C2 –– –– 30 30 33 33 Kinseki, Ltd Product Name HC-49/U C1 C2 22 22 Recommended Ceramic Resonator (12.58 MHz) External Capacities [pF] Manufacturer Product Name Murata Mfg. CSTCS12.5MTA 904 TDK FCR12.58M2S Note 1 Note 1 C1 C2 –– –– 33 33 Notes 1. Can only be used when communication mode 0 or 1 is used (frequency accuracy: ±1.5 %). 2. This is a custom product, and therefore the manufacturer should be contacted directly. ★ Caution The oscillation circuit constants and oscillation voltage range shown above indicate the condition under which oscillation is stable and do not guarantee the oscillation frequency accuracy. If a high oscillation frequency accuracy is required from the actual circuit, the resonator mounted to the actual circuit must be adjusted. For details, directly consult the manufacturer of the resonator. ★ External Circuit XI XO GND C1 C2 Caution Wire the dotted portion in the above figure as follows to prevent adverse influences of wiring capacitance when using the system clock oscillation circuit. • Keep the wiring length as short as possible. • Do not cross the wiring with any other signal lines. • Do not place the wiring in the vicinity of a line through which a high alternating current flows. • Always keep the ground point of the capacitor of the oscillation circuit at the same potential as VSS. • Do not ground the wiring to a ground pattern through which a high current flows. • Do not extract signals from the oscillation circuit. 64 µPD6708 AC Characteristics (TA = –40 to +85 °C, VDD = AVDD = 5 V ±10 %) PARAMETER SYMBOL System clock TEST CONDITIONS fX = 12 MHz fX = 12.58 MHz MIN. TYP. MAX. UNIT Using communication mode 2 11.94 12.00 12.06 MHz Using communication mode 0,1 11.82 12.00 12.18 MHz Using communication mode 2 12.52 12.58 12.64 MHz Using communication mode 0,1 12.40 12.58 12.76 MHz SCK cycle time tKCY 0.8 µs SCK high-level width tKH 0.4 µs SCK low-level width tKL 0.4 µs SI setup time (to SCK↑) tSIK 100 ns SI hold time (from SCK↑) tKSI 400 ns SO output delay time (from SCK↑) tKSO CS, C/D, R/W setup time (to SCK↑) tSA 0 ns CS, C/D, R/W hold time (from SCK↑) tHA 400 ns 400 ns 300 CS high-level width µs IRQ output high-level width 8 RESET low-level width 6 µs 20 ms Oscillation stabilization time tOS fX = 12 MHz 11 ns Serial Transfer Timing tHA tSA CS, C/D, R/W tKYC tKL tKH SCK tSIK SI tKSI Data Input tKSO SO Data Output 65 µPD6708 IEBus Driver/Receiver Characteristics (TA = –40 to +85 °C, VDD = AVDD = 5 V ±10 %) PARAMETER SYMBOL Output current high IOH Output current low IOL In-phase output voltage VOCOM Input voltage high VIH Input voltage low VIL Input hysteresis voltage TEST CONDITIONS RL = 60 Ω ±5 % When high and low MIN. TYP. – 2.73 VDD –0.25 2 VDD 2 MAX. UNIT – 6.22 mA 1.0 µA VDD +0.25 2 V 120 mV 20.0 VIHYS 25 mV mV In-phase input voltage high VIHCOM 1.00 VDD – 1.0 V In-phase input voltage low VILCOM 0 VDD V Driver output resistance RO Between BUS + and BUS – Driver output capacitance CO Receiver input capacitance CI Between BUS + and BUS –, Between BUS + and GND, Between BUS – and GND 66 100 kΩ 25 pF 25 pF µPD6708 10. PACKAGE DRAWINGS 16 PIN PLASTIC DIP (300 mil) ★ 16 9 1 8 A I K L H G J P F C D N R M B M NOTES 1) Each lead centerline is located within 0.25 mm (0.01 inch) of its true position (T.P.) at maximum material condition. 2) Item "K" to center of leads when formed parallel. ITEM MILLIMETERS INCHES A 20.32 MAX. 0.800 MAX. B 1.27 MAX. 0.050 MAX. C 2.54 (T.P.) D 0.50±0.10 0.100 (T.P.) +0.004 0.020 –0.005 F 1.1 MIN. 0.043 MIN. G 3.5±0.3 0.138±0.012 H 0.51 MIN. 0.020 MIN. I 4.31 MAX. 0.170 MAX. J 5.08 MAX. 0.200 MAX. K L 7.62 (T.P.) 6.5 0.300 (T.P.) 0.256 M 0.25 +0.10 –0.05 0.010 +0.004 –0.003 N 0.25 0.01 P 1.1 MIN. 0.043 MIN. R 0∼15° 0∼15° P16C-100-300B-1 67 µPD6708 16 PIN PLASTIC SOP (300 mil) 16 9 P detail of lead end 1 8 A H J E K F G I C N D M B L M NOTE Each lead centerline is located within 0.12 mm (0.005 inch) of its true position (T.P.) at maximum material condition. ITEM MILLIMETERS INCHES A 10.46 MAX. 0.412 MAX. B 0.78 MAX. 0.031 MAX. C 1.27 (T.P.) 0.050 (T.P.) D 0.40 +0.10 –0.05 0.016 +0.004 –0.003 E 0.1±0.1 0.004±0.004 F 1.8 MAX. 0.071 MAX. G 1.55 0.061 H 7.7±0.3 0.303±0.012 I 5.6 0.220 J 1.1 0.043 K 0.20 +0.10 –0.05 0.008 +0.004 –0.002 L 0.6±0.2 0.024 +0.008 –0.009 M 0.12 0.005 N 0.10 0.004 P 3° +7° –3° 3° +7° –3° P16GM-50-300B-4 68 µPD6708 11. RECOMMENDED SOLDERING CONDITIONS This product should be soldered and mounted under the conditions recommended in the table below. For details of recommended soldering conditions, refer to the information document Semiconductor Device Mounting Technology Manual (IEI-1207). For soldering methods and conditions other than those recommended, please contact NEC representative. Table 11-1. Surface Mount Type Soldering Conditions µPD6708GS : 16-pin plastic SOP (300 mil) Soldering Method Infrared ray reflow VPS reflow Soldering Conditions Symbol Package peak temperature: 230 °C, Reflow time: 30 seconds or less (at 210 °C or higher), Number of reflow processes: 1 IR30-00-1 Package peak temperature: 215 °C, Reflow time: 40 seconds or less (at 200 °C or VP15-00-1 higher), Number of reflow processes: 1 Partial heating Pin temperature: 300 °C or below, Flow time: 3 seconds or less (per side of device) –– Caution Use of more than one soldering method should be avoided (except for partial heating). Table 11-2. Hole-Through Type Soldering Conditions µPD6708CX : 16-pin plastic DIP (300mil) Soldering Method Soldering Conditions Wave soldering (pin only) Solder temperature: 260 °C or below, Flow time: 10 seconds or less Partial heating Pin temperature: 300 °C or below, Flow time: 3 seconds or less (per pin) ★ Caution Wave soldering is used on the pin only, and care must be taken to prevent solder from coming into direct contact with the package body. 69 µPD6708 ★ APPENDIX MAJOR DIFFERENCES BETWEEN µPD6708 AND µPD72042A, µPD72042B µPD6708 Part Number µPD72042A µPD72042B Parameter Oscillation frequency (fX) 12 MHz Supply voltage (VDD) 5 V ±10 % Operating ambient temperature (TA) –40 to +85 ˚C IEBus Communication mode Modes 0, 1, and 2 Driver/receiver Provided External protection resistor Not necessary Necessary (connect 180 Ω in series to BOS+ and BOS–) Transmit buffer 4 Bytes 33 Bytes Receive buffer 20 Bytes 40 Bytes Serial interface (3-wire) Serial interface (3-wire/2-wire) MSB first MSB first 16-pin SOP (300 mil) 16-pin SOP (375 mil) Interfacing with microcontroller Package Note 6 MHz LSB first 16-pin DIP (300 mil) Note 70 Setting commands/data and related pins differs between the µPD6708 and µPD72042A, µPD72042B. µPD6708 NOTES FOR CMOS DEVICES 1 PRECAUTION AGAINST ESD FOR SEMICONDUCTORS Note: Strong electric field, when exposed to a MOS device, can cause destruction of the gate oxide and ultimately degrade the device operation. Steps must be taken to stop generation of static electricity as much as possible, and quickly dissipate it once, when it has occurred. Environmental control must be adequate. When it is dry, humidifier should be used. It is recommended to avoid using insulators that easily build static electricity. Semiconductor devices must be stored and transported in an anti-static container, static shielding bag or conductive material. All test and measurement tools including work bench and floor should be grounded. The operator should be grounded using wrist strap. Semiconductor devices must not be touched with bare hands. Similar precautions need to be taken for PW boards with semiconductor devices on it. 2 HANDLING OF UNUSED INPUT PINS FOR CMOS Note: No connection for CMOS device inputs can be cause of malfunction. If no connection is provided to the input pins, it is possible that an internal input level may be generated due to noise, etc., hence causing malfunction. CMOS device behave differently than Bipolar or NMOS devices. Input levels of CMOS devices must be fixed high or low by using a pull-up or pull-down circuitry. Each unused pin should be connected to VDD or GND with a resistor, if it is considered to have a possibility of being an output pin. All handling related to the unused pins must be judged device by device and related specifications governing the devices. 3 STATUS BEFORE INITIALIZATION OF MOS DEVICES Note: Power-on does not necessarily define initial status of MOS device. Production process of MOS does not define the initial operation status of the device. Immediately after the power source is turned ON, the devices with reset function have not yet been initialized. Hence, power-on does not guarantee out-pin levels, I/O settings or contents of registers. Device is not initialized until the reset signal is received. Reset operation must be executed immediately after power-on for devices having reset function. 71 µPD6708 IEBus and Inter Equipment Bus are trademarks of NEC Corporation. The export of this product from Japan is prohibited without governmental license. To export or re-export this product from a country other than Japan may also be prohibited without a license from that country. Please call an NEC sales representative. No part of this document may be copied or reproduced in any form or by any means without the prior written consent of NEC Corporation. NEC Corporation assumes no responsibility for any errors which may appear in this document. NEC Corporation does not assume any liability for infringement of patents, copyrights or other intellectual property rights of third parties by or arising from use of a device described herein or any other liability arising from use of such device. No license, either express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of NEC Corporation or others. While NEC Corporation has been making continuous effort to enhance the reliability of its semiconductor devices, the possibility of defects cannot be eliminated entirely. To minimize risks of damage or injury to persons or property arising from a defect in an NEC semiconductor device, customer must incorporate sufficient safety measures in its design, such as redundancy, fire-containment, and anti-failure features. NEC devices are classified into the following three quality grades: “Standard“, “Special“, and “Specific“. The Specific quality grade applies only to devices developed based on a customer designated “quality assurance program“ for a specific application. The recommended applications of a device depend on its quality grade, as indicated below. Customers must check the quality grade of each device before using it in a particular application. Standard:Computers, office equipment, communications equipment, test and measurement equipment, audio and visual equipment, home electronic appliances, machine tools, personal electronic equipment and industrial robots Special: Transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster systems, anti-crime systems, safety equipment and medical equipment (not specifically designed for life support) Specific: Aircrafts, aerospace equipment, submersible repeaters, nuclear reactor control systems, life support systems or medical equipment for life support, etc. The quality grade of NEC devices in “Standard“ unless otherwise specified in NEC's Data Sheets or Data Books. If customers intend to use NEC devices for applications other than those specified for Standard quality grade, they should contact NEC Sales Representative in advance. Anti-radioactive design is not implemented in this product. M4 94.11