An633 PDF
An633 PDF
An633 PDF
1. Introduction
This document is intended to serve as a guide for application development with EZRadioPRO® radio ICs. It
introduces the major parts of the hardware platform, such as the RF Pico board, which contains the radio and the
necessary RF components required to operate the device according to a desired regulatory standard. It also
introduces the 8-bit wireless motherboard (WMB), which is required to control the radio, evaluate the RF
parameters, and develop custom application programs. Besides the hardware, it also describes the application
programming interface (API) that makes it possible for the WMB and RF pico board to communicate with each
other. Using the software tools provided by Silicon Labs and following this programming guide will make software
development as easy as possible, as these items will assist you in configuring the radio effectively. Additionally, the
first boot of the radio and the whole configuration process are clearly described so that software developers can
primarily concentrate on their own applications without experiencing time-consuming configuration problems.
Several example projects are also provided as good starting points for real applications. A layered software
approach is followed in all the source codes. The software modules are logically separated, and they focus on their
own specific tasks. The document refers to the corresponding data sheets, manuals, and application notes.
Antenna 868 MHz 915 MHz 868 MHz 490 MHz 915 MHz
2 Rev. 0.7
AN633
4. The Wireless Motherboard Hardware Platform
The wireless motherboard platform is a demo, evaluation, and development platform for EZRadioPRO radio ICs. It
consists of a wireless motherboard and interchangeable MCU and RF pico boards.
Rev. 0.7 3
AN633
4.1. The Wireless Motherboard
Power
Supply
Switch
MCU DC/DC Radio GPIO
Converter Connectors
Switch
MCU Test
Pins
4 Rev. 0.7
AN633
4.2. Power Scheme
The power source of the platform can be selected with the power supply selector switch “SUPPLY SELECT” on the
WMB board. If this switch is in the “USB” position, supply voltage is provided by the PC that is connected to the
“J16” mini USB connector. If this switch is in the “BAT” position, the supply voltage is provided by two AA batteries
in the battery holder on the bottom side of the board. If the “SUPPLY SELECT” switch is in the “EXT” position,
supply voltage is provided by an external power source through the “TP7” and “TP9” points.
Using the “MCU dc/dc” switch, the internal dc/dc converter of the C88051F930 MCU on the MCU pico board can
be activated if the connected pico board supports this function. If the switch is in the “OFF” position, the MCU's
dc/dc converter is inactive and the supply voltage is only determined by the state of the “SUPPLY SELECT” switch.
Positioning the switch to either the “LDO (1.25 V)” or “1 CELL” position will turn on the MCU's dc/dc converter by
connecting 1.25–1.5 V supply voltage to the VBAT pin and removing external power from the VDC pin. The MCU
will provide 1.9 V in default setting on its VDC pin to all the other connected loads. Since this current is limited, it
may be necessary to disconnect or disable some loading part of the board. For further details, see the MCU data
sheet and the board schematic. The board schematic can be found in the EZRadioPRO Development Kit User's
Guide. A complete CAD design pack of the board is also available at www.silabs.com.
Rev. 0.7 5
AN633
Table 2. Connections between the WMB Board and the RF Pico Board
Si446x, Si4362, Si406x, Si4438 WMB C8051F930
Pin Number Pin Name Pin Function RF Pico board J1 WMB Con2 Pin Name
connector connector
EP,18 GND Ground 2 1,2,19,20 GND
8 VDD Voltage Supply input 1 17,18 VDD
11 NIRQ Interrupt output 10 7 P0.1
active low
1 SDN Shutdown input 3 8 P2.3
active high
15 NSEL SPI select input 6 6 P1.4
12 SCLK SPI clock input 9 5 P1.0
14 SDI SPI data input 7 3 P1.2
13 SDO SPI data output 8 4 P1.1
9 GPIO_0 General Purpose I/O 12 11 P2.6 (2nd)
10 GPIO_1 General Purpose I/O 11 12 P1.3
19 GPIO_2 General Purpose I/O 5 13 P2.5
20 GPIO_3 General Purpose I/O 4 14 P2.4
6 Rev. 0.7
AN633
A schematic of an RF Pico Board can be found in the EZRadioPRO Development Kit User's Guide. A complete
CAD design pack of all boards is also available at www.silabs.com.
Rev. 0.7 7
AN633
5. Software Development Tools
5.1. Wireless Development Suite
Silicon Labs provides two software tools to help with EZRadioPRO software development: the wireless
development suite (WDS) and the Silicon Labs integrated development environment (IDE). Both software tools are
available at www.silabs.com. The recommended starting point for Si406x, Si4362, Si446x, and Si4438
development is the WDS software tool. After connecting one of the hardware platforms to the PC, WDS is able to
identify the connected boards by reading the EBID memories of the boards. The EZConfigPRO Setup GUI is part
of the WDS program. This setup interface provides an easy path to quickly selecting and loading the desired
configuration for the Si406x, Si4362, Si446x, and Si4438 device. The EZConfigPRO Setup allows four different
methods for device setup. After the desired configuration is selected, the program gives the option to configure
directly the EZRadioPRO chip of the connected hardware, or to modify a selected example code with the
configuration and download it to the connected hardware. It is possible to export and save the example projects
and radio configuration file (radio_config.h) from the WDS. Using the header file generated by the WDS is highly
recommended. Manual editing in the header file may cause problems and prevent the radio from working correctly.
For more complete information on WDS and EZConfigPRO usage, refer to the WDS User's Guide. Figure 4 is a
summary of the WDS configuration workflow.
8 Rev. 0.7
AN633
Open
Radio Configuration Application
in WDS
Unmodulated Carrier
Empty Project
RF Parameters
Packet
Interrupt
Select Action
Rev. 0.7 9
AN633
5.2. Silicon Labs IDE
The Silicon Laboratories integrated development environment (IDE) is a standard tool for program development for
any Silicon Labs 8-bit MCUs, including the C8051F930 that is used on the hardware platforms described in this
document. The Silicon Laboratories IDE integrates a project manager, a source-code editor, source-level
debugger, and an in-system flash programmer. The IDE interfaces to third party development tool chains to provide
system designers a complete embedded software development environment. The Keil Demonstration Toolset
includes a compiler, linker, and assembler and easily integrates into the IDE.
Workflow for downloading and running a project:
1. Connect the hardware platform to the PC according to the description of the used platform.
2. Start Silicon Labs IDE (IDE 4.40 or higher required) on your computer.
3. Select ProjectOpen Project... to open a previously saved project.
4. Before connecting to the target device, several connection options may need to be set. Open the
Connection Options window by selecting OptionsConnection Options... in the IDE menu.
5. Select USB Debug Adapter in the "Serial Adapter" section.
6. If more than one adapter is connected, choose the appropriate serial number from the drop-down list.
7. Check “Power target after disconnect" if the target board is currently being powered by the USB Debug
Adapter. The board will remain powered after a software disconnect by the IDE.
8. Next, the correct "Debug Interface" must be selected. Check the C2 Debug Interface.
9. Once all the selections are made, click the OK button to close the window.
10. Click the Connect button in the toolbar or select DebugConnect from the menu to connect to the MCU
of the platform.
11. Erase the flash of the MCU in the DebugDownload object codeErase all code space menu item.
12. Download the desired HEX file either by hitting the Download code (Alt+D) toolbar button or from the
DebugDownload object code menu item.
13. Hit the Disconnect toolbar button or invoke the DebugDisconnect menu item to release the device
from halt and to let it run.
10 Rev. 0.7
AN633
In addition to the standard two UART pins (TX and RX), there are two GPIO/UART handshaking pins on the
ToolStick Base Adapter. On both the WMB and RFStick platforms GPIO0 is used for the internal purpose of the
WDS to select between the C2 interface of the target MCU and the EBID MCU. GPIO1 is not connected. Although
the separate ToolStick Terminal application provides the functionality to control these GPIOs, default settings for
GPIO0 should not be changed.
Rev. 0.7 11
AN633
6. Radio Hardware Interface
The EZRadioPRO devices can be controlled by the host MCU over an SPI bus and six additional signals. The user
has access to the radio's API via the SPI bus.
Signal Description
12 Rev. 0.7
AN633
7. Application Programming Interface
The programming interface allows the user to do the following:
Send commands to the radio.
Read status information.
Set and get radio parameters.
Handle the Transmit and Receive FIFOs.
The API commands are listed in Table 4. The following sections describe the SPI transactions of sending
commands and getting information from the chip.
BOOT_COMMANDS
0x02 POWER_UP Command to power-up the device and select the operational
mode and functionality.
COMMON_COMMANDS
0x15 FIFO_INFO Access the current byte counts in the TX and RX FIFOs and pro-
vide for resetting the FIFOs.
0x20 GET_INT_STATUS Returns the interrupt status of ALL the possible interrupt events
(both STATUS and PENDING). Optionally, it may be used to
clear latched (PENDING) interrupt events.
0x50 FRR_A_READ Reads the fast response registers (FRR) starting with FRR_A.
0x51 FRR_B_READ Reads the fast response registers (FRR) starting with FRR_B.
0x53 FRR_C_READ Reads the fast response registers (FRR) starting with FRR_C.
0x57 FRR_D_READ Reads the fast response registers (FRR) starting with FRR_D.
Rev. 0.7 13
AN633
Table 4. Command Summary (Continued)
IR_CAL_COMMANDS
TX_COMMANDS
RX_COMMANDS
0x16 PACKET_INFO Returns information about the length of the variable field in the
last packet received and (optionally) overrides field length.
0x22 GET_MODEM_STATUS Returns the interrupt status of the Modem Interrupt Group (both
STATUS and PENDING). Optionally, it may be used to clear
latched (PENDING) interrupt events.
ADVANCED_COMMANDS
0x14 GET_ADC_READING Performs conversions using the Auxiliary ADC and returns the
results of those conversions.
0x21 GET_PH_STATUS Returns the interrupt status of the Packet Handler Interrupt
Group (both STATUS and PENDING). Optionally, it may be
used to clear latched (PENDING) interrupt events.
0x23 GET_CHIP_STATUS Returns the interrupt status of the Chip Interrupt Group (both
STATUS and PENDING). Optionally, it may be used to clear
latched (PENDING) interrupt events.
The following sections describe the SPI transactions of sending commands and getting information from the chip.
14 Rev. 0.7
AN633
to send (CTS) signal shows the actual status of the command buffer of the radio. It can be monitored over the SPI
or on GPIOs, or the chip can generate an interrupt if it is ready to receive the next command. These three options
are detailed below.
NSEL
SDO CTS
SDI 0x44
SCK
Figure 6. Polling the Radio Availability
Rev. 0.7 15
AN633
7.2.2. GPIO Checking Method
Any GPIO can be configured for monitoring the CTS. GPIOs can be configured to go either high or low when the
chip has completed the command. The function of the GPIOs can be changed by the GPIO_PIN_CFG command.
By default, GPIO1 is set as "High when command completed, low otherwise" after Power On Reset. Therefore, this
pin can be used for monitoring the CTS right after Power On Reset to know when the chip is ready to boot up.
7.2.3. NIRQ Interrupt Checking Method
The radio asserts the CHIP_READY interrupt flag if a command is completed. The interrupt flag can be monitored
by either the GET_CHIP_STATUS or the GET_INT_STATUS command. Apart from monitoring the interrupt flags,
the radio may pull down the NIRQ pin if this feature is enabled. If a new command is sent while the CTS is
asserted, then the radio ignores the new command. The Si446x can generate an interrupt to communicate this
error to the MCU by the CMD_ERROR interrupt flag in the CHIP_STATUS group. The interrupt flag has to be read
(by issuing a GET_CHIP_STATUS or GET_INTERRUPT_STATUS command) to clear the pending interrupt and
release the NIRQ pin. No other action is needed to reset the command buffer of the radio, but, after a
CMD_ERROR, the host MCU should repeat the new command after the radio has processed the previous one.
All the commands that are sent to the radio have the same structure. After pulling down the NSEL pin of the radio,
the command ID should be sent first. The commands may have up to 15 input parameters.
0xFF
Retrieve
Send Command Read CTS CTS Value
Response
Not
0xFF
Figure 8. Read Procedure
If the CTS is polled on the GPIOs, or the radio is configured to provide interrupt if the answer is available, then the
response can be read out from the radio with the following SPI transaction.
16 Rev. 0.7
AN633
NSEL
SD I 0x44
SCLK
Re ad CT S
N SEL NSE L
N ot
SDO CT S 0 xFF SD O
CT S V alue
SD I 0x44 SD I
SC LK 0xF F SCLK
N SEL
SD I
SC LK
Figure 10. Monitor CTS and Read the Response on the SPI Bus
Reading the response from the radio can be interrupted earlier. For example, if the host MCU asked for five bytes
of response, it may read fewer bytes in one SPI transaction. As long as a new command is sent, the radio keeps
the response for the last request in the command buffer. The host MCU can read the response several times in a
new SPI transaction. In such a case, the response is always provided from the first byte.
Notes:
Up to 16 bytes of response can be read from the radio in one SPI transaction. If more bytes are read, the
radio will provide the same 16 bytes of response in a circular manner.
If the command says that the host MCU expects N bytes of response, but during the read sequence, the
host MCU provides less than N bytes of clock pulses, it causes no issue for the radio. The response buffer
is reset if a new command is issued.
If the command says that the host MCU expects N bytes of response, but during the read sequence, the
host MCU provides more than N bytes of clock pulses, the radio will provide unpredictable bytes after the
first N bytes. The host MCU does not need to reset the SPI interface; it happens automatically if NSEL is
pulled low before the next command is sent.
Rev. 0.7 17
AN633
7.4. Using Fast Response Registers
There are several types of status information that can be read out from the radio faster. The FRR_CTL_x_MODE
(where x can be A, B, C or D) properties define what status information is assigned to a given fast response
register (FRR). The actual value of the registers can be read by pulling down the NSEL pin, issuing the proper
command ID, and providing an additional eight clock pulses on the SCLK pin. During these clock pulses, the radio
provides the value of the addressed FRR. The NSEL pin has to be pulled high after finishing the register read.
Fast Response R. B
0x51
F ast Response R. B Fast Response R. C Fast Response R. D Fast Response R. A Fast Response R B
0x51
Figure 12. Reading More Fast Response Registers in a Single SPI Transaction
Note: If the pending interrupt status register is read through the FRR, the NIRQ pin does not go back to high. The pending
interrupt registers have to be read by a Get response to a command sequence in order to release the NIRQ pin.
18 Rev. 0.7
AN633
7.5. Write and Read the FIFOs
There are two 64-byte FIFOs for RX and TX data in the Si4x6x.
To fill data into the transmit FIFO, the host MCU should pull the NSEL pin low and send the 0x66 Transmit FIFO
Write command ID followed by the bytes to be filled into the FIFO. Finally, the host MCU should pull the NSEL pin
high. Up to 64 bytes can be filled into the FIFO during one SPI transaction.
NSEL
SDO
SCLK
NSEL
SDI 0x77
SCLK
Rev. 0.7 19
AN633
7.6. SPI Communication Capture Example
Figure 15 shows an actual SPI communication capture taken by a logic analyzer. The signals being monitored are
SDI, SDO, and NSEL between the radio IC and the host MCU. The first command being sent is FIFO_INFO
(command ID 0x15) with an input parameter of 0x01, which will reset the TX FIFO. Right after sending the
FIFO_INFO command, the CTS is being monitored (0x44). For the first attempt, it is still busy; the returned value is
NOT 0xFF, so NSEL goes back high. For the second attempt, the CTS value will be 0xFF, meaning that the radio
IC has processed the command (i.e. resetting the TX_FIFO), and it is ready to provide the response bytes of the
FIFO_INFO command. Therefore, NSEL stays low, and two dummy bytes are provided via SDI to read out the two
response bytes through SDO. The response bytes are RX FIFO count and TX FIFO count numbers for the
FIFO_INFO command. The next sequence is sending GET_STATUS command with three input bytes, all zeroes,
to clear all ITs, and then retrieving the response bytes of the command after checking CTS. Once the ITs are
cleared, six bytes are being written to the TX FIFO via WRITE_TX_FIFO command (0x66). Lastly, START_TX
command is being sent to initiate an actual transmission. For more details of the commands described here, please
see the html-based API documentation.
20 Rev. 0.7
AN633
8. Radio Initialization
8.1. State Transitions of the EZRadioPRO Devices
Ready state is designed to give a fast transition time to TX or RX state with reasonable current consumption. In this
mode the crystal oscillator remains enabled reducing the time required to switch to TX or RX mode by eliminating
the crystal start-up time. An automatic sequencer will put the chip into RX or TX from any state. It is not necessary
to manually step through the states. Although it is not shown in the diagram, any of the lower power states can be
returned to automatically after RX or TX.
Rev. 0.7 21
AN633
TX RX
Shutdown 15 ms 15 ms
TX Tune 60 µs 125 µs
RX Tune 120 µs 84 µs
TX 130 µs 132 µs
RX 120 µs 108µs
*Note: While the chip is in sleep state, the NSEL pin has to stay in high state. If the host processor is not able to provide this
during sleep, a pullup resistor can be necessary on the NSEL pin.
Figure 17. Supply Current versus Time Diagram from Shutdown to RF initialized Ready State
22 Rev. 0.7
AN633
Figure 18. Supply Current versus Time Diagram from Shutdown to Standby State
Figure 19. Supply Current versus Time Diagram from Shutdown to TX State
Rev. 0.7 23
AN633
Figure 20. Supply Current versus Time Diagram from Shutdown to RX State
24 Rev. 0.7
AN633
8.2. Radio Chip Waking Up
First, the radio is in the off state. After the SDN pin is pulled low, the radio wakes up and performs a Power on
Reset which takes a maximum of 6 ms (900 µs typical at room temperature) until the chip is ready to receive
commands on the SPI bus. The GPIO1 pin goes high when the radio is ready for receiving SPI commands. During
the reset period, the radio cannot accept any SPI commands. There are two ways to determine if the chip is ready
to receive SPI commands after a reset event. Either use a timer in the host microcontroller to wait or connect the
GPIO1 pin of the radio to the host MCU and poll the status of this pin. During power on reset, it remains low. Once
the reset is finished, the radio sets the GPIO1 to the high state.
Next, the radio device has to be sent to active mode by issuing a "POWER_UP" command via the SPI interface
which takes approximately 15 ms to be completed. It can be monitored in three ways. If the command is completed
either the GPIO1 pin of the radio goes low by issuing the command and the radio sets it to high state or the NIRQ
pin is asserted or the host MCU can monitor CTS over the SPI.
Start
1.
Host MCU SDN = 10us
Initialization
Host MCU applies
SDN pulse
Optional
2.
Radio Power
Wait for max. delay of N
On Reset GPIO1 = ?
POR (<6ms)
(POR)
Y
Optional
N N N
3. CTS ready
nIRQ = ? GPIO1 = ?
Radio over SPI?
Boot
Y Y Y
Optional
N N
CTS ready
GPIO1 = ?
over SPI?
Y Y
4.
Radio
Ready
Rev. 0.7 25
AN633
8.3. Radio Initialization with Generated Radio Configuration File
8.3.1. Radio Initialization with RF Parameters
26 Rev. 0.7
AN633
The radio parameter configuration process can be accomplished by using the Wireless Development Studio
(WDS). After the required parameters are given to the radio configuration application, the WDS creates the
configuration data based on these parameters. If the Launch IDE option is selected, the WDS generates a
radio_config.h header file that contains the configuration data. This header file contains all the information needed
by the application to configure the radio properly. This information includes the parameters of the RF link such as
the modulation type, channel bandwidth, data rate, center frequency, crystal tolerance, crystal capacitor bank
value, modulation source, CRC calculation and sync word setting. For more complete information on WDS and
EZConfigPRO usage, refer to the WDS User's Guide.
8.3.2. Generated Radio Configuration File
The configuration file is automatically generated by the "Radio Control Application" tool. It is interpreted as a C-
header file called "radio_config.h" and it has four sections. The first two sections are intended for the users and
allow them to see the exact values of the API properties. The last two sections are specifically intended for the
example projects. The structure of the header file is shown in Figure 23.
Rev. 0.7 27
AN633
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* This software must be used in accordance with the End User License Agreement.
The "Radio Setup Configuration in Definitions" section is the list of initialization commands that are sent to the radio
over the SPI interface. The structure of one element of the list is shown below. The comment lines describe how
the C definition configures the dedicated API properties. The C define line stands for the initialization command.
28 Rev. 0.7
AN633
The commented lines explain which API property/properties will be overwritten with new value(s). For example,
this definition is responsible for initializing three API properties of the radio at one time, "MODEM_MOD_TYPE",
"MODEM_MAP_CONTROL", and "MODEM_DSM_CTRL". The format of the definition is as follows:
The first byte is the command ID of the "SET_PROPERTY" API command.
The next three bytes are the requirements of the command:
MSB of the starting location of the API property
Number of the immediate adjacent API properties
LSB of the starting location of the API property
Number of
Command Starting Property Properties
Starting
Value Value Value
ID (MSB) (N) Property (LSB) N
1 ...
Starting Number of
Length of Command Properties Starting Value Value
Property Value
API command ID Property 1 ...
(MSB) (N) N
(LSB)
Rev. 0.7 29
AN633
9. Example Projects and Software Layers
9.1. Software Layers
In all of the sample projects, the layered software approach is followed. There is a distinct scope for each software
module, and all modules can communicate through each other's API functions. The software modules are
separated and focused to cover one specific task. Figure 26 shows the software layers and its relations.
30 Rev. 0.7
AN633
Rev. 0.7 31
AN633
Cleanup.bat—Batch file used to delete all files generated during build process.
32 Rev. 0.7
AN633
9.4.1. Common Software Modules Location
Rev. 0.7 33
AN633
9.4.3. Timer Peripheral Module
The timer-related source files, called timer.h and timer.c, are located in the /src/drivers/ folder. This module handles
two 16-bit timers, timer2 and timer3. The most accurate timing interval can be calculated from the frequency of the
system clock, which is generally 24.5 MHz. External clock sources can be selected as timer input and the required
timing frequency can be adjusted thoroughly with several different prescalers. In general, the timer files are set to a
frequency of 1 kHz (1 ms). By using the timer with 1 ms settings, timeouts that are a multiple of 1 ms can be easily
implemented. Timer-related operations provide options to start or stop counting. Additionally, interrupts can be
generated when the low byte of the timer overflows. Timers can also be checked for expiration.
34 Rev. 0.7
AN633
9.4.4. Programmable Counter Array Module
The programmable counter array (PCA)-related source files, called pca.h and pca.c, are located in the /src/driver/
folder. This module initializes the PCA, which creates beeping sounds from the buzzer. The time-base source of
the PCA can be selected. Interrupts can be generated when the lower byte of the counter overflows. PWM-mod
cycle length also can be selected to modify the frequency of the tweeting sound.
Rev. 0.7 35
AN633
36 Rev. 0.7
AN633
Rev. 0.7 37
AN633
9.4.6. Human Machine Interface Module
The human machine interface (HMI)-related source files, called hmi.h and hmi.c, are located in the /src/driver/
folder. In order to use this module, the required handlers need to be initialized at the very beginning of the program.
The status of the various hardware components must be checked in order to have a common cyclic mechanism. In
addition, it is vital that a 1 ms interrupt-based cycle run in the background to serve the different handlers. Using the
LED handler, states of LEDs can be set and cleared either separately or together.
Using the button handler, statuses of the push-buttons can be read. If multiple button events happen
simultaneously, they can be stored to be handled later. The last pushed button event is always available first
amongst the un-handled events. Using the buzzer related sub-interface, the state of buzzer can be changed to the
required one.
38 Rev. 0.7
AN633
Rev. 0.7 39
AN633
40 Rev. 0.7
AN633
9.4.8. Size Optimization of the Common Software Modules
To optimize the code size of the common software modules and consequently the example source codes, software
switches must be introduced in almost every module. By enabling these switches, new functions can be added to
the whole project to compile. If the switch is not defined at the beginning of the bsp.h header file, then only the
basic features can be used, which is barely sufficient for most of the example codes.
The rest of the module’s features can be added to the project by defining the following switches:
TIMER_DRIVER_EXTENDED_SUPPORT
SPI_DRIVER_EXTENDED_SUPPORT
HMI_DRIVER_EXTENDED_SUPPORT
UART_DRIVER_EXTENDED_SUPPORT
The control_IO and PCA modules are quite simple, so there is no need to use driver extension in these cases.
Rev. 0.7 41
AN633
Table 7 shows the comparison between the modules’ sizes:
Timer 60 146 58
UART 49 246 80
42 Rev. 0.7
AN633
9.5. Radio Driver
The radio driver module resides in a low-level driver software layer. It is intended to provide a user-friendly and
easy-to-use API to the radio functionality. It contains API functions and macro definitions for all radio commands.
Constants can be found in the "EZRadioPRO API Documentation" zipped html file at http://www.silabs.com/
products/wireless/EZRadioPRO/Pages/Si446x.aspx. Including this driver module into the software project makes
the control of the radio chip easier than ever before through its comprehensive public API functions. The driver
handles all the SPI communication with the chip, including the check for the CTS signal, and automatically reads
the response from the chip. Thanks to the layered approach, it can be easily ported to other architectures and
platforms, as it depends only on the Hardware Application Layer. This means it is enough to port the HAL for a
given architecture in order to get the radio driver work. As introduced in the other drivers, the radio driver also can
be compiled with different support types (Minimal, Extended or Full). Depending on which support type defined, the
radio driver provides different level of API coverage. This way it provides a convenient way of managing the
compile firmware size depending on the API functions usage and excludes the unused and, therefore,
unnecessary functions.
9.5.1. Radio Driver Location
Rev. 0.7 43
AN633
9.5.2. Size Optimization of the Radio Driver
In order to optimize the code size of the common software modules and consequently the example project as well,
software switches must be introduced in the radio driver. By activating the switches, new functions can be added to
the radio driver. There are three ways of using it. If any of the radio driver switches is not defined at the beginning
of the bsp.h header file, then only the basic features are used. It is sufficient for all example projects to work. The
rest of the features can be added to the driver in two levels with the following switches:
RADIO_DRIVER_EXTENDED_SUPPORT
RADIO_DRIVER_FULL_SUPPORT
Software Switch
44 Rev. 0.7
AN633
RADIO_DRIVER_EXTENDED_SUPPORT
RADIO_DRIVER_FULL_SUPPORT
Default – No switch RADIO_DRIVER_EXTENDED_SUPPORT
Rev. 0.7 45
AN633
9.5.3. Minimal Radio Driver
46 Rev. 0.7
AN633
Input Parameter(s): CHANNEL : Channel number.
CONDITION : Start RX condition.
RX_LEN : Payload length (exclude the PH generated CRC).
NEXT_STATE1 : Next state when Preamble Timeout occurs.
NEXT_STATE2 : Next state when a valid packet received.
NEXT_STATE3 : Next state when invalid packet received (e.g., CRC error).
Return Value: None
Rev. 0.7 47
AN633
9.5.4. Extended Radio Driver
48 Rev. 0.7
AN633
9.5.5. Full Radio Driver
Rev. 0.7 49
AN633
50 Rev. 0.7
AN633
Rev. 0.7 51
AN633
52 Rev. 0.7
AN633
10. Example Projects
The general structure of an example can be seen in Figure 34. All the tasks are separated into two groups: the
Hardware Initialization part and the Main Process part. The Host MCU related tasks initialize the physical interface
between the radio and the controller unit including the SPI lines (SCLK, SDI, SDO, NSEL) and general
I/O ports (SDN, NIRQ). After that, the internal timer module is initialized in order to provide precise timing for the
handlers. Some example projects do not use handlers due to their simplicity (e.g., the un-modulated carrier or the
pseudo random transmission projects). Handlers are for monitoring and changing the state of the WMB
peripherals. It is necessary to initialize the required handlers before using them. The radio-related tasks prepare
the radio for the communication. The shutdown state may be entered by driving the SDN pin high. When coming
out of the shutdown state a power on reset will be initiated along with the internal calibrations. After the POR and
the BOOT sections, it is required to initialize the radio with the RF settings. It is highly recommended to use the
configuration header file (radio_config.h) generated by the wireless development suite. Manual editing in the
header file can cause discrepancies and prevent the radio from working correctly. After the radio RF is initialized,
the Main Process has two major tasks to do. It continuously updates the peripheral handlers and processes the
user application code. The radio can be controlled from a high level due to the layered, customizable, user-friendly
radio driver module.
Rev. 0.7 53
AN633
All example projects described in this document are configurable for radio parameters and available from within
WDS (Wireless Development Suite).
54 Rev. 0.7
AN633
10.3. Direct Transmission (Synchronous)
For legacy systems that perform packet handling within the host MCU or other baseband chip, it may not be
desirable to use the FIFO. The direct transmission example code bypasses the TX FIFO entirely. The TX
modulation data is applied to an input pin of the chip. Data is not stored in the TX_FIFO for transmission at a later
time. The host MCU sends data to the radio. Data can be synchronized either with the rising or the falling edge of
the clock signal provided by an output pin of the RF chip.
Figure 37. GPIO Connections Between the Radio and the Host MCU
Rev. 0.7 55
AN633
10.4. Direct Reception (Synchronous and Asynchronous)
For legacy systems that perform packet handling within the host MCU or other baseband chip, it may not be
desirable to use the FIFO. The direct reception example code bypasses the RX FIFO entirely. The RX modulation
data is provided by an output pin of the RF chip to the host MCU. Data is not stored in the RX_FIFO after the
reception. In synchronous mode, the data and the clock signals are synchronized.
Figure 39. GPIO connections between the radio and the host MCU
56 Rev. 0.7
AN633
10.5. Standard Packet Transmission
The purpose of the standard packet transmission example code is to demonstrate how the radio can send packets
in FIFO mode. If any of the four push buttons are pressed on the wireless motherboard then the host MCU will load
the appropriate packet content in TX_FIFO and after that will send it. The payload is a pre-defined content, namely
“BUTTONx” where x can be 1, 2, 3, or 4. The used packet can be seen below:
Rev. 0.7 57
AN633
10.6. Standard Packet Reception
The purpose of the standard packet reception example code is to demonstrate how the radio can receive packets
in FIFO mode. Additionally, the receivers and the transceivers are compatible with Si4010 transmitters used in
other development kits. Therefore, it supports several packet types:
Fixpacket content
Key Fob packet (type A)
Key Fob packet (type B)
58 Rev. 0.7
AN633
10.6.1. Packet with Fixed Content
The payload has its pre-defined content, namely “BUTTONx” where x can be 1, 2, 3, or 4. The used packet can be
seen below:
Preamble Sync Word Function Control Byte One’s Complement of Function Control Byte
Function Byte
OUT3/F1 sent out first, OUT0–OUT3 represent the four LED outputs, F0–F1 represents the function bits. Output
functions are controlled by the function bits. Function bits’ operations are shown on the following table:
F1 F0 Function
0 0 No change
Rev. 0.7 59
AN633
10.6.3. Key Fob Packet (Type B)
The following development kits use also this type of packet:
Si4010/Si4355 Key Fob Development Kit
Si4010/Si4355 One-Way AES Development Kit
Si4010/Si4355 One-Way Sub-GHz Key Fob to LED Receiver Stick
Si4455 Two-Way Sub-GHz Key Fob to LED Receiver Stick
The used packet can be seen below:
60 Rev. 0.7
AN633
Rev. 0.7 61
AN633
10.10. 802.15.4g Bidirectional Project
This example project demonstrates how to use the Si446x radio IC for 15.4g packets in regular boot mode. Just
like the standard Bidirectional code (Section 10.9 Two-Way Packet), it implements a two-way communication link.
Pushing a button on one side results in sending a packet to the other side; the incoming packet is acknowledged by
sending back an ACK packet (see Figure 44 below). A node can be either a sender or a receiver. The main
difference between the two projects is that the 15.4g example shows how to configure the device to meet the
802.15.4g SUN-PHY specification, which is described by the IEEE 802.15.4g-2012 standard (referred to as
“standard” later in this document). Although the standard specifies both the PHY and the MAC layers, only the PHY
has been implemented when designing the example project (from a radio IC configuration standpoint the PHY
layer is the point of interest; the MAC is one layer above the PHY and needs to be implemented by the user
application. There is no HW/API support in regular boot mode for the MAC).
Radio Ready
RF initialized
Send regular Packet
Y
NIRQ IT arrived? Clear and Read ITs
Y
Leave RX state
CMD error IT?
Reset FIFO
Y Y
ACK message Blink LED4
Packet Sent IT?
sent? (ACK sent)
Y Y
N
Packet ACK message Blink four LEDs
Received IT? received? (ACK arrived)
62 Rev. 0.7
AN633
PSDU (payload + CRC). The PHR contains fields to select between 2– and 4–byte CRCs (FCS field), data
whitening enable/disable (DW field), and length (Length field). The mode switching field (MS field) is disabled (not
supported by the radio). The packet feature and the naming convention of the standard and the radio IC are shown
in Figure 45.
Rev. 0.7 63
AN633
The standard requires the data bytes being sent in an LSB manner, which is taken care of by the radio IC. The
data, i.e., PHR + payload, is being put into the TX FIFO in MSB, but sent over the air in LSB. On the receive side,
the payload is being read out from the RX FIFO in MSB, but the PHR will be in LSB (!). Taking an example from the
standard where 0x40 00 56 is being sent over the air (i.e., 0x02 00 6A in MSB), the four different scenarios are the
following:
The preamble pattern is a fixed, 0101 pattern, but can be of any length. The sync word is also fixed, a two-byte,
0x904E pattern (these are the default values in the WDS GUI for the project). The standard allows a maximum of
2047 bytes in length (including the FCS), but the sample code has a limit of 64-bytes. If needed, it can be extended
up to the maximum by using TX FIFO Almost Empty, RX FIFO Almost Full Interrupts. For such long packets,
please refer to Long Packet TX/RX example projects.
64 Rev. 0.7
AN633
10.11. Custom Packet Reception Containing Variable Length Field
This example code works the same way as the standard packet reception with the exception that the content of the
payload fields in the packet is customizable. It is possible to receive a packet whose payload data field length is not
known in advance. In such a scenario, the transmitted packet must contain byte(s) that specify the length of the
variable field. There is no requirement for length byte(s) to occur at one mandatory location in the packet (e.g.,
immediately following the Sync Word). However, the receiver must obviously know in advance which byte(s) of the
received packet represents the length value. Furthermore, these length byte(s) must be located in the packet
before the variable length field, else the packet handler in the receiver will not have the information in time to
allocate the received data bytes to the appropriate data field. The variable packet length byte(s) can be either in
field1, field2, field3, or field4. The variable packet length information must necessarily be a fixed length field.
The variable-length field need not immediately follow the length byte(s) but must occur after the field containing the
length byte(s). The variable-length field can be either in field2, field3, field4, or field5.
Rev. 0.7 65
AN633
66 Rev. 0.7
AN633
Rev. 0.7 67
AN633
10.12. Custom Packet Reception with Matching Capability
The purpose of the packet match reception example code is to demonstrate how the radio can filter packets that
are intended for one receiver. The Radio ICs of Si4x6x family provide for fully configurable matching functionality
on up to 4 data bytes in the data fields (field1 to field5) of the packet. The match function is typically used to
implement header check or broadcast check capability that is used to quickly determine if a packet is intended for
one receiver node in a network. If a match is not found, the chip can abort reception of the packet and proceed to
scanning for the next packet.
There are four match bytes at configurable locations in the packet. They must be located within the first 32 bytes
following the end of the Sync Word. It is also necessary that the offset of the match bytes be in ascending order.
The offset location of match #1 byte must be less than the location of match #2 byte, and so on. No two match
bytes may have the same offset location. It is not possible to configure two different match functions against the
same received data byte.
68 Rev. 0.7
AN633
Rev. 0.7 69
AN633
10.13. Packet Reception with Automatic Hopping Capability
The purpose of the standard packet reception with automatic hopping feature example code is to demonstrate how
the radio can receive packets in FIFO mode and how rapidly it scans frequency channels to search for signals.
Once the device is configured into the RX state, it automatically starts hopping through the pre-configured channels
on different frequencies. The given mathematical formula represents how the internal firmware calculates new
frequencies to hop.
The hop table can hold up to 64 channel numbers. The receiver starts receiving at the base channel and hops in
sequence from the top of the hop table to the bottom. It stays on that particular channel for receiving a packet. If no
receiving packet arrives upon given conditions, it will calculate a new scannable RF frequency. The table will wrap
around to the base channel once it reaches the end of the table. A channel number is configured to 0xFF in the
table to indicate that the channel should be skipped.
70 Rev. 0.7
AN633
Rev. 0.7 71
AN633
After the radio is configured to the receiver state, the PLL will be settled within 50 µs, followed by the RX settling
time. Depending on whether the AFC is used or not, the RX settling time can last an extra 8 or 16 bits time. If the
RSSI detection method is used, please consider the RSSI settling time which is an additional 4 bits time. If the
frequency hopping system is not time synchronized, then the transmitter can send a packet occasionally while the
receiver is continuously scanning the channels. The best approach is to transmit the preamble as long as it takes to
scan all channels. That ensures that the receiver will find the preamble and will be able to receive the packet
independently on whichever channel it is transmitted. The required minimum preamble length can be calculated as
follows:
1. If the RSSI timeout method is used:
Number_of_Channels_to_scan
Number_of_Channels_to_scan
This following figure shows the receiver timing behavior if both the preamble and the RSSI conditions are used.
72 Rev. 0.7
AN633
Rev. 0.7 73
AN633
10.14. Packet Reception with Manual Hopping Capability
The purpose of the standard packet reception with manual hopping feature example code is to demonstrate how
the radio can receive packets in FIFO mode and how rapidly it scans frequency channels to search for signals.
Once the device is configured into the RX state, it automatically starts hopping through the pre-configured channels
on different frequencies. The RX_HOP API command provides the fastest method for hopping from one channel to
another channel but it requires more management by the host MCU. Using the RX_HOP command, the turn-
around time is 75 µs. The timing is faster with this method than using either the START_RX or
RX_HOP_CONTROL (automatic hopping) API commands because one of the calculations required for the
synthesizer calibrations is offloaded from the radio chip. The arguments of the RX_HOP command are calculated
by the Wireless Development Suite. They must be stored by the host that provides them for the radio.
74 Rev. 0.7
AN633
Rev. 0.7 75
AN633
10.15. Continuous Transmission of Custom Amount of Standard Packets
The purpose of the standard packet transmission example code is to demonstrate how the radio can send packets
in FIFO mode continuously. If the first button is pressed on the Wireless Motherboard then the host MCU will load
the pre-defined content, namely “BUTTON1” in TX_FIFO and after that will send it. Pressing the button once
prompts the radio to send the specified number of the same packets sequentially.
76 Rev. 0.7
AN633
min Transmit Time = T SLEEP Time + T XTal on + PLL settle + T one packet
Rev. 0.7 77
AN633
(
Figure 59. Standards Packet Reception with Low Duty Cycle Flowchart
78 Rev. 0.7
AN633
Rev. 0.7 79
AN633
80 Rev. 0.7
AN633
Rev. 0.7 81
AN633
10.19. Cooperation Between the Example Projects
Since several example projects based on packet-related communication are introduced in the Wireless
Development Suite, it is essential to know which projects can communicate with each other in order to create a
working one way-link. They are customizable in RF perspective such as by modulation type, data rate, deviation,
etc. The payload is also customizable due to 5 configurable fields provided by the packet handler. AN632 can
provide information about the projects’ behavior and their purpose.
N/A X
N/A X X X
X N/A
Custom
X N/A X X
Frequency Packet
X X N/A X
Hop RX
X X X N/A
82 Rev. 0.7
AN633
N/A X X X X
N/A X X X X
X X N/A X X
X X N/A X X
X X X X X
X X X X X
Rev. 0.7 83
AN633
10.20. Empty Project
The empty project is created to help users write custom firmware. The project follows the convention for directory
structure introduced in the sample projects. It contains driver modules for the radio and MCU peripherals as well as
a default MCU initialization procedure. The porting of an example project to an MCU of choice can be done easily
thanks to the layered approach of the project structure. This reduces the effort required to compile the code for
other architecture, as only the low-level functions must be modified. The general structure of the project can be
seen in the following figure. All the tasks are separated into two groups: the Hardware Initialization part and the
Main Process part. Host MCU-related tasks initialize the physical interface between the radio and the controller
unit, including the SPI lines (SCLK, SDI, SDO, NSEL), general I/O ports (SDN, NIRQ). The radio related tasks
prepare the radio for the communication and put the radio in ready state.
84 Rev. 0.7
AN633
11. Additional Resources
AN104: Integrating Keil 8051 Tools into Silicon Labs IDE
AN796: Wireless Development Suite General Description
AN632: WDS User's Guide for EZRadioPRO® Devices
Si406x Data Sheet
Si4362 Data Sheet
Si4464/63/61/60 Data Sheet
Si4438 Data Sheet
Rev. 0.7 85
Simplicity Studio
One-click access to MCU and
wireless tools, documentation,
software, source code libraries &
more. Available for Windows,
Mac and Linux!
Disclaimer
Silicon Labs intends to provide customers with the latest, accurate, and in-depth documentation of all peripherals and modules available for system and software implementers using or
intending to use the Silicon Labs products. Characterization data, available modules and peripherals, memory sizes and memory addresses refer to each specific device, and "Typical"
parameters provided can and do vary in different applications. Application examples described herein are for illustrative purposes only. Silicon Labs reserves the right to make changes
without further notice and limitation to product information, specifications, and descriptions herein, and does not give warranties as to the accuracy or completeness of the included
information. Silicon Labs shall have no liability for the consequences of use of the information supplied herein. This document does not imply or express copyright licenses granted
hereunder to design or fabricate any integrated circuits. The products are not designed or authorized to be used within any Life Support System without the specific written consent of
Silicon Labs. A "Life Support System" is any product or system intended to support or sustain life and/or health, which, if it fails, can be reasonably expected to result in significant personal
injury or death. Silicon Labs products are not designed or authorized for military applications. Silicon Labs products shall under no circumstances be used in weapons of mass
destruction including (but not limited to) nuclear, biological or chemical weapons, or missiles capable of delivering such weapons.
Trademark Information
Silicon Laboratories Inc.® , Silicon Laboratories®, Silicon Labs®, SiLabs® and the Silicon Labs logo®, Bluegiga®, Bluegiga Logo®, Clockbuilder®, CMEMS®, DSPLL®, EFM®, EFM32®,
EFR, Ember®, Energy Micro, Energy Micro logo and combinations thereof, "the world’s most energy friendly microcontrollers", Ember®, EZLink®, EZRadio®, EZRadioPRO®,
Gecko®, ISOmodem®, Precision32®, ProSLIC®, Simplicity Studio®, SiPHY®, Telegesis, the Telegesis Logo®, USBXpress® and others are trademarks or registered trademarks of Silicon
Labs. ARM, CORTEX, Cortex-M3 and THUMB are trademarks or registered trademarks of ARM Holdings. Keil is a registered trademark of ARM Limited. All other products or brand
names mentioned herein are trademarks of their respective holders.
http://www.silabs.com