How to realize communication between different wireless chip Si4432 and SX1212 wireless modules
Date:2019/6/24 13:54:05   Browse:0

Implementation of wireless communication based on Si4432 and SX1212

1.Introduction

In the process of providing technical support and RF customization for customers, we found that due to functional requirements upgrades and product upgrades, we often encounter problems that require modules with different wireless chips to communicate with each other, but the specifications between chips, The various differences between parameters and data formats make people wonder where to start.

This test selected the RF front-end module RF4432PRO (embedded with Si4432 chip) and RF1212 (embedded SX1212 chip) independently developed by Shenzhen Siwei Wireless Technology Co., Ltd., and described the detailed experimental process, hardware interface and related sample programs. I hope to provide a reference method for solving communication problems between different wireless chips.

Shenzhen Siwei Wireless Technology Co., Ltd. is a technology, service and sales company specializing in RF and sensor module application development. It has developed a variety of application modules and solutions for different RF chips. At present, the products cover different power levels such as 20mW, 100mW, 500mW, 1W, 2W, 3W, 5W; SPI, UART (including TTL/RS232/RS485 and USB) and other communication interfaces; 315/ 433/470/868/915 There are hundreds of modules in different operating frequencies, such as MHz and 2.4 GHz. Years of precipitation and accumulation have made Shenzhen Siwei Wireless Technology Co., Ltd. have strong research and development strength and rich application experience in the hardware and software of RF applications.

2. Experimental system hardware design

2.1 chip performance and characteristics

                                                                    

       Block diagram of the built-in module for the Si4432 and SX1212 chips

The Si4432 in the RF4432PRO wireless module is a high-performance RF transceiver chip developed by Silabs in the United States with a working frequency lower than 1GHz, belonging to its EzRadioPro class. It has been widely used in industry, scientific research, medical (ISM) and short-range wireless communication equipment (SRD) in China, with output power up to +20 dBm and receiving sensitivity of -121 dBm.

The SX1212 in the RF1212 wireless module is an ultra-low-power wireless chip developed by Semitech Corporation. It operates from 300MHz to 510MHz and is optimized for very low receive power. The typical receive current is 2.6mA and the operating voltage is 2.1~3.6V, maximum transmit power +12.5 dBm.

Specific parameters can be found in the chip manual for Si4432 and SX1212. The RF4432PRO and RF1212 wireless modules provide hardware support for the built-in functions of the Si4432 and SX1212 chips. Users can directly develop and control the modules according to the chip manual.


   Wireless module

            RF4430pro

                    RF1212

   Frequency Range

403MHz,433MHz,463MHz

429MHz,443MHz,440MHz

   Emission current

          85mA,@20dBm

         25mA,@10dBm    

   Receiving current

              18.5mA

                 3mA

       Static power

              <1uA

                 <1uA 

Transmit power range

          1dBm~20dBm

          -8.5dBm~12.5dBm

  Receiving sensitivity

              -121dBm

        @data=1.2kbps 

                -110dBm

@data=1.2kbps,fdev=30kHz 

2.2 System hardware design

The experimental system hardware uses the wireless module RF4432PRO and RF1212 of Shenzhen Siwei Wireless Technology Co., Ltd. and its corresponding DEMO demonstration board. The RF4432PRO and RF1212 modules contain rigorously tested industrial grade high performance chip application circuits. The modules are connected together by pins, and the hardware platform is built. Through the SPI port control of the single-chip microcomputer in the DEMO demonstration board, the two transceiver modules communicate with each other to realize wireless transmission of data.

The DEMO demo board of the wireless module (as shown in Figure 2 below) is a development board developed by Shenzhen Siwei Wireless Technology Co., Ltd. with the wireless front-end transceiver module to facilitate the debugging of the program and the test distance. The DEMO demo board external wireless module pins, setting parameters can be saved after power down. The user can modify the module's operating frequency, transmit power, and communication rate and other related parameters through the button settings. The DEMO demo board has five working modes, as shown in Table 2.

Table 3 and Table 4 are the pin definitions of the RF1212 module and the RF4432PRO module respectively. For details, see the RF4432PRO specification and the RF1212 specification in the official website of Shenzhen Siwei Wireless Technology Co., Ltd.


  

 Pictured: Shenzhen Siwei Wireless Technology Co., Ltd. DEMO demo board and wireless module hardware connection

 Pictured: DEMO demonstration board LCD interface of Shenzhen Siwei Wireless Technology Co., Ltd.


 Operating mode

                                                    Description

 

   Normal launch

   (main mode)

The data packet is transmitted periodically. After successfully transmitting a data packet, the red light is on, and the data is switched to the receiving mode. After receiving the response signal, the blue light is on, and the LCD displays the number of data packets transmitted and received.


Normal reception 

    (slave mode)

Receive the data packet, receive the correct blue light, and then transmit the correctly received data packet. After the successful transmission, the red light is on, and the LCD displays the number of received and transmitted data packets.

   Often launch

  (emission test)

The module is in the normal transmitting state, the red light is on, and the number of packets is not displayed.

Frequent reception     (receiving test)

The module is in the normal receiving state, and the corresponding pin outputs the received waveform in real time, and the number of received packets is not counted.

          Sleep

The RF module is in a sleep state and can test static power consumption in this state.

(This form: DEMO demonstration board working mode of Shenzhen Siwei Wireless Technology Co., Ltd.)


                            (Pin definition of RF1212 module)

                               (RF4432PRO module pin definition)

3.How the wireless module works

The transmission and reception of wireless signals is the process of modulating and demodulating signals. Regardless of the same or different wireless module communication, differences in modulation parameters such as transmit and receive modulation formats, modulation rates and frequencies, frequency offsets, and receive bandwidths can result in inability to communicate between modules.

3.1 SPI bus control timing

The communication between the RF4432PRO and RF1212 modules and the MCU is that the RF module transmits the wireless signal according to the control commands and data written by the MCU through the SPI bus, and transmits the received data and its related information to the MCU through the SPI bus. The SPI timing of the Si4432 and SX1212 is slightly different.

 

                                      (Si4432 chip SPI write timing)

    

                                            (SX1212 chip SPI write timing)  

3.2 Test mode

The DEMO demo board of RF4432PRO and RF1212 modules of Shenzhen Siwei Wireless Technology Co., Ltd. has two test modes: normal and normal, which are convenient for debugging programs. In test mode, the SX1212 chip operates in Continuous mode, and the Si4432 operates in Burst write and Burst read modes. The common feature of the RF4432PRO and RF1212 modules in the DEMO demo board test mode is that data is continuously transmitted and the received real-time waveforms are visible on the corresponding pins.

 

                                (Si4432 burst write mode)

        

                                     (SX1212 continuous mode)

3.3 Normal mode

The normal transceiver mode of the DEMO demo board of RF4432PRO and RF1212 modules of Shenzhen Siwei Wireless Technology Co., Ltd. runs in PH+FIFO mode of Si4432 and Packet mode of SX1212 respectively.

Both the Si4432 and SX1212 are equipped with a 64-byte FIFO and corresponding packet processing. In this mode, the chip automatically adds and detects the preamble, synchronization word, check, etc., and indicates the communication status through the interrupt, which greatly facilitates the communication process. To communicate in normal mode, you must ensure that the packet format settings of the two modules in communication are identical, otherwise the chip will not be able to generate an interrupt.

                                    

                                         (Si4432 packet format)

                                        (Si1212 packet format)

3.4 Summary

The packet format of the Si4432 and SX1212 chips is shown in Table 5. It can be found that the data packet of Si4432 has two parts, the prefix and the data length, and the rest are basically the same. To ensure that the two chips can communicate, the test packet format is set as shown in Table 6.

                        (Si4432 and SX1212 packet format comparison)

                                              (Test packet format)

4. Specific debugging process

The RF parameters used for system communication are set to: transmit and receive frequency 423.0 MHz, frequency offset 50 KHz, and RF rate: 1.2 Kbps. The format of the data sent is shown in Table 6 below.

To ensure that the si4432 and sx1212 modules are working properly and provide reference waveforms, first enable the same module to communicate in the normal mode of the DEMO demo board with this setup.

4.1 Comparing Receive and Transmit Waveforms

Packet mode Because the chip automatically processes the data, only the results are displayed, which is not conducive to the debugging of the program. Therefore, we use the DEMO demo board test mode and external pins of Shenzhen Siwei Wireless Technology Co., Ltd. to judge the quality of communication by synchronizing the most intuitive way of transmitting and receiving waveforms.

First test the RF1212 module transmission and the communication received by the RF4432PRO module.

The RF4432PRO's GPIO2 is set to the Rx Data output function output, and the RF1212 transceiver mode is set to continuous mode, so that the received and transmitted data can be output from the GPIO2 and DATA pins in real time. Use a logic analyzer to simultaneously observe the waveforms transmitted and received by the RF1212 and RF4432PRO modules and compare them accordingly. As shown in Figure 10, it can be seen that each received waveform has a corresponding received waveform, which proves that RF4432PRO receives the data transmitted by RF1212.

              

(423MHz, 1.2Kbps, 50KHz frequency offset RF1212 transmission and RF4432 receive test waveform)

Amplify the waveform and observe each received waveform, as shown in Figure 11. It is found that each RF4432PRO received waveform has different distortions from the RF1212 transmitted waveform. The judgment may be that the difference in the chip causes the demodulation signal to be incorrect under some RF parameters.

             

(423MHz 1.2Kbps 50WHz frequency offset RF1212 transmission and RF4432 received two sets of waveforms)     

First, the baud rate of the RF4432PRO and RF1212 modules is adjusted to 2.4 kbps. It is found that the RF1212 transmission is consistent with the RF4432 received waveform, and partially distorted.

                      

       (423MHz 2.4 Kbps 50KHz frequency offset RF1212 transmit and RF4432 receive waveform)         

In order to improve the accuracy of the waveform, the baud rate of the RF4432PRO and RF1212 modules is increased to 9.6 kbps, and it is found that the RF1212 transmission is consistent with the RF4432 reception waveform.

                      

(423MHz 9.6kbps 50khz frequency offset RF1212 transmission and RF4432 receive waveform)

If you can't get a consistent waveform by adjusting the baud rate of the RF4432PRO and RF1212 modules, try adjusting the RF parameters such as modulation frequency, frequency offset, and bandwidth of the RF4432PRO and RF1212 modules. If the frequency offset of the RF4432PRO and RF1212 modules is adjusted to 20 kHz, consistent transmit and receive waveforms can be obtained at 1.2 kbaud.

            

       (RF1212 transmission and RF4432 receive waveform at 1.2kbps 20khz frequency offset)

4.2 Packet mode reception

The RF4432PRO module receives the same waveform as the RF1212 module. Therefore, the RF parameters are reserved. The working mode of the DEMO demo board of Shenzhen Siwei Wireless Technology Co., Ltd. is set to the normal mode to see if the chip can be interrupted. As shown in Figure 15, the Si4432 generates a receive interrupt. Continue to send for a while and find that there is no packet loss.

         

(423MHz 9.6kbps 50khz frequency offset RF1212 continuous mode and RF4432 packet mode reception)

If the receiving interrupt is not generated, the difference can be found by comparing the receiving waveforms of the transmitting module and the receiving module that can communicate normally. As shown in Figure 16, comparing the waveform transmitted by the RF1212 and the waveform transmitted by the RF4432PRO, it is found that the RF1212 transmit waveform is interrupted for a period of time, and it is judged to be a packet sync word error.

       

 (423MHz 9.6kbps 50khz frequency offset RF1212 transmission and RF4432 transmit waveform)

4.3 Overall Flow Chart

5. Experimental results

5.1 Hardware Results

RF1212 works in the normal transmission mode of DEMO demonstration board of Shenzhen Siwei Wireless Technology Co., Ltd., and RF4432PRO works in the normal receiving mode of DEMO demonstration board. The number of packets sent and received is displayed on the screen. As shown in Figure 18, there is no packet loss after a period of transmission.

        (RF4432PRO (left) and RF1212 communication physical map)

5.2 Software Results

4432_IRQ is the RF4432PRO interrupt pin, and RF1212_IRQ0 and RF1212IRQ1 are the receive and transmit interrupt pins of RF1212, respectively. It can be seen that each transmission interrupt has a corresponding reception interrupt.

                (RF4432PRO and RF1212 communication interruption)

6. Sample program

The key to the experiment is the initial setup of the RF4432PRO and RF1212 modules, and the rest is identical to the communication procedure between the same modules. Communication between the RF4432PRO and RF1212 modules can be achieved by directly substituting the RF4432PRO and RF1212 module initialization codes for the following tests into the communication program. The complete test procedure used in this experiment can be found in the RF4432 DEMO CODE and RF1212 DEMO CODE of the official website of Shenzhen Siwei Wireless Technology Co., Ltd.

6.1 RF4432PRO initialization example

void SI4432_init(void)

  {

  ItStatus1 = spi_rw(0x03,0x00); // clr RF interrupt factor

  ItStatus2 = spi_rw(0x04,0x00);

  SpiWriteCfg(0x06|0x80, 0x00); // Set RF interrupt

  SpiWriteCfg(0x07|0x80, SI4432_PWRSTATE_READY); // enter ready mode

  SpiWriteCfg(0x09|0x80, 0x7f); // load cap = 12P

  SpiWriteCfg(0x0a|0x80, 0x05); // output clk set

  SpiWriteCfg(0x0b|0x80,0x1f);

  SpiWriteCfg(0x0c|0x80,0x1f);

  SpiWriteCfg(0x0d|0x80, 0xf4); // GPIO 2 = rx data

  SpiWriteCfg(0x70|0x80, 0x2c);

  SpiWriteCfg(0x1d|0x80, 0x40); // enable afc

  // 9.6K bps setting

  SpiWriteCfg(0x1c|0x80,0xab); // according to Silabs's excel

  SpiWriteCfg(0x20|0x80,0x39);

  SpiWriteCfg(0x21|0x80,0x20);

  SpiWriteCfg(0x22|0x80,0x68);

  SpiWriteCfg(0x23|0x80,0xdc);

  SpiWriteCfg(0x24|0x80,0x00);

  SpiWriteCfg(0x25|0x80,0x2a);

  SpiWriteCfg(0x2a|0x80,0x24);

  SpiWriteCfg(0x72|0x80,0x50);

  SpiWriteCfg(0x6e|0x80,0x4e);

  SpiWriteCfg(0x6f|0x80,0xa5);

  //9.6K bps setting end

  SpiWriteCfg(0x30|0x80, 0x88); // enable PH+ FIFO, disable crc, msb

  SpiWriteCfg(0x32|0x80,0x00);

  SpiWriteCfg(0x33|0x80,0x02); // packet length is not included

  SpiWriteCfg(0x34|0x80, 16); // preamble = 16 nibbles

  SpiWriteCfg(0x35|0x80, 0x2a); // preamble detection = 2a bit

  SpiWriteCfg(0x36|0x80,'s'); // sync word = 0x7377

  SpiWriteCfg(0x37|0x80,'w');

  SpiWriteCfg(0x3e|0x80, 10); // length of payload = 10

  SpiWriteCfg(0x43|0x80,0x00);

  SpiWriteCfg(0x44|0x80,0x00);

  SpiWriteCfg(0x45|0x80,0x00);

  SpiWriteCfg(0x46|0x80,0x00); // disable Header 3 2 1 0

  SpiWriteCfg(0x6d|0x80, 0x07); // maximum ouput power

  SpiWriteCfg(0x79|0x80, 0x0); // non hop

  SpiWriteCfg(0x7a|0x80, 0x0); // non hop

  SpiWriteCfg(0x71|0x80, 0x22); // FiFo, FSK , not need clk

  SpiWriteCfg(0x72|0x80, 0x50); // deviation: 50KHz

  SpiWriteCfg(0x73|0x80, 0x0); // no frequency offset

  SpiWriteCfg(0x74|0x80, 0x0); // no frequency offset

  SpiWriteCfg(0x75|0x80,0x52);

  SpiWriteCfg(0x76|0x80,0x4b);

  SpiWriteCfg(0x77|0x80,0x00); // frequency:423 MHz

  }

      6.2 RF1212 Initialization Example

void sx1212_init (void)

  {

  SPI_nss_cfg=1; //spi init

  SPI_nss_dat=1;

  SPI_mosi=1;

  SPI_sck=0;

  SetRFMode(RF_SLEEP);

  SpiWriteCfg(((0x00<<1)&0x3E),0x0c); // Frequency band between 400MHz and 440MHz

  SpiWriteCfg(((0x01<<1)&0x3E),0xa0); // FSK, packet mode

  SpiWriteCfg(((0x02<<1)&0x3E),0x07); // Fdev=50kHz

  SpiWriteCfg(((0x03<<1)&0x3E),0x16);

  SpiWriteCfg(((0x04<<1)&0x3E),0x1c); // bit rate=9.6kbps

  SpiWriteCfg(((0x06<<1)&0x3E),0x77); // Frequency=423.0MHz

  SpiWriteCfg(((0x07<<1)&0x3E),0x2e);

  SpiWriteCfg(((0x08<<1)&0x3E),0x00);

  SpiWriteCfg(((0x0c<<1)&0x3E),0xc5); // FIFO size = 64 bytes

  SpiWriteCfg(((0x10<<1)&0x3E),0xa3); // RX passivefilter=378kHZ

  SpiWriteCfg(((0x11<<1)&0x3E),0x38); // Central frequency of the polyphase filter=100kHz

  SpiWriteCfg(((0x12<<1)&0x3E),0x28); // SyncByte = 2 Bytes

  SpiWriteCfg(((0x16<<1)&0x3E),0x73); // SyncByte1= 0x73

  SpiWriteCfg(((0x17<<1)&0x3E),0x77); // SyncByte2= 0x77

  SpiWriteCfg(((0x1a<<1)&0x3E),0x72); // Tx Interpolation filter cut off frequency = 200kHz, TX power = 9.5 dBm

  SpiWriteCfg(((0x1b<<1)&0x3E),0x00); // disable CLK out

  SpiWriteCfg(((0x1c<<1)&0x3E),0x0b); // packet size = 11 bytes

  SpiWriteCfg(((0x1e<<1)&0x3E),0x60); // no CRC

  }

7. Summary

This paper describes the detailed implementation process, hardware interface and sample program between the RF transceiver module communication RF4432PRO and RF1212 of Shenzhen Siwei Wireless Technology Co., Ltd., which is verified by experiments. The basic way to achieve communication is to set the RF parameters and data formats for RF4432PRO and RF1212. This method can also be extended to the communication of other wireless modules and wireless chips. If you encounter different experimental phenomena from the text, you may have technical questions about the experimental process or other ideas.


prev: Wireless Network Multi-point Acquisition System---Fault Alarm Function Analysis
next: Pin definition of the LoRa module