MX909A COMMUNICATION SEMICONDUCTORS MobitexTM R14N Short Data Block Frame Support Application Note 1. Background The MX909A Wireless Packet Data Pump performs baseband signal processing and Medium Access Control (MAC) protocol functions for a GMSK wireless packet data modem. While the MX909A uses data block sizes and FEC/CRC algorithms compatible with the MobitexTM network over-air-standard, it also provides flexible operating modes that make it suitable for private and general-purpose applications. The MX909A assembles application data received from the C, adds forward error correction (FEC), adds an error detection (CRC) code, interleaves this data to provide burst-error protection, and randomizes (scrambles) the bit pattern. After automatically adding bit and frame sync codewords, the data packet is converted to analog levels and Gaussian filtered such that it is suitable for modulating a transmitter VCO (modulation index = 0.5) creating GMSK signals at the transmitter output. Figure 1, shows the MobitexTM frame structure. Frame Head Structure msb 7 byte 6 5 4 3 2 0 1 2 bit sync 1 bit sync 2 frame sync 1 3 4 frame sync 2 control byte 1 5 6 1 Data Block Structure lsb msb 0 7 byte control byte 2 FEC 1 FEC 2 Data or CRC 6 5 4 3 lsb msb 2 1 0 FEC 3 2 lsb 1 0 0 1 2 Data 1 Data 2 Data 3 FEC 1 FEC 2 FEC 3 3 4 Data 4 Data 5 FEC 4 FEC 5 5 6 Data 6 Data 7 FEC 6 FEC 7 7 8 9 Data 8 Data 9 Data 10 FEC 8 FEC 9 FEC 10 10 11 Data 11 Data 12 FEC 11 FEC 12 12 13 Data 13 Data 14 FEC 13 FEC 14 14 15 16 Data 15 Data 16 Data 17 FEC 15 FEC 16 FEC 17 17 18 Data 18 CRC byte 1 FEC 18 FEC 19 19 CRC byte 2 FEC 20 Interleave / De-Interleave Scramble / De-Scramble bit sync 16 bits frame sync 16 bits control bytes 16 bits FEC 8 bits Data Block 1 240 bits 7 byte Frame Head, always present Data Block 2 240 bits Data Block 32 240 bits Data Blocks, when present Over Air Frame Figure 1: MobitexTM Over Air Signal Format (c)2001 MX-COM, INC. www.mxcom.com Tel: 800 638 5577 336 744 5050 4800 Bethania Station Road, Winston-Salem, NC 27105-1201 USA Fax: 336 744 5054 Doc. # 208300160.001 All trademarks and service marks are held by their respective companies. MobitexTM R14N Short Data Block Frame Support Page 2 of 6 MX909A Application Note Data is transmitted in the form of a Frame Head immediately optionally followed by up to 32 Data Blocks. The frame consists of: Frame Head (7 bytes) * 2 bytes of bit Sync (0xCCCC for the down-link and 0x3333 for the up-link) * 2 bytes of frame Sync (System Specific) * 2 bytes of control data * 1 byte of FEC code (4 bits for each of the control bytes) Data Block (30 bytes) * 18 bytes of data * 2 bytes of CRC (calculated from the 18 data bytes) * 10 bytes of FEC (4 bits of FEC code for each of the data and CRC bytes) * The resulting 240 bits are interleaved and scrambled before transmission 2. The R14N Short Block Frame Acknowledgement A latest version of the MobitexTM Interface Specification incorporates an extended battery saving protocol known as R14N that enhances MobitexTM systems by supporting new services and levels of performance. The enhancements are in three key areas: better coverage, longer battery life and faster radio link reestablishment. R14N introduces a new ROSI (RadiO Signaling) protocol link layer frame type called the SBF_ACK (Short Block Frame ACKnowledgement). This new frame type is shorter than others and improves base station reception success rate under adverse radio conditions. Another advantage is reduced power consumption used to transmit the shorter frame. R14N allows mobiles to respond using a shorter transmit period, thus increasing battery life by reducing the RF transmitter on period. Use of the shorter frame is only permitted in networks that support the extended battery saving protocol, so portable radio modems must first determine that a network provides support before using the new frame type. Frame Head Structure msb 7 byte 0 1 2 3 4 5 6 6 5 4 3 2 1 bit sync 1 bit sync 2 frame sync 1 frame sync 2 control byte 1 control byte 2 FEC 1 FEC 2 Short Data Block Structure lsb msb 0 7 byte 0 1 2 3 4 5 Data or CRC 6 5 4 3 2 Data 1 Data 2 Data 3 Data 4 CRC byte 1 CRC byte 2 lsb msb 1 0 3 FEC lsb 2 1 FEC 1 FEC 2 FEC 3 FEC 4 FEC 5 FEC 6 0 Interleave / De-Interleave Scramble / De-Scramble bit sync 16 bits frame sync 16 bits control bytes 16 bits FEC 8 bits 7 byte Frame Head, always present Data Block 72 bits Data Block, always present Over Air Frame Figure 2: MobitexTM Short Block Frame Over Air Signal Format (c)2001 MX-COM, INC. www.mxcom.com Tel: 800 638 5577 336 744 5050 4800 Bethania Station Road, Winston-Salem, NC 27105-1201 USA Fax: 336 744 5054 Doc. # 208300160.001 All trademarks and service marks are held by their respective companies. MobitexTM R14N Short Data Block Frame Support Page 3 of 6 MX909A Application Note Figure 2, shows the MobitexTM Short Block Frame. The format of the Short Block Frame differs from all other frames only in the number of bytes contained in the data block and the mandatory presence of one data block. The data block for the short frame would be formed as follows: Short Data Block (9 bytes) * 4 bytes of data * 2 bytes of CRC (calculated from 4 data bytes) * 3 bytes of FEC code (4 bits for each of the data and CRC bytes) * The resulting 72 bits are interleaved and scrambled before transmission. The Short Frame Block Acknowledgement always contains one data block and is only transmitted, never received, by the modem. (Base stations do not transmit SBF_ACKs to the modem.) 3. Implementing the R14N Short Frame on the MX909A TM To support the Mobitex R14N battery saving protocol, an end product must support the link layer to physical layer conversion for the new Short Block Frame. Data is transmitted over the air in the form of 'frames' consisting of the 'Frame Head' followed by one or more formatted data blocks. The MX909A constructs the data blocks from the 'raw' data using a combination of CRC (Cyclic Redundancy Checksum) generation, Forward Error Correction coding (FEC), Interleaving and scrambling. The MX909A treats operations such as transmitting or receiving frames (or parts of a frame) as 'tasks', which are initiated by the C by writing instruction bytes to the command register. A frame, according to Figure 1, would be sent by writing aT7H (Transmit 7 byte Frame Head) task followed by a TDB (Transmit Data Block) task. The TDB 'task' takes 18 bytes of 'raw' data, calculates and applies a 16-bit CRC and forms the FEC for the 18 bytes and the CRC. This data is then interleaved and passed through the scrambler (if enabled) before sending it as the Data Block part of the MobitexTM frame. The MX909A does not have a 'task' similar to TDB for the short data block frame. The general-purpose 'tasks' TQB (Transmit 4 Bytes) or TSB (Transmit Single Byte) could be used to transmit the shorter frame. The TQB and the TSB 'tasks' read the data as presented to the modem and transmit them without adding CRC and FEC, and without passing the data through the interleaver and the scrambler. For this reason, the host C must format the data before presenting it to the MX909A. Section 6 shows a C program that will take 4 bytes of data and generate 9 bytes of formatted data ready for transmission. 4. Transmit Short Frame Example If the device is required to send a MobitexTM Short Block Frame, the following control signals and data should be issued to the modem, provided the device is not starting from powersave state. TX//RX is set to '1' and the SCREN, DARA, CKDIV, and DQEN have been set as required after power was applied to the device. 1. 6 bytes forming the Frame Head are loaded into the Data Buffer, followed by a 2-bit pause to let the filter stabilize, followed by a T7H task. th 2. Device interrupts host C with /IRQ when the 6 byte is read from the Data Buffer 3. Status Register is read and the first 4 bytes of formatted data are loaded into the Data Buffer, followed by a TQB task. th 4. Device interrupts host C with /IRQ when 4 byte is read from Data buffer 5. Status Register is read, and the next 4 bytes of formatted data are loaded into the Data Buffer, followed by TQB task. 6. Status Register is read, and the last byte of formatted data is loaded into the Data Buffer, followed by a TSB task. 7. Status Register is read, host may load data and set next task as required: GOTO '1' If another Frame is to be immediately transmitted GOTO '8' If no more data is to be immediately transmitted. 8. 1 byte representing the 'hang byte' is loaded into the data buffer followed by a TSB task. (c)2001 MX-COM, INC. www.mxcom.com Tel: 800 638 5577 336 744 5050 4800 Bethania Station Road, Winston-Salem, NC 27105-1201 USA Fax: 336 744 5054 Doc. # 208300160.001 All trademarks and service marks are held by their respective companies. MobitexTM R14N Short Data Block Frame Support Page 4 of 6 MX909A Application Note Figure 3 shows a top level flowchart of the short block frame transmit process: Start Wait for /IRQ line to go low then execute TX I.S.R Write 6 bytes of Frame Head to Data Buffer Write Task = 'RESET' to Command Register Wait 2-bit times for lowpass filter to settle Decrement C TQB Counter Set C TQB Counter to 2 Write Task = 'T7H' to Command Register TQB Counter = '0'? Write CKDIV, HI//LO, and DARA values to Control Register Write Last Byte of Formatted data into Data Buffer A Write 4 bytes of formatted data to Data Buffer Wait for /IRQ line to go low then execute TX I.S.R Read Status Register Write Task = TQB to Command Register BFREE = '1'? A YES Wait for /IRQ line to go low then execute TX I.S.R Write IRQEN = '1', SCREN = '1', TX//RX = '1' to Mode Register NO No Write 'Hang Byte' to Data Buffer YES Write Task = 'TSB' to Command Register TX Interrupt Service Routine (I.S.R) Finish Read Status Register NO /IRQ bit = '1'? Service Other Interrupts YES YES IBEMPTY = '1'? Fault detected: Abort Transmission NO NO BFREE = '1'? Fault detected: Abort Transmission YES Figure 3: Transmit Short Block Frame Flow Chart 5. Conclusion This document describes how to implement the functions required for the transmission of the Short Block Frame Acknowledgement as specified in the latest version of the MobitexTM interface specifications. The flexibility of the MX909A allows this to be done by making use of some of the more general-purpose 'tasks' supported by the device. The implementation requires that the C assemble the Short Data Block by taking the 4 bytes of `raw' data, processing the data to add the CRC and FEC codes, interleaving the data for burst error protection and then randomizing the data if the scrambling function is enabled. (c)2001 MX-COM, INC. www.mxcom.com Tel: 800 638 5577 336 744 5050 4800 Bethania Station Road, Winston-Salem, NC 27105-1201 USA Fax: 336 744 5054 Doc. # 208300160.001 All trademarks and service marks are held by their respective companies. MobitexTM R14N Short Data Block Frame Support 6. Page 5 of 6 MX909A Application Note 'C' language program /* Program takes 4 bytes of 'raw data' and generates 9 bytes */ /* of formatted data by adding CRC, FEC, then interleaving */ /* and scrambling it (if scrambler enabled) */ #include int crc_16(int [], int); int fec_add(int); void interleave(int[]); void scramble_block(int); int outbits[72]; int bits[72]; /* function Declarations */ /* Global Variables */ void main(void) { int n_bytes = 6; int data_bytes[6] = {0x09, 0xEB, 0xCA, 0x20, 0, 0}; /*enter 4 'raw data' bytes*/ int crc,i,j,z,w = 0xff; crc = crc_16(data_bytes, n_bytes-2); /*CRC generation function call*/ data_bytes[n_bytes - 2] = (crc >> 8) & 0x00ff; /*member 5 of array is CRC MSB*/ data_bytes[n_bytes - 1] = crc & 0x00ff; /*member 6 of array is CRC LSB*/ for (i = 0; i < n_bytes; i++) { data_bytes[i] = fec_add(data_bytes[i]); /*FEC generation function call*/ } interleave(data_bytes); scramble_block(1); /* interleave function call*/ /* 1 enables scrambler*/ printf("\n The formatted bytes are:"); /* print the 9 formatted bytes*/ for(j = 0; j < 9; j++) { for(i = 0; i < 8; i++) { w = w << 1; z = outbits[j*8 + i] & 0x1; w = (w | z) & 0xff; } printf("%4x", w); } } int crc_16(int data_bytes[], int n_bytes) { int i, j, fb, mask; long crc = 0xffff; /* CRC generation */ for(i=0; i < n_bytes; i++) { mask = 1; /* as CCITT X25 */ for(j = 0; j < 8; j++) /* X16 + X12 + X5 + 1 */ { fb = 0; if((data_bytes[i] & mask) != 0) fb = 1; fb = (fb ^ crc) & 1; crc = (crc >> 1) & 0x7fff; if(fb != 0) crc = crc ^ 0x8408; mask = (mask << 1); } } return(crc ^ 0xffff); /* 1s complement result */ } (c)2001 MX-COM, INC. www.mxcom.com Tel: 800 638 5577 336 744 5050 4800 Bethania Station Road, Winston-Salem, NC 27105-1201 USA Fax: 336 744 5054 Doc. # 208300160.001 All trademarks and service marks are held by their respective companies. MobitexTM R14N Short Data Block Frame Support Page 6 of 6 MX909A Application Note /* Add 4 bit FEC to 8 bit data byte. Return 12 bit result */ /* FEC coding matrix. MSB at left */ /* /* /* /* 11101100 11010011 10111010 01110101 1000 0100 0010 0001 */ */ */ */ int fec_add(int x) { int y, i, b[8]; y = x; for(i = 0; i < 8; i++) { b[i] = y & 1; y = y >> 1; } y = (x << 4) & 0xff0; if((b[7] ^ b[6] ^ b[5] if((b[7] ^ b[6] ^ b[4] if((b[7] ^ b[5] ^ b[4] if((b[6] ^ b[5] ^ b[4] return(y); } ^ ^ ^ ^ b[3] b[1] b[3] b[2] ^ ^ ^ ^ b[2]) b[0]) b[1]) b[0]) void interleave(int inbytes[]) { int i, j, crc, data[6], bit, mask; == == == == 1) 1) 1) 1) y y y y |= |= |= |= 0x8; 0x4; 0x2; 0x1; /* Interleave */ mask = 0x800; for(i = 0; i < 12; i++) { for(j = 0; j < 6; j++) { bit = 0; if((inbytes[j] & mask) != 0) bit = 1; outbits[j + 6*i] = bit; } mask = mask >> 1; } } void scramble_block(int reset) { static int sreg; int i; if(reset != 0) sreg = 0x1ff; else sreg = 0x000; for(i = 0; i < 72; i++) { outbits[i] ^= (sreg & 1); if( ((sreg & 0x11) == 0x10) || ((sreg & 0x11) == 0x01)) sreg |= 0x200; sreg = (sreg >> 1) & 0x1ff; } } (c)2001 MX-COM, INC. www.mxcom.com Tel: 800 638 5577 336 744 5050 4800 Bethania Station Road, Winston-Salem, NC 27105-1201 USA Fax: 336 744 5054 Doc. # 208300160.001 All trademarks and service marks are held by their respective companies.