Sie sind auf Seite 1von 38

RF Communication

V1.2 - Nov 01, 2006


English Version

19, Innovation First Road • Science Park • Hsin-Chu • Taiwan 300 • R.O.C.

Tel: 886-3-578-6005 Fax: 886-3-578-4418 E-mail: mcu@sunplus.com

http://www.sunplusmcu.com http://mcu.sunplus.com
RF Communication

Important Notice

SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information
provided by SUNPLUS TECHNOLOGY CO. is believed to be accurate and reliable. However, SUNPLUS
TECHNOLOGY CO. makes no warranty for any errors which may appear in this document. Contact SUNPLUS
TECHNOLOGY CO. to obtain the latest version of device specifications before placing your order. No
responsibility is assumed by SUNPLUS TECHNOLOGY CO. for any infringement of patent or other rights of third
parties which may result from its use. In addition, SUNPLUS products are not authorized for use as critical
components in life support systems or aviation systems, where a malfunction or failure of the product may
reasonably be expected to result in significant injury to the user, without the express written approval of Sunplus.

© Sunplus Technology Co., Ltd. PAGE 1 V1.2 - Nov 01, 2006


RF Communication

Revision History

Translated Page
Revision Date Remark
By Number(s)

V1.2 2006/11/01 Wang Liping Proofreading


Translate ‘RF Communication V1.1, Chinese
V1.1 2006/03/07 Zhu Meng
version’

© Sunplus Technology Co., Ltd. PAGE 2 V1.2 - Nov 01, 2006


RF Communication

Table of Content
PAGE

1 System Design Summary .................................................................................................................. 5

1.1 System Design Description ........................................................................................................... 5


1.2 System Diagram ............................................................................................................................ 5
1.3 MCU Resource .............................................................................................................................. 5

2 RF System Principle........................................................................................................................... 7

2.1 Function......................................................................................................................................... 7
2.2 Principle......................................................................................................................................... 7
2.3 Communication Protocol ............................................................................................................... 8

3 Software Description........................................................................................................................ 10

3.1 Source File .................................................................................................................................. 10


3.2 Subroutines ................................................................................................................................. 10
3.3 Variables ...................................................................................................................................... 13

4 Flow Chart ......................................................................................................................................... 19

4.1 F_Main......................................................................................................................................... 19
4.2 Initialization in Main ..................................................................................................................... 20
4.3 F_Key .......................................................................................................................................... 20
4.4 F_Light......................................................................................................................................... 21
4.5 F_Send_Init ................................................................................................................................. 21
4.6 F_Lock ......................................................................................................................................... 22
4.7 F_Send_Data_Head.................................................................................................................... 23
4.8 F_Send_Data_Start ..................................................................................................................... 24
4.9 Interrupt Service Routine............................................................................................................. 25
4.10 F_Send ...................................................................................................................................... 26
4.11 Byte Transmission ..................................................................................................................... 27
4.12 F_Receive_Init........................................................................................................................... 28
4.13 F_Receive ................................................................................................................................. 29
4.14 F_DataCorrect ........................................................................................................................... 30

5 SPRF2716B Introduction ................................................................................................................. 31

5.1 General Description..................................................................................................................... 31


5.2 Module Pin Description................................................................................................................ 32
5.3 Application Circuit ........................................................................................................................ 33
5.4 Function and Application ............................................................................................................. 33
5.5 How to Reduce EMI and Improve Sensitivity .............................................................................. 36

© Sunplus Technology Co., Ltd. PAGE 3 V1.2 - Nov 01, 2006


RF Communication

5.6 DEMO Board Schematic ............................................................................................................. 37


5.7 Interface for the Speech Channel................................................................................................ 37

© Sunplus Technology Co., Ltd. PAGE 4 V1.2 - Nov 01, 2006


RF Communication

1 System Design Summary

1.1 System Design Description

This document is intended to guide you how to communicate with RF (Radio Frequency)
device via GPIO on SUNPLUS SPMC65x series. Here, we take SPMC65P2404A*28P as
an example for demonstration purpose.

1.2 System Diagram

4 RF Module

1
SPMC65P2404A Key Scan
*28p

7
LED Showing

2 16MHz

Figure 1-1 System Diagram

1.3 MCU Resource

MCU Resource Occupation Memo

Data transmission 6 bytes


Data receiving 8 bytes
RAM
key-press processing 3 bytes
LED display 1 byte
Main program 54 bytes
Initialization 49 bytes
Interrupt vectors 53 bytes
ROM Data transmission 489 bytes
Data receiving 295 bytes
Key-press processing 64 bytes
LED display 55 bytes
Hardware on Data
receiving/transmission/key
scanning/LED display

© Sunplus Technology Co., Ltd. PAGE 5 V1.2 - Nov 01, 2006


RF Communication

MCU Resource Occupation Memo

Timer base 1.024ms time base for main loop


Timer3 Set a 470us timer
Capture3 interrupt Data receiving
Key press input and LED
PORTA
display driving

I/O PORT PORTB Data receiving/transmission Only PB2~PB5


PORTC Not used
PORTD Not used

© Sunplus Technology Co., Ltd. PAGE 6 V1.2 - Nov 01, 2006


RF Communication

2 RF System Principle

2.1 Function

This application is using the SPMC65P2404A*28P as the primary controller to connect


with an external RF module - SPRF2716B to perform wireless communication.

2.2 Principle

As shown in Figure 2-1, the RF module is an integrated system for semiduplex


transmission and receiving.

When no key is pressed, the system runs in the receiving mode, and it intends to receive
signals with recognizable communication format. Once a matched signal is received, it
will be shown via the LED. When a key is pressed, the system will switch to the
transmission mode immediately and then transmit the key value (0~F) with the defined
format.

PortA is assigned to connect a key and a 7-segment LED. PB2~PB5 are connected to
the lines of T/R, PAEN, Data in, and Data out respectively in RF module. The logic high
voltage to the RF module is 3V, so a voltage conversion is required between RF module
and SPMC652 when interfacing with IO ports. PB2, PB3 and PB4 are configured as the
output control lines, therefore, they are respectively connected to the RF module through a
2K and a 3K resistor to divide the voltage. PB5 is configured as the input line, which is
connected to Data Out line in RF module via two transistors for voltage conversion.

Since CHS0, CHS1, CHS2 are tied to VSS directly, according to initial setting, the channel
0 is used to transmit/receive data in RF module.

The 7-segment LED is initialized to show ‘0’ and it will increase 1 as soon as a key-press
occurs. Momentarily, the display value is transmitted to a receiving system.

© Sunplus Technology Co., Ltd. PAGE 7 V1.2 - Nov 01, 2006


RF Communication

ANT1
ANTENNA
SPMC65P2404A*28P XI XO
1 28 VDD SPRF2716
a dp 2 PA7 VDD 27 VSS 20p 16MHz 20p

VSS
ANT
g 3 PA6 VSS 26 XI DataIn VSS
f g b f PA5 XI 25 Data In
4 XO
e 5 PA4 XO 24 RESET VSS CHS0
e c PA3 RESET 23
d . d 6 CHS1 L1
c 7 PA2 PD0 22 PEAN CHS2 3.3uh VDD
b PA1 PD1 21 PAEN RF1 +5V
com
8 VSS
a 9 PA0 PD2 20 T/R PD
10 PB7 PC0 19 DataOut T/R VSS
PB5 11 PB6 PC1 18 VCC Data Out
PB4 12 PB5 PC2 17 VCC
PB3 13 PB4 PC3 16 VSS SPEAKER
PB2 14 PB3 PB0 15 VSS
PB2 PB1

+5V
+5V
PB2 PB3 PB4

4.7K

5.1K RESET
2K 2K 2K
5.1K PB5
510 T/R PEAN DataIn
104
510 8050
DataOut 3K 3K 3K
8050

Figure 2-1 RF Schematic

2.3 Communication Protocol

The communication protocol is designed for discrete multiple devices communication, that
is, it takes master and slave in the system to be equal. In general, if no key is pressed,
the hardware system is under the receiving mode. When a key-press occurs, a frame of
data can be transmitted. The data format is shown as Figure 2-2.

Preamble Start bit ID number Data1,2,3,4

80ms 3.76ms
1 0 1 0 1 0 1 0 0 0 0 0 0 0 0

550us 3.29+0.47ms

Figure 2-2 Communication Protocol Format

A full frame of data includes: preamble, start bit, ID number, and data1, 2, 3, and 4.

In this application, the ID number is $AA; data1 is the key value; data2, the
base-minus-one’s complement of data1; data3, the base-minus-one’s complement of
data2; data4, the base-minus-one’s complement of data3. That is, data1 and data3
present the key value; data2 and data4 are the base-minus-one’s complement of the key
value. Encoding by this format ensures that any two data errors can be checked and the
true value is still remained. Figure 2-3 shows the coding format.

© Sunplus Technology Co., Ltd. PAGE 8 V1.2 - Nov 01, 2006


RF Communication

Bit ‘1’ Bit ‘0’


470us 470us

470x3us 470us

Figure 2-3 Coding Format for ‘0’ and ‘1’

For this coding format, the logic ‘1’ and the logic ‘0’ are read by periodic calculation. By
this means, the code can obtain a higher capability of anti-jamming, but it adds the
complexity of data decoding. In the program, the period calculation is performed by the
capture function.

Configuring the system by the parameters as mentioned above, it implements transmission


and receiving rather well. Any modifications to the default parameters may degrade the
system performance.

© Sunplus Technology Co., Ltd. PAGE 9 V1.2 - Nov 01, 2006


RF Communication

3 Software Description

3.1 Source File

File Name Function Type

main.asm Main process Source file (Sample)


Transmit data, Receive data
RF.asm Source file (User)
Key scan, LED display
SPMC65P2404A.inc SPMC65X symbol definition Head file

3.2 Subroutines

„ V_Reset

Content Memo

Input None

Output None
The initial address that PC points to after
Description
Power-On-Reset
Caller main.asm

„ F_Main

Content Memo

Input None

Output None
Delay time for 4ms, and then perform the key scan, key
Description processing, key value display and data
transmission/receiving.

Caller Main.asm

„ V_INT

Content Memo

Input None
Output GB_T1_OverFlow

© Sunplus Technology Co., Ltd. PAGE 10 V1.2 - Nov 01, 2006


RF Communication

Content Memo

Receive mode: Measure the period


Description
Transmission mode: 470us timer
Caller Main.asm

„ F_RF_Init

Content Memo

Input None
Output None
Description Clear variables; Configure IO ports and 4ms interrupt.

Caller RF.asm

„ F_Key

Content Memo

Input None
Output GB_KeyDownFlag, IB_ShowBuf
Description Key scan

Caller RF.asm

„ F_Light

Content Memo

Input IB_ShowBuf, GB_Receive_Flag, G_RF_data


Output None
Description Display key value or the received data
Caller RF.asm

„ F_Send_Init

Content Memo

Input None
Output GB_Send_Flag
Description Initialization for the data transmission
Caller RF.asm

© Sunplus Technology Co., Ltd. PAGE 11 V1.2 - Nov 01, 2006


RF Communication

„ F_Lock

Content Memo

Input GB_Send_Flag
Output GB_Send_Flag
Description Lock-up time before transmission About 80ms
Caller RF.asm

„ F_Send_Data_Head

Content Memo

Input GB_Send_Flag
Output GB_Send_Flag
Description Transmit the preamble, start timer3 for 470us timing
Caller RF.asm

„ F_Send_Data_Start

Content Memo

Input GB_Send_Flag
Output GB_Send_Flag
Description Transmit start bit
Caller RF.asm

„ F_Send_Data

Content Memo

Input GB_Send_Flag, GB_DataBuf


Output GB_Send_Flag
Description Transmit the ID numbers and data in four consecutive
bytes, the initial address of which is GB_DataBuf.
Caller RF.asm

„ F_Send

Content Memo

Input GB_DataBuf, GB_Sending_Flag


Output GB_Sending_Flag

© Sunplus Technology Co., Ltd. PAGE 12 V1.2 - Nov 01, 2006


RF Communication

Content Memo

Description Transmit data in GB_DataBuf buffer


Caller RF.asm

„ F_Receive_Init

Content Memo

Input GB_Send_Flag, GB_Receive_Flag


Output GB_Receive_Flag
Description Initialization for the data receiving.
Caller RF.asm

„ F_Receive

Content Memo

Input GB_Send_Flag, GB_Receive_Flag


Output GB_Receive_Flag, G_RF_data
Description Data receiving
Caller RF.asm

„ F_DataCorrect

Content Memo

Input G_RF_data
Output G_RF_data
Description Check and correct the data in 4-byte variable G_RF_data.
Caller RF.asm

3.3 Variables

„ GB_KeyDownFlag

Content Memo

Key press flag:


Description 0 – the key is not pressed
1 – the key is pressed
Size 1 byte

© Sunplus Technology Co., Ltd. PAGE 13 V1.2 - Nov 01, 2006


RF Communication

Content Memo

Default 0
Symbol None
Value 0~1

„ IB_KeyupFlag

Content Memo

Key up flag:
Description 0 – the key is released
1 – the key is not released after being pressed
Size 1 byte
Default 0
Symbol None
Value 0~1

„ IB_CmpTimers

Content Memo

Times for key values that are consecutive equal, which is


Description
referenced to be de-bouncing.
Size 1 byte
Default 0
Symbol CB_CmpTimers (constant = 6)
Value 0~6

„ IB_ShowBuf

Content Memo

Description Buffer for the to-be-showed data, the lower four bits are
significant.
Size 1 byte
Default 0
Symbol None
Value $00~$FF

„ GB_Lock_Num

© Sunplus Technology Co., Ltd. PAGE 14 V1.2 - Nov 01, 2006


RF Communication

Content Memo

Description 40ms timing for lock-up time


Size 1 byte
Default 0
Symbol None
Value 0~10

„ GB_Sending_Flag

Content Memo

Data transmission control (ID number, data1~data4, 40


bits totally)
bit3–1: 40 bits are transmitted over
0: 40 bits are being transmitted
bit2–1: 8 bits are transmitted over
Bit 3~bit0 are
Description
0: 8 bits are being transmitted significant
bit1–1: The transmitted bit is 1
0: The transmitted bit is 0
bit0–1: The bit 1 is being transmitted
0: The bit 1 has been transmitted
Size 1 byte
Default 0
Symbol None
Value $0~$F

„ GB_Send_Flag

Content Memo

Data transmission control variable


bit7-1: Enable transmission
0: Disable transmission
bit6-1: Enable to transmit data4
0: Disable to transmit data4
Description
bit5-1: Enable to transmit data3
0: Disable to transmit data3
bit4-1: Enable to transmit data2
0: Disable to transmit data2
bit3-1: Enable to transmit data1

© Sunplus Technology Co., Ltd. PAGE 15 V1.2 - Nov 01, 2006


RF Communication

Content Memo

0: Disable to transmit data1


bit2-1: Enable to transmit ID number
0: Disable to transmit ID number
bit1-1: Enable to transmit start bit
0: Disable the transmit start bit
bit0-1: Enable to transmit preamble
0: Disable to transmit preamble
When GB_Send_Flag= #1000,0000B, enable lock-up time
Size 1 byte
Default 0
Symbol None
Value $00~$FF

„ IB_Bit_number

Content Memo

Description Number of transmitted bits (8-bit for one byte)


Size 1 byte
Default 0
Symbol None
Value 0~8

„ GB_DataBuf

Content Memo

Description Data transmission buffer


Size 1 byte
Default 0
Symbol None
Value $00~$FF

„ IB_470us_Count

Content Memo

Set a 470us timer (start bit, ID number, the time base for
Description
transmission data1-data4)
Size 1 byte

© Sunplus Technology Co., Ltd. PAGE 16 V1.2 - Nov 01, 2006


RF Communication

Content Memo

Default 0
Symbol None
Value 0~7

„ GB_Receive_Flag

Content Memo

Data receiving
Bit4-1: Receiving is over
0: Receiving is not over
Bit3-1: Enable to receive ID number and data1-data4
0: Disable to receive ID number and data1-data4
Bit4~bit0 are
Description Bit2-1: Enable to receive start bit
significant
0: Disable to receive start bit
Bit1-1: Enable to receive initialization
0: Disable to receive initialization
Bit0-1: Enable receiving
0: Disable receiving
Size 1 byte
Default 0
Symbol None
Value $0~$1f

„ G_RF_Time

Content Memo

Description Captured value


Size 1 byte
Default Random
Symbol None
Value $00~$FF

„ G_RF_data

Content Memo

Variable for storing the received data


Description
G_RF_data: Store data4

© Sunplus Technology Co., Ltd. PAGE 17 V1.2 - Nov 01, 2006


RF Communication

Content Memo

G_RF_data+1: Store data3


G_RF_data+2: Store data2
G_RF_data+3: Store data1
G_RF_data+4: Store ID number
Size 5 bytes
Default Random
Symbol None
Value $00~$FF

„ G_RF_Number

Content Memo

Number of bits received (ID number, data1-data4, 40 bits


Description
totally)
Size 1 byte
Default 0
Symbol C_RF_Number
Value 0~40

© Sunplus Technology Co., Ltd. PAGE 18 V1.2 - Nov 01, 2006


RF Communication

4 Flow Chart

4.1 F_Main

Start

Initialization (F_RF_Init)

N
Is 4ms expired?

Scan key (F_Key)

LED showing (F_Light)

Lock delay(F_Lock)

Transmit the preamble


(F_Send_Data_Head)

Data receive initialization


(F_Receive_Init)

N
Key-press?

Set key-press flag to 0

Data transmit initialization


(F_Send_Init)

Figure 4-1 F_Main

© Sunplus Technology Co., Ltd. PAGE 19 V1.2 - Nov 01, 2006


RF Communication

4.2 Initialization in Main

F_RF_Init

Set 1ms time base

IO port initialization

Variables initialization

Return

Figure 4-2 Initialization in Main

4.3 F_Key

(F_Key)

N Y
Key up flag = 0?

N N
PA7=1? PA7=0?
Y Y
Equal time increase 1 Equal time increase 1
(IB_CmpTimers+1) (IB_CmpTimers+1)

N N
IB_CmpTimers=6? IB_CmpTimers=6?
Y Y
key value increase 1,set
Key is released, set
GB_KeyDownFlag=1and
IB_KeyupFlag=0
IB_KeyupFlag=1

clear equal time


(IB_CmpTimers=0)

Return

Figure 4-3 F_Key

© Sunplus Technology Co., Ltd. PAGE 20 V1.2 - Nov 01, 2006


RF Communication

4.4 F_Light

F_Light

N
Received new data?

Read new data


(G_RF_data+1)

Obtain the display code by


table-looking-up and send it
to PA0-PA6 for display

Return

Figure 4-4 F_Light

4.5 F_Send_Init

F_Send_Init

Disable receive by clearing


GB_Receive_Flag

Enable transmit and lock-up time


by setting GB_Send_Flag

Disable the capture interrupt

Configure Timer3 as timer mode

Return

Figure 4-5 F_Send_Init

© Sunplus Technology Co., Ltd. PAGE 21 V1.2 - Nov 01, 2006


RF Communication

4.6 F_Lock

F_Lock

Enable N
transmitting?
Y

Enable lock-up N
time?
Y

Pull up PEAN and T/R, pull


down Datain

Cycle time increase 1


(GB_Lock_Num +1)

N
Cycle time=10?

Clear cycle time


(GB_Lock_Num = 0)

Disable lock delay and enable


transmit preamble
(GB_Send_Flag)

Return

Figure 4-6 F_Lock

© Sunplus Technology Co., Ltd. PAGE 22 V1.2 - Nov 01, 2006


RF Communication

4.7 F_Send_Data_Head

F_Send_Data_Head

N
Enable transmitting?

N
Enable transmit preamble?

Transmit preamble

Delay 470us by timer


pull up Datain

Disable transmit preamble


and enable transmit start bit
(GB_Send_Flag)

Return

Figure 4-7 F_Send_Data_Head

© Sunplus Technology Co., Ltd. PAGE 23 V1.2 - Nov 01, 2006


RF Communication

4.8 F_Send_Data_Start

F_Send_Data_Start

N
Transmit start bit?

Y
470us counter=7?

Clear 470us counter 470us counter+1

Disable transmit preamble N


and enable transmit ID 470us counter=7?
number
(GB_Send_Flag) Y

Pull down Datain

Return

Figure 4-8 F_Send_Data_Start

© Sunplus Technology Co., Ltd. PAGE 24 V1.2 - Nov 01, 2006


RF Communication

4.9 Interrupt Service Routine

V_INT

N
Capture int?

Receive data(F_Receive)
clear the capture int flag

N
Timer3 int?

N
Transmit?

Transmit start bit


(F_Send_Data_Start)

Transmit data
(F_Send_Data)

Clear timer3 int flag

Return

Figure 4-9 ISR Flow

© Sunplus Technology Co., Ltd. PAGE 25 V1.2 - Nov 01, 2006


RF Communication

4.10 F_Send

F_Send_Data

Y
Transmit ID number?

Y Transmit ID number,then
Transmit data1? transmit data1(F_Send)

Transmit data1,then Y
Transmit data2?
transmit data2(F_Send)
N

Y Transmit data2,then
Transmit data3? transmit data3(F_Send)

N
Transmit data3,then Transmit data4?
transmit data4(F_Send)
Y

Is transmit Y
data over?
N

Transmit data4 Clear send flag to


(F_Send) disable transmitting
and Timer1 interrupt

Set GB_Sending_Flag to
stop transmitting

Return

Figure 4-10 F_Send

© Sunplus Technology Co., Ltd. PAGE 26 V1.2 - Nov 01, 2006


RF Communication

4.11 Byte Transmission

F_Send

Get the bit0 in ready data

N
Bit = 0 ?

Y
Transmit ‘0’ Transmit ‘1’

Did 8Bits are N


transmitted over?
Y

Set GB_Sending_Flag

F_Send

Figure 4-11 Byte Transmission

© Sunplus Technology Co., Ltd. PAGE 27 V1.2 - Nov 01, 2006


RF Communication

4.12 F_Receive_Init

F_Receive_Init

Y
Transmit mode?

N
Y
Receive mode?
Disable capture int
N

Enable receive and


initialization
(GB_Receive_Flag)

N
Receive initializatiom?

Set capture int,count by timer3

Disable receive initialization, enable


receive start bit

Return

Figure 4-12 F_Receive_Init

© Sunplus Technology Co., Ltd. PAGE 28 V1.2 - Nov 01, 2006


RF Communication

4.13 F_Receive

F_Receive

Y
Transmit mode?

N
N
Receive mode?

Y
Clear receive flag
Disable capture int Calculate captured value

Y
Receive start bit?

N
Receive ID number? N
Received start bit?

Y
Y
Judge the receiving data is ‘0’or
‘1’by captured value Disable receive start bit
Enable receive ID number

load the received data to 5- Receive error


byte data buffer receive again

Y
Received bits =8?

Y The received 5 byte data is N


data = ID number? received over?

N Y

Receive error Correct the received data


receive again

Set flag for receiving new data,


enable the next receiving

Return

Figure 4-13 F_Receive

© Sunplus Technology Co., Ltd. PAGE 29 V1.2 - Nov 01, 2006


RF Communication

4.14 F_DataCorrect

F_DataCorrect

Y
data1=data3?

Complement data2, Y
data2=data4?
load it to data1
N
Y
data1+data2=$FF?

Y
data1+data4=$FF?

Y
Load data3 to data1 data3+data2=$FF?

N
N
data3+data4=$FF?

Z=0, correct Z=1,error

Return

Figure 4-14 F_DataCorrect

© Sunplus Technology Co., Ltd. PAGE 30 V1.2 - Nov 01, 2006


RF Communication

5 SPRF2716B Introduction

SPRF2716B, a powerful RF IC developed by Sunplus, is a designated design for wireless


communication. With the simple and extensible interface, it is easy for you to develop
and debug a new product without expensive equipment and deep learning about RF theory.
The SPRF2716A is applied to many fields including Access Control System, toy remote
control car, information home appliance, wireless mouse/keyboard, etc.

5.1 General Description

Channel frequency configuration table. Crystal = 10.240MHz

(1) A single chip transceiver RF IC, offers a 27MHz FM/FSK half-duplex transceiver

(2) Data rate: 5Kbps

(3) 8 channels selections

(4) 10mW RF output.

(5) -100dBm system sensitivity

CHS2 CHS1 CHS0 Tx Freq Rx Freq

CH0 0 0 0 27.195MHz 26.740MHz


CH1 0 0 1 27.145MHz 26.690MHz
CH2 0 1 0 27.095MHz 26.640MHz
CH3 0 1 1 27.045MHz 26.590MHz
CH4 1 0 0 27.245MHz 26.790MHz
CH5 1 0 1 27.185MHz 26.730MHz
CH6 1 1 0 27.035MHz 26.580MHz
CH7 1 1 1 26.985MHz 26.530MHz

(6) Audio frequency transceiver

(7) When communicating in 27MHz, the match between the antenna type and the distance
is shown below:

Antenna Size RF Power Distance Application

Telescopic 1m 0.5mW 50m RC Car, Walkie-talkie


1m 10mW 200m RC Car, Walkie-talkie
Whip 30m 0.5mW 20m RC Car, Walkie-talkie
30m 10mW 80m RC Car, Walkie-talkie
Loop R = 3cm 0.5mW 1.5m Wireless Mouse/Keyboard
R = 3cm 10 mW 2.5m Wireless Mouse/Keyboard

© Sunplus Technology Co., Ltd. PAGE 31 V1.2 - Nov 01, 2006


RF Communication

5.2 Module Pin Description

Data In

PAEN
CHS0

CHS1

CHS2
GND
RV

PD

Figure 5-1 SPRF2716 Module

Description of pins of SPRF2716 module

Pin Type Function Description Typical Value

VDD - Power supply 5.0V


GND -
Data Out O Data receiving, output resistance < 10k Digital output
Communication control, with a 100k
pull-down resistor internally.
T/R I 3.0V or VSS
‘H’ = Transmission mode; ‘L’ or ‘floating’ =
Receiving mode
Power down, with a 100k pull-up resistor
PD I internally. ‘H’ = Chip Power Down; ‘L’ or 3.0V or VSS
‘floating’ = Chip Enabled
RF power amplifier enable/disabled,
PAEN I internally 100k pull-low. ‘H’ = Enable; ‘L’ = 3.0V or VSS
Disable
Channel selection; please refer to the
CHS2 I channel configuration table. Input with high 3.0V or VSS
resistance.

© Sunplus Technology Co., Ltd. PAGE 32 V1.2 - Nov 01, 2006


RF Communication

Pin Type Function Description Typical Value

Open is forbidden
CHS1 I CHS2. (Ditto) 3.0V or VSS
CHS0 I CHS2. (Ditto) 3.0V or VSS
Data In I Modulation input. Input resistance > 30k, Digital input
SPEAKER O 16Ohm speaker input 16Ohm
ANT - Antenna 50Ohm load

5.3 Application Circuit

ANTENNA ANTENNA

3.3uH 3.3uH
ANT

ANT
GND

GND
GND GND
Data In Data In
CHS0 CHS0
Microcontroller CHS1 CHS1 Microcontroller
CHS2 CHS2
PAEN PAEN
PD
T/R
A B PD
T/R
Data Out Data Out
VDD VDD

SPEAKER SPEAKER
GND GND 3V

3V
27MHz RF Module 27MHz RF Module

Figure 5-2 Application Circuit

5.4 Function and Application

1. Control timing

Figure A is transmitting control timing; Figure B is receiving control timing.

© Sunplus Technology Co., Ltd. PAGE 33 V1.2 - Nov 01, 2006


RF Communication

T/R

PAEN

Data in

PLL Lock-up
time
B
T/R

PAEN

Data out

Random noise

The data transmission and receiving should be performed in one channel. Connect
PAEN and T/R to make the amplifier work immediately when the transmission or receiving
is enabled. PLL lock-up time depends on bandwidth of loop filter.

2. Transmission protocol

„ For higher dependability, the RF data are always transmitted as frame or packet.

„ Preamble is commonly coded as ‘10101010’ for the purpose of leading the data slicer
in the receiving end to a stable state.

„ Sync: The start point of data.

„ CRC: Error check. Simply, DataContent can be checked by the Check Sum.

„ Do not code the content with a serial ‘1’ or a serial ‘0’ to avoid leading the data slicer to
an unstable state and disturbing data decoding.

You can design any format to encode the data in SPRF2716, the following two formats are
recommended:

(1) Manchester Coding

Start Bit Bit“0” Bit“1”

600us 200us 200us 200us 200us 200us

‘Start Bit’ is a start sign for a group of data. The format of logic ‘0’ and ‘1’ are shown as
above. Manchester Coding format is shown below.

© Sunplus Technology Co., Ltd. PAGE 34 V1.2 - Nov 01, 2006


RF Communication

Preamble Start bit ID NO. Data1 Data2 Data3 Data4 Preamble Start bit

20us 20us 800us

0 1 0 0 0 1 1 0 1

Transmit a preamble to enable the T/R control and to start the data frame. The ID
number is the user-defined address for its receiving device which is usually adopted in the
multi-device broadcast communication. The slave will detect each ID number
broadcasted by master. If the ID number that slave receives is matched, the slave will set
up connection with the master at once, or else it will give up the message and receive the
next one. Data2 may be the complementary of data1; data4 may be the complementary
of data3 or the check sum of data1 and data2.

Data receiving technique for Manchester Coding:

It is critical to check the start bit to filter the disturbance of random noise when receiving
data via wireless.

After the start bit, the first transmitting data is ‘0’

After the start bit, the first transmitting data is ‘1’

Figure 5-3 Baud Rate Configuration After Start Bit

Note: Because of latency effect, it is necessary to reserve some time for T/R switching.

(2) Period encoding format

Bit 1 Bit 0

200us 200us

600us 200us

On the merit of this coding format that ‘1’ and ‘0’ are differentiated by the length of period,
the data is provided with a higher anti-jamming capability, but accordingly the complexity of
decoding increases. The preamble and the start bit follow the Manchester Coding format.

© Sunplus Technology Co., Ltd. PAGE 35 V1.2 - Nov 01, 2006


RF Communication

27M frequency features:

„ 11 metres wavelength. To achieve the best efficiency of radiating and receiving, the
wavelength should be 1/4 wavelength according to the theoretic value for the antenna
size, that is, 2.7 metres. It is impossible, however, to fix such an unwieldy antenna in
a product, even if the shorter the antenna is, the worse the connection quality will be.

„ In the metal circumstances the electrical signal will fade, e.g. Putting a 27MHz wireless
mouse on a metal table will reduce its communication range to 50cm.

„ Easy to be interfered by other appliances, such as: compressor, TV set, computer,


motor.

„ Low baud rate, unsuitable for high speed data transmission.

„ Outdoor application: remote control car, interphone, etc.

„ Indoor application: wireless mouse/keyboard, interactive toys, etc.

5.5 How to Reduce EMI and Improve Sensitivity

The interference coming from other electrical appliances up to 27MHz frequency will
reduce the receiving sensitivity and shorten the connection distance. Techniques
recommended below enable you to avoid interference to some degree.

„ Avoid setting CPU Clock frequence to be in the frequency range of receiving

„ Filter the noise generated by power supply via LC/RC Pi-filter

„ Shorten the I/O route in the layout board

„ Place all digital parts away from RF device

„ Use high quality IF-filter to minimize the interference generated by a neighbour channel

© Sunplus Technology Co., Ltd. PAGE 36 V1.2 - Nov 01, 2006


RF Communication

5.6 DEMO Board Schematic


VDD
SPY0029 U3
1 3
IN OUT
C31 C32

GND
+ +
J1 47u 47u
VCC

2
1 Data_Out 10.24M
2 T/R R2 15K X1
3 PD R3 47K
4 PAEN C3 C4 C5 C6
5 CHS2 L1 C8
J2
6 CHS1 R5 10K VDD EXT R4 R1 220n 104 22p 30p
7 CHS0 1 0
8 Data_In C9 102 C10 2 15K
9 3 MIC 1 uH 15p 22n C7
10 RV 104 CON3
11 VCC
C11 47u
CON11 PD T/R MIC1
+ PAEN RV
CHS2 Data_Out MICROPHONE
R7 10 CHS1

48
47
46
45
44
43
42
41
40
39
38
37
CHS0 U2
1

VSS

XO
CPPO
PAEN

OSC1
OSC2
PD

XI

RV
VCT

VDD
CHS2

T/R
2
C14 L2 C16 3 CHS1 R6 3K

1
2
1u 4 CHS0 36
104 5 MICO NC 35
6 MODI NC 34 C12 C13 104
J3 L3 470n C18 10uH 7 VDDH DO 33 104
8 VCC MICEN 32
1 9 PA MICI 31 C17
2 82p C20 10 VEE VREF 30
C21 C22 11 LNAI SPRF2716B CF 29 C19
CON2 5p 12 NC DEMO 28 102
NC OPI

3
200p 100p 27

AVDD3
AVDD2
AVSS3
OPO

SPKO
26 1u R8

RSSI
MXO

LMTI
IF1O
AVSS2
IF1I
25 C23 R9 10K C24

NC
NC
CP
QUAD 2 5K
J4
13
14
15
16
17
18
19
20
21
22
23
24
Antenna Port 470p 1u
1 VCC

1
R10 10
2

L4
R12
F1 455K F2 455K C27 C28 47K TOKO 8128
1 3 1 3 +
1 3 1 3
2

104
47u
2

R11 C25 C26

30K 104 104


J5 C30 47u
VCC
1
+

CON2

Figure 5-4 SPRF2716 Application Circuit Schematic

5.7 Interface for the Speech Channel

ANTENNA

3.3uH
ANT

GND

GND
Data In 3V DC
CHS0
CHS1
CHS2
PAEN
PD
T/R
Data Out Push to Talk
VDD

SPEAKER
GND

Loudspaeaker
27MHz RF Module

Please press the transmission key before you speak; once you release the key, the system
will enter the receiving mode. It is recommended to drive a 16Ohm speaker.

© Sunplus Technology Co., Ltd. PAGE 37 V1.2 - Nov 01, 2006

Das könnte Ihnen auch gefallen