background image

Rev 0.4 11/14

Copyright © 2014 by Silicon Laboratories

AN692

 

A N 6 9 2

S i 4 3 5 5 / S i 4 4 5 5   P

R O G R A M M I N G  

G

U I D E

1.  Introduction

This document provides an overview of how to configure and control the following EZRadio

®

 chips:



Si4455 transceiver



Si4355 receiver 

The following code examples are covered in this programming guide:



How to set up a continuous wave (CW) transmission.



How to set up a pseudo random (PN9) transmission.



How to transmit in TX direct mode.



How to receive in RX direct mode (for BER measurement).



How to transmit a simple packet in Packet Handler mode.



How to receive a simple packet in Packet Handler mode.



How to implement bidirectional variable length packet based communication.

2.  Hardware Options

The source code is provided for two different hardware platforms:



RFStick



Wireless Mothe RF Pico Board

A separate Silicon Labs IDE workspace is provided for each example on the two platforms.

2.1.  The RFStick Platform

Figure 1. RFStick

The RFStick is a basic demo system for the evaluation of the EZRadio chips. The board has two main parts, the
MCU part and the radio part. The MCU part of the board contains a Silicon Labs C8051F930 MCU and basic
human interface devices (four push-buttons, four LEDs, four switches and a buzzer). The radio part contains the
EZRadio chip, the matching circuit, and the antenna. The RF output is selectable via a 0 

 resistor between a PCB

antenna and an optional (unpopulated) 50 

 SMA output connector. The MCU is connected to the EZRadio chip

via an SPI bus and some other GPIOs (see Table 1). The RF section of the board can be broken off along a
perforation between the two rows of J3 and installed in the user’s own hardware as a radio module by utilizing the
remaining row of J3.
Table 1 contains the signal connections between the EZRadio chip and the MCU:

Summary of Contents for Si4455 Series

Page 1: ...d RF Pico Board A separate Silicon Labs IDE workspace is provided for each example on the two platforms 2 1 The RFStick Platform Figure 1 RFStick The RFStick is a basic demo system for the evaluation of the EZRadio chips The board has two main parts the MCU part and the radio part The MCU part of the board contains a Silicon Labs C8051F930 MCU and basic human interface devices four push buttons fo...

Page 2: ...nction Connections across J3 Signal Name Pin Name EP 1 6 9 GND Ground 3 4 GND GND 7 8 VDD Supply Voltage input 1 2 VDD VDD 12 NIRQ Interrupt output active low 19 20 NIRQ P1 4 2 SDN Shutdown input active high 5 6 SDN P1 5 16 NSEL SPI select input 11 12 NSEL P1 3 13 SCLK SPI clock input 17 18 SCLK P1 0 15 SDI SPI data input 13 14 MOSI P1 2 14 SDO SPI data output 15 16 MISO P1 1 10 GPIO_0 General Pur...

Page 3: ...f the RF part RFVDD can be measured on J6 Since J6 is shorted by a PCB track on the bottom side of the board the user must cut the track if this feature is used Figure 2 How to Connect the RFStick to the PC Steps for connecting to a PC Select the desired power source with S6 power selector switch Connect the J1 connector of the RFStick to the Toolstick Base Adapter Connect the Toolstick Base Adapt...

Page 4: ...F Pico Boards Figure 3 Wireless Motherboard Platform Table 2 Kits that Contain the Wireless Motherboard Platform Part Number Kit Name EZR LCDK2W 434 EZRadio Two Way Link Development Kit 434 MHz EZR LCDK2W 868 EZRadio Two Way Link Development Kit 868 MHz EZR LCDK2W 915 EZRadio Two Way Link Development Kit 915 MHz 4012 LCDK1W 434 Si4012 EZRadio One Way Link Development Kit 434 MHz 4012 LCDK1W 915 Si...

Page 5: ...measured separately either for the MCU the radio or the peripherals The motherboard contains test pins for all I O pins of the MCU and for all digital pins of the radio In addition there are SMA connectors for the GPIOs of the radio for test equipment connection A USB communication interface as well as a built in Silicon Labs USB to C2 debug adapter are integrated onto the board so that the wirele...

Page 6: ...nt 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 2 2 3 RF Pico Board Figure 5 RF Pico Board The RF Pico Board is a radio module that con...

Page 7: ...s part of the WDS program This setup interface provides an easy path to quickly selecting and loading the desired configuration for the Si4355 4455 device After the desired configuration is selected the EZConfig setup automatically creates the configuration data that can be used to configure the EZRadio chip The program then gives the option to directly configure the EZRadio chip of the connected ...

Page 8: ...AN692 8 Rev 0 4 Figure 6 Device Configuration Options ...

Page 9: ...get device several connection options may need to be set Open the Connection Options window by selecting Options Connection 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 the Power target after disconnect if the target board is currently being powered by th...

Page 10: ...t in ToolStick Terminal can communicate with the target MCU simultaneously on the C2 interface and on the UART respectively To use the ToolStick Terminal in the IDE above v4 60 00 follow these steps 1 Open the Silabs IDE from the Start Programs Silicon Laboratories menu 2 Go to the Options Connection Options menu and select the desired ToolStick Base Adapter from the drop down list 3 Click on the ...

Page 11: ...into the lowest power consumption state After the SDN pin is pulled low the radio wakes up and performs a Power On Reset It takes about 1 ms until the chip is ready to receive commands on the SPI bus GPIO1 pin goes high when the radio is ready for receiving SPI commands When SDN is high and the radio is in shutdown state the GPIOs are set to drive an output low level The radio has an interrupt out...

Page 12: ...rovides access to transmit and receive FIFO counts and reset 0x19 EZCONFIG_CHECK Validates the EZConfig array was written correctly 0x20 GET_INT_STATUS Returns the interrupt status byte 0x31 START_TX Switches to TX state and starts packet transmission Si4455only 0x32 START_RX Switches to RX state 0x33 REQUEST_DEVICE_STATE Request current device state 0x34 CHANGE_STATE Update state machine entries ...

Page 13: ...IOs or the chip can generate an interrupt if it is ready to receive the next command These three options are detailed below Table 5 List of the Radio API Properties Property Group Number Name Description Default 0x01 0x00 INT_CTL_ENABLE Interrupt enable property 0x04 0x01 0x01 INT_CTL_PH_ENABLE Packet handler interrupt enable property 0x00 0x01 0x02 INT_CTL_MODEM_ENABLE Modem interrupt enable prop...

Page 14: ...herwise after Power On Reset Therefore this pin can be used for monitoring the CTS right after Power On Reset and to identify when the chip is ready to boot up 4 2 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 inter...

Page 15: ...11 Read the Response from Radio If the CTS is polled over the SPI bus first the host MCU should pull the NSEL pin low This action should be followed by sending out the 0x44 Read command ID and providing an additional eight clock pulses on the SCLK pin The radio will provide the CTS byte on its SDO pin during the additional clock pulses If the CTS byte is 0x00 then the response is not yet ready and...

Page 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 has N bytes of response but the host MCU provides less than N bytes of clock pulses during the read sequence it causes no issue for the radio The response buffer is reset if a new command is issued If the command has N ...

Page 17: ...register read Figure 13 Reading a Single Fast Response Register It is also possible to read out multiple FRRs in a single SPI transaction The NSEL pin has to be pulled low and one of the FRRs has to be addressed with the proper command ID Providing an additional 8 x N clock cycles will clock out an additional N number of FRRs After the fourth byte is read the radio will provide the value of the re...

Page 18: ...IFO Read command ID The MCU should provide as many clock pulses on the SCLK pin as necessary for the radio to clock out the requested amount of bytes from the FIFO on the SDO pin Finally the host MCU should pull up the NSEL pin Figure 16 Receive FIFO Read If more than 64 bytes are written into the Transmit FIFO then a FIFO overflow occurs If more bytes are read from the Receive FIFO than it holds ...

Page 19: ... 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 Figure 17 Operational States and Current Con...

Page 20: ...wn 15 ms 15 ms Sleep 440 μs 440 μs SPI Active 340 μs 340 μs Ready 126 μs 122 μs TX Tune 58 μs N A RX Tune N A1 74 μs TX N A1 138 μs RX 130 μs 75 μs Notes 1 This state change is not possible in the RF chip 2 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 ...

Page 21: ...AN692 Rev 0 4 21 Figure 19 Supply Current versus Time Diagram from Shutdown to Standby State Figure 20 Supply Current versus Time Diagram from Shutdown to TX State ...

Page 22: ...AN692 22 Rev 0 4 Figure 21 Supply Current versus Time Diagram from Shutdown to RX State ...

Page 23: ...AN692 Rev 0 4 23 4 4 Radio Chip Waking Up Figure 22 Radio Wake Up Process ...

Page 24: ...for this period or 2 Connect the GPIO1 pin of the radio to the host MCU and poll the status of this pin During the power on reset the GPIO1 remains in low state Once the reset is finished the radio sets GPIO1 to 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 5 ms to be completed This process can be monito...

Page 25: ...AN692 Rev 0 4 25 4 5 EZConfig and Configuration Options Figure 23 Radio RF Initialization Process ...

Page 26: ...d header file All the example codes can initialize the radio chip by the vRadio_Init function The header file contains a configuration array called EZConfig Array and the initialized API properties The radio chip cannot be used before the EZConfig array is written into it Note that using the same radio settings for generating the EZConfig Array does not provide the same array contents due to the i...

Page 27: ...ting 5 1 2 Supported Compilers The example projects come with SiLabs IDE project files configured for compiling with Keil s C51 tool chain An evaluation version of the Keil tool chain can be downloaded from the Keil website http www keil com This free version has 2 kB code limitation and starts the code at 0x0800 address The Keil free evaluation version can be unlocked to become a full version wit...

Page 28: ...e the hardware platform including the host microcontroller and also the radio chip it simply calls the hardware initial routine The radio chip initialization is started with a power on reset The radio module sends a request to the si446x radio driver to reset the chip Thereafter the driver forwards the request to the hardware abstraction layer that pulls down the SDN pin to perform the power on re...

Page 29: ...bs project files for Keil and SDCC compilers and the Makefile if the make tool is used instead doc Doxygen generated documentation based on comments inside the source files in html format out The outputs of the compilation process are sent to this folder After successful compilation this directory contains files such as the hex file the linker output and the OMF file src Directories containing the...

Page 30: ...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 process it is necessary 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...

Page 31: ... SPI peripheral in order to communicate with the radio chip The vRadio_Init function already discussed in the Radio Configuration chapter is responsible for loading the EZConfig array and setting the radio registers according to the configuration specified in radio_config h Depending on which radio configuration was compiled into the same project can set the radio to produce Carrier Wave to transm...

Page 32: ...CU is connected to its RX TX GPIOs in order to receive or transmit arbitrary data The radio interrupt sources in this mode can still be used for example the Preamble Detect or Sync Word Detect interrupt will work in this mode too The direct mode is useful when already existing proprietary communication protocol has to be implemented using Silicon Laboratories radio transceivers Figure 28 GPIO Conn...

Page 33: ...the GPIO configuration options and values refer to the API documentation Figure 30 Activate Direct RX Mode 5 2 2 2 Direct Mode TX The radio can be used in direct transmission mode In this mode the data to be sent should be fed externally to the radio chip using one of its GPIOs The GPIO used to input TX_DATA is configured by the EZConfig array which means that a new EZConfig array will be generate...

Page 34: ...er functions are scheduled to run once in every 1 ms The Demo_App_Pollhandler function is outside of the scheduled tasks to guarantee the fast response if a radio interrupt occurs These timing intervals are generated by the Timer2 peripheral overflow interrupt The Interrupt Service Routine ISR for this interrupt can be found in isr c source file The DemoApp_Pollhandler function continuously checks...

Page 35: ...AN692 Rev 0 4 35 Figure 32 Transmission Flowchart ...

Page 36: ...acket validity has been already verified by the Packet Handler as the CRC calculation is enabled on the packet payload The radio interrupt occurs only when a packet with valid CRC is received The radio won t generate interrupt on a packet with a CRC error because this interrupt source is disabled According to the StartRX condition in vRadio_StartRX function the chip remains in RX state in these ca...

Page 37: ...ese kits contain a key fob transmitter with Si4010 that is preprogrammed with the rke_demo_2 example code These keyfobs transmit packet type 2 a Si4010 Remote Keyless Entry Demo Kit with AES Encryption P N 4010 AESK1W XXX b EZRadio Remote Control Demo Kit XXXMHz P N EZR LEDK1W XXX Packet type 1 obsolete The structure of the packet The structure of the Function Control Byte OUT0 OUT3 represent the ...

Page 38: ...high LED is ON Preamble Sync Word Chip Id Status Packet Count Crc 13 byte 2 byte 4 byte 1 byte 2 byte 2 byte Number of Bytes Field Name Description 13 Preamble 0xAA 2 Sync 0x2D 0xD4 4 Chip Id Unique factory burned chip ID 1 Status Lower 5 bits are the button information 2 Packet Count Rolling counter 2 CRC 16 Generator X16 X15 X2 1 start value 0xFFFF ...

Page 39: ...AN692 Rev 0 4 39 Figure 33 Reception Flowchart ...

Page 40: ... the PAYLOAD length will vary After the transmission has been done the radio switches back to RX state and waits for acknowledge message from the other board A certain LED on the board blinks according to the pressed button When a packet is received while the radio is in RX state the PAYLOAD field will be analyzed If it contains a valid message the board sends back an acknowledge message and blink...

Page 41: ...AN692 Rev 0 4 41 Figure 34 Bidirectional Variable Packet Example Project Flowchart ...

Page 42: ...ng the button once prompts the radio to send the specified number of the same packets sequentially Figure 35 Continuous Transmission Flowchart This project is the transmitter side of the low duty cycle receiver project It can send a custom amount of packets in order to satisfy the needs of the receiver side namely to determine the minimum number of packets to be transmitted so that the receiver wo...

Page 43: ...riods such as the Transmit Time the RX Time and Sleep Time relate to one another in the worst case scenario If the transmitter starts to transmit just after the receiver entered sleep mode the transmitter needs to transmit while the receiver is in sleep mode plus the receiver wakes up and still a packet needs to be transmitted min Transmit Time T SLEEP Time T XTal on PLL settle T one packet ...

Page 44: ...AN692 44 Rev 0 4 5 2 7 Host MCU Implemented Low Duty Cycle Figure 37 Host MCU Implemented Low Duty Cycle Flowchart ...

Page 45: ...DETECT_PEND interrupt the receiver gets into LDC_State_Wait_Packet_Rx state If the whole packet is not received within LDC_CONFIG_PACKET_RX_TIMEOUT_MS time the host MCU forces the receiver to LDC_State_Wait_Preamble state If the packet is received successfully and signed by PACKET_RX_PEND interrupt the host MCU reads the RX FIFO s content and flashes the appropriate LED s After finishing the LED a...

Page 46: ...t to transmit than the TX_THRESHOLD they are put into the FIFO and the host MCU waits for the packet sent interrupts Figure 39 Occurrence of TX FIFO Almost Empty Interrupt 5 2 9 Long Packet Reception Applications requiring reception of packets longer than the RX FIFO size 64 bytes may use the long packet feature of the radio In this case RX FIFO Almost Full Interrupt should be monitored for proper...

Page 47: ...AN692 Rev 0 4 47 Figure 41 Long Packet Transmission Flowchart ...

Page 48: ...AN692 48 Rev 0 4 Figure 42 Long Packet RX Flowchart ...

Page 49: ...SCLK SDI SDO NSEL and general I O ports SDN NIRQ The radio related tasks prepares the radio for the communication and puts the radio in ready state Figure 43 Structure of the Empty Project The following drivers shall be modified compiler_defs h hardware_defs h platform_defs h application_defs h These header files contain definitions for the 8051 architecture and the SiLabs hardware platform These ...

Page 50: ...he CTS signal and automatically reads the response from the chip Due to the layered approach the radio driver can be easily ported to other architectures and platforms as it depends only on the Hardware Application Layer This means that the HAL needs only to be ported to a given architecture for the radio driver to work As introduced in the other drivers the radio driver also can be compiled with ...

Page 51: ...sed however this is a sufficient amount of features 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 Figure 45 Usage of Radio Driver Switches Table 8 Size Optimization Possibilities for Radio Driver Driver Software Switch Minimal Driver Extended Driver Full Driver R...

Page 52: ...EQ Frequency of TCXO or external crystal oscillator in Hz Return Value None Note Before using this function si4455_reset should be called Function Name void si4455_write_ezconfig_array U8 numBytes U8 pEzConfigArray Description This function can be used to configure the chip Input Parameter s numBytes Data length to be loaded pEZConfigArray Pointer to the data U8 Return Value None Function Name voi...

Page 53: ...pending flags clear MODEM_CLR_PEND Modem Status pending flags clear CHIP_CLR_PEND Chip State pending flags clear Return Value None Function Name void si4455_gpio_pin_cfg U8 GPIO0 U8 GPIO1 U8 GPIO2 U8 GPIO3 U8 NIRQ U8 SDO U8 GEN_CONFIG Description Send GPIO pin config command to the radio and reads answer to Si446xCmd union Input Parameter s GPIO0 GPIO0 configuration GPIO1 GPIO1 configuration GPIO2...

Page 54: ...nse back Si4455Cmd union Input Parameter s FIFO RX TX FIFO reset flags Return Value None Function Name void si4455_part_info void Description This function sends the PART_INFO command to the radio and receives the answer Si4455Cmd union Return value None Function Name void si4455_write_tx_fifo U8 numBytes U8 pTxData Description The function can be used to load data into TX FIFO Input Parameter s n...

Page 55: ...n Return Value None Function Name void si4455_frr_a_read U8 respByteCount Description Returns the fast response registers FRR starting with FRR_A into Si4455Cmd union Input Parameter s respByteCount Data length to be read Return Value None Function Name void si4455_frr_b_read U8 respByteCount Description Returns the fast response registers FRR starting with FRR_B into Si4455Cmd union Input Paramet...

Page 56: ...sions using the Auxiliary ADC and returns the results of those con versions into Si4455Cmd union Input Parameter s ADC_EN Defines sources to be converted ADC_CFG Selects the rate of ADC conversion and attenuation factor to be internally applied to the voltage on the GPIO pin Return Value None Function Name void si4455_get_ph_status U8 PH_CLR_PEND Description Returns the interrupt status of the Pac...

Page 57: ...55_get_chip_status U8 CHIP_CLR_PEND Description Returns the interrupt status of the Chip Interrupt Group into Si4455Cmd union Optionally clears pending flags Input Parameter s CHIP_CLR_PEND Chip State pending flags to clear Return Value None ...

Page 58: ...tallation is to provide a façade for the upper layers Functionally the User Application at the top of the hierarchy can be independent of the hardware and its logical operation can remain unchanged even if the hardware has been modified later It also can be adapted to any device without encountering difficulties All the modules in the following subsections except the human machine interface module...

Page 59: ... Note It has to be called from the initialization section Function Name void vCio_SetLed U8 biLedNum Description This function is used to switch the selected LED on Input Parameter s biLedNum Number of the LED to be switched on 1 4 Return Value None Function Name void vCio_ClearLed U8 biLedNum Description This function is used to switch the selected LED off Input Parameter s biLedNum Number of the...

Page 60: ...he specified mode Input Parameter s biPrescaler Prescaler value of timer use predefined constants bTmr_Tmr2One_c bTmr_Tmr2Both_c wwiPeriod The duration of the timing biItEnable Enables timer IT if TRUE disables it if FALSE biExtClkSel External clock select use predefined constants bTmr_TxXCLK_00_c etc Return Value None Function Name BIT gTmr_Tmr2Expired void Description This function is used to ch...

Page 61: ...SEL pin of the selected device is activated during communication Since the commands to be sent to the API are sequences of bytes the module has to be able to send and receive continuous byte streams There are some cases when either reading a single byte directly from the MISO or writing specified number of bits directly to the MOSI is necessary In order to cover these kinds of cases bitbang read w...

Page 62: ...eadDataSpi0 U8 biDataOutLength U8 paboDataOut Description This function is used to read data from SPI0 Input Parameter s biDataOutLength The length of the data Output Parameters s paboDataOut Pointer to the first element of the response Return Value None Function Name void vSpi_ReadDataSpi1 U8 biDataOutLength U8 paboDataOut Description This function is used to read data from SPI1 Input Parameter s...

Page 63: ...e Return Value None Function Name void vSpi_ClearNselSpi1 U8 biSelectDevice Description This function is used to pull down nSEL of the selected device on SPI1 Input Parameter s biSelectDevice Selected device 0 DUT 2 EEPROM 3 MCU2 Return Value None Function Name void vSpi_SetNselSpi0 U8 biSelectDevice Description This function is used to pull up nSEL of the selected device on SPI0 Input Parameter s...

Page 64: ...d Description This function is used to read one byte from SPI0 using bitbang method Return Value Read byte Function Name U8 bSpi_ReadByteBitbangSpi1 void Description This function is used to read one byte from SPI1 using bitbang method Return Value Read byte Function Name void vSpi_WriteBitsBitbangSpi0 U8 biDataIn U8 biNumOfBits Description This function is used to write specified number of bits t...

Page 65: ...on is used to force all LEDs to off immediately Return Value None Function Name void vHmi_LedHandler void Description This function is used to handle LED management Return Value None Function Name void vHmi_InitPbHandler void Description This function is used to initialize push button handler Return Value None Note It has to be called from the initialization section Re initialization of LED Handle...

Page 66: ...id vHmi_PbHandler void Description This function is used to handle push button management Return Value None Function Name void vHmi_ShowPbOnLeds void Description This function is used to show the actual state of the push buttons on the LEDs Return Value None Function Name BIT gHmi_SwStateHandler void Description This function is used to handle switch state change Return Value True if state of swit...

Page 67: ...ate of the buzzer Return Value None Function Name void vHmi_BuzzHandler void Description This function is used to handle buzzer management Return Value None Function Name U8 Comm_IF_RecvUART U8 byte Description This function is used to receive bytes from UART Output Parameter s byte Pointer to the first element of the incoming data Return Value True if there is an incoming data otherwise FALSE Fun...

Page 68: ...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 Figure 47 Usage of Software Switches Table 10 shows which module can support the driver expansion feature Table 10 Size Optimization Po...

Page 69: ...les sizes Table 11 Size Comparison of Common Software Module Common Software Module Module Code Size Byte Size Optimization Minimal Driver Extended Driver Control IO 60 Not supported Timer 60 146 58 PCA 29 Not supported SPI 127 252 49 HMI 698 1295 46 UART 49 246 80 ...

Page 70: ...lth which if it fails can be reasonably expected to result in significant personal injury or death Silicon Laboratories products are generally not intended for military applications Silicon Laboratories 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 Trade...

Reviews: