Application Note: 101
|
Sabananthan Paramananthan |
| Date: 10 November 1997 |
Applications Engineer |
Introduction
The Radiometrix Bi-directional Module (BiM-UHF) is designed to enable communications at
up to 38400 bps including the common baud rates of 4800, 7200, 9600, 19200, 38400 bps.
This experiment was carried to prove its performance and to stress the importance of using
a balanced data packet.
Test Set-up
A simple C program (using Turbo C++ 3.0) was written to
generate test packets and transmit them through the RS232 COM port of PC with BiM-UHF
Interface. The data has to be formatted into packets before transmitting it through the
BiM-UHF.

Figure 1: Simple BiM-UHF to COM Port Interface
Data Packet Format
Preamble
This is essential to settle the data slicer in BiM-UHF at the correct slicing point by
sending a period of preamble prior to the actual data, 3 ms is the minimum requirement, we
recommend that 5 ms of preamble is optimum. Either 55h or AAh can be used as preamble. But
55h gives better balancing compared to AAh.
UART SYNC Byte (FFh)
This is used to stabilise the UART, so it can detect a clean start bit after the
numerous confusing transitions in the preamble. UART always waits for 1->0 transition
then start reading the next 8-bits, (9 bits if parity is used) and stop bit. If it started
on the wrong transition, it will not read the correct data, parity and stop bits. This
will result in parity and framing errors. When the receiver is turned on it may not land
in the proper start bit of the 55h. So, when errors occur the software forces it to ignore
it. By putting an FFh, the UART will be made to think there is a break after the stop bit
of the last byte. So, it waits for the next 1->0 transition which will be the actual
start bit of the next byte.
Start Byte
This is used to identify the start of the data and to start the software to decode the
next incoming data stream. When in Receive Mode, the software looks for a valid 01h.
Sometimes, noise signal or interference from other sources could contain a wave form
equivalent to 01h and trigger the software decoding. To prevent this an additional 7Fh is
used as a secondary check. These two bytes are purposely made almost complementary to each
other so that they maintain the data slicer in the middle and maintain the mark to space
balancing.
Data Length Byte
The least significant 7 bits is used to identify the number of data bytes or Manchester
encoded words in the packet. This value is used by the software to read in the next number
of bytes/words into an memory array. MSB can be used to identify whether the data is
encoded or not.
Data Bytes or Manchester Encoded Data Words
A maximum of 128 data bytes or data words are sent one after another from the
transmitter to receiver. If it is not Manchester encoded, the data bytes will be in exact
form as original byte. But on transmission, LSB is transmitted first and MSB last.
Some data streams may contain long string of 00h or FFh, these are averaged by the
slicer capacitor to either Low or High level. i.e. the slicer will not slice
symmetrically. Because the data transmitted over radio is ac coupled, constant 00h or FFh
behave like dc voltage and these will be attenuated. This could be clearly be observed on
the Audio (pin 13) output (Test Point). Because there is always a transition
in the start/stop bit, these transition may be missed by the comparator after a long Low
or High. Comparator has an input offset which have to be overcome.
Manchester or Bi-phase coding avoids this problem by forcing symmetry (50:50
mark:space) in the data stream.
Data can also be encoded into 12-bit code like the RPC code. Each 8-bit byte is mapped
into a 12-bit RPC code (RPC Data Sheet).
16-bit Cyclic Redundancy Code (CRC)
This is used to check for any errors in the data packet. 16-bit (2 bytes) CRC is
generated from the bytes in the data packets and appended to the end of the packet. On the
receiver, another 16-bit (2 bytes) CRC is generated from the bytes in the received packet.
If both CRC word are same, then the packet received is assumed to be correct. If Parity is
used, CRC acts as a Secondary Error Checking (or Double Check).
Test Packets
These are purposely made to test the BiM under unbalanced, worst data conditions. These
data packets have continuous Low bytes (00h), continuous High bytes (FFh) and a few
transition of the following types:
Figure: 2 Worst possible transition
Packet Error Rate with Mark to Space
The balance of the code is the ratio of 1's to 0's in a given period. (i.e.
there should approximately equal number of bits which are 1's & 0's over 3ms time
period for BiM). To test the effect of balancing we sent Test Packet 2 (please refer to
UART_send_test_packet2 function). Number of 1's in the byte (8 bits) was varied from 0 to
8.
The graphs below show how Packet Error Rate (PER) varies with Baud Rate and Mark to
Space. The graph clearly shows that better performance is obtained with 50:50 mark to
space.
It also shows that there is a small imbalance in the performance between two extremes
of mark to space. (i.e. between 0/8 for 00h and 8/8 for FFh). This is due to inherent
property of internal components in the BiM.
Figure 3 clearly shows that Unbalanced Data will not pass through radio at all at
38400bps however stronger the signal is.
Figure 4 shows that unbalanced data will not reliably pass through radio at 19200bps, if
long strings of FFh are present
Percentage Error with Parity

Figure 8:
|
The
Test Packet 1 (UART_send_test_pack1) was used for this. Packet content was not changed,
only the parity type was changed in UART LCR.The graph on the left shows how the type
of parity affects the error performance. |
It clearly shows that worst error performance is obtained for Even Parity. This is due
to the sudden transition to 0, just before the stop bit. After a long logic High (e.g.
111111112) the capacitor in the slicer circuit is biased towards a Logic High,
however, Even Parity for this will be 0 (Logic Low) while Stop Bit is Logic High.
Therefore, this sudden logic transition of the parity will be missed at high speed (high
baud rates).
The graph proves that for reliable transmission through BiM, Odd parity should be used.
Percentage Error with Baud Rate

Figure 9: |
The graph on the left shows the Error Performance
of BiM with Baud Rate. Optimum Error Performance is obtained if the RS232 baud rate is
between 9600 to 19200bps. |
Simple Protocol
It is better to implement a protocol to send back an acknowledgement to transmitting
DCE. If no acknowledgement is received by the transmitting DCE, it can be made to
re-transmit the data packet again. This process can be repeated 20 times until an
acknowledgement is received. If no acknowledgement is received after 20 tries, the
transmitting modem can abandon the process and give an error message to the host DTE.
Sometimes the receiving DCE may have sent back an acknowledgement and this may not have
arrived at the transmitting DCE properly. Therefore, transmitting DCE will assume that its
data was not received properly and it will try to retransmit the same message again.
Receiving DCE will then receive a repeated packet which could be mistaken for another
packet. This problem can be avoided by putting a counter or some sort of identifier to
indicate that it is a repeated packet. Therefore, the receiver will know that it is a
repeated message and it can ignore it if it has already received it correctly. It can also
retransmit the acknowledgement.
The second start byte can be used for this purpose.
Conclusion
Note: All these results were obtained for a set of unbalanced, worst data packet
conditions. BiM will perform better than these results for ordinary data packets. However
it is very important to balance every data packet for reliable data communications over
radio.
Three important conclusions from the experiment are
- Data packet should be balanced to have a mark to space of 50:50 over a 3ms period.
Unbalanced data cannot be sent at 38400bps however stronger the signal is.
- Optimum Baud Rate for RS232 transmission through BiM is 9600-19200bps.
- If Parity is to be used, Odd parity should be used.
References
[1] Radiometrix BIM-UHF Data Sheet
[2] Herbert Schildt, C: the Complete Reference, Third Edition, Osborne McGraw-Hill
[3] National Semiconductors, PC16550D
Universal Asynchronous Receiver/Transmitter with FIFOs
[4] Maxim Interface Products http://www.maxim-ic.com/efp/Interfac.htm