Design of wireless data transmission system based on LPC1766 and Si4432

Publisher:HarmoniousPeaceLatest update time:2014-01-23 Source: 电子设计工程 Keywords:LPC1766 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
IntroductionWith
    the development of society, air conditioning systems are widely used in modern office buildings and high-rise buildings. While improving and enhancing the quality of the internal environment of buildings, air conditioning also brings huge energy consumption. In modern buildings, most of the energy consumption of buildings in summer and winter is occupied by air conditioning. Therefore, how to reduce air conditioning energy consumption through scientific methods is an urgent problem to be solved.
    Actively developing and rationally using energy-saving control technology and centralizing and unifying the management of decentralized air conditioners is an effective way to reduce air conditioning energy consumption. With the development of sensor technology, network technology, and computer technology, the detection, transmission, analysis and processing of various information data have the conditions and means to be realized, which has promoted the rapid development of the core technology of the Internet of Things and made the centralization and networking of split air conditioning control possible.
    By studying the composition and actual application mode of the Internet of Things, we explore the introduction of it into the split air conditioning centralized control system and build a split air conditioning energy-saving control system based on the Internet of Things. Due to the wide distribution of various sensing nodes, the traditional single wired transmission method has the disadvantages of unstable transmission, poor human-computer interaction, weak real-time control, insufficient network integration, and inconvenient wiring in some applications. Therefore, the information transmission network should be built into a hybrid network architecture combining wired and wireless networks based on the Internet of Things technology, which can aggregate data to a concentrator for unified management and achieve accurate and stable transmission of data such as the operating status, energy consumption, and environmental conditions of the split air-conditioning system. The system structure is shown in Figure 1.

a.JPG



1 Introduction to LPC1766 and Si4432 Chips
   
LPC1766 is a LPC1700 series microcontroller based on the Cortex-M3 core launched by NXP. It integrates 10/100M Ethernet MAC, CAN bus channel, SPI interface, I2C bus interface, ADC module, etc. It has a wealth of peripheral interfaces and is suitable for embedded occasions that require high integration and low power consumption. The hardware components mainly include Ethernet module, RS485 module, sensor module, relay module, etc. The
    RF transceiver uses the Si4432 chip from Silicon Labs. The chip has high integration, small size, low power consumption, and an ultra-high sensitivity of -118 dBm. It can provide excellent link quality and minimize power consumption while expanding the transmission range. Its operating frequency range is 240~930 MHz, the maximum output power can reach +20 dBm, and the transmission distance is long. Si4432 integrates antenna diversity, sleep wake-up timer, 64-byte transceiver FIFO and other functions. At the same time, the Si4432 chip also has functions such as frequency hopping and channel signal strength assessment. Its peripheral circuit only requires a 30 MHz crystal oscillator and several resistors, capacitors, inductors, etc. The circuit design is simple and low-cost. Therefore, it is very suitable for applications in mass production that are sensitive to size and cost.

2 Hardware Design
   
The LPC1700 series has two SSP interfaces that are compatible with SPI, SSI and Microwire buses, which can be flexibly configured according to the application. In this system, LPC1766 and Si4432 chips are connected through SSP1. LPC1766 configures Si4432 internal registers through the SSP interface and realizes data reading and writing. The PORT0 and PORT3 ports of the chip have interrupt functions. When the pin level meets the set value, an interrupt will be triggered. Here, the P0.5 pin is connected to SDN to control Si4432 to enter the non-shutdown (SHUTDOWN) state.
    The P0.4 pin is connected to nIRQ, and Si4432 can notify LPC1766 to handle interrupts through this pin. The TX pin of Si4432 is the RF signal transmitter, and the RXp pin is the differential signal receiver. Because a single antenna is used for data transmission, the RF signal transmitter and receiver must be connected to the antenna through the RF switch chip UPG2164 to switch the transmission and reception states. When GPIO0 is high and GPI01 is low, it is in the transmission state; when GPIO0 is low and GPIO1 is high, it is in the reception state. The circuit is shown in Figure 2.

b.JPG



3 Software Design
3.1 Basic Principles of Wireless
   
The state transition diagram of the Si4432 chip is shown in Figure 3. The chip has four states: disconnect, suspend, transmit and receive. When the chip switches between the receive/transmit states, it usually goes through the suspend state first. The suspend state here generally refers to the standby mode and the tuning mode. In the standby mode, the crystal oscillator remains in the start-up state, so that the crystal oscillator startup time can be eliminated when the chip switches from the suspend state to the receive/transmit mode. In the tuning mode, the PLL remains enabled. In this mode, the chip's receive/transmit conversion time response is the fastest, but the current consumption is very high.

e.JPG


3.2 SSP interface programming timing
   
When porting the Si4432 driver to different MCU platforms, the most critical thing is to ensure that the MCU can read and write the values ​​of the Si4432 internal registers. The Si4432 and MCU can communicate through a standard 3-wire SPI interface: SCLK, SDI and nSEL. The host MCU obtains data through the SDO output pin of the Si4432. The LPC1766 has two SSP bus interfaces that are compatible with the SPI bus. However, there are differences in the hardware principles between the SSP and SPI interfaces. The SSP has a hardware FIFO, while the SPI does not. The following focuses on the method of using the SSP1 interface of the LPC1766 to interact with the Si4432. [page]
3.2.1 Pin initialization configuration
   
In order to facilitate the chip selection operation of Si4432 by P0.6 pin, the replacement text content of the name symbols LVL_H and LVL_L is specified through macro definition, which are the high and low level conversion of the control pins respectively:
    #define LVL_H(GPIO0->FIOSET|=(0x01<<6))
    //Pull the P0.6 level high
    #define LVL_L(GPIO0->FIOCLR|=(0x01<<6))
    //Pull the P0.6 level low
    Configure the pin function selection register, specify the P0.5 pin as the GPIO default output low level, and connect it to the SDN pin of Si4432 to control Si4432 to enter the non-shutdown (SHUTDOWN) state. Initialize P0.7, P0.8, and P0.9 as SSP1 interface pins:
    d.JPG
    f.JPG
    Designate P0.4 pin as GPIO interrupt and connect it to nIRQ pin of Si4432. When Si4432 has corresponding interrupt condition, it can notify LPC1766 to execute interrupt handler:
    g.JPG
3.2.2 Write mode
   
function vSpiWriteRegister writes value to Si4432 internal register reg. After chip selection, first read SSP1 status register to confirm that transmit FIFO is not full. Before sending register address, the highest position of reg needs to be set to 1, and then detect whether SSP1 controller is idle. The process of sending value is similar, and its program code is as follows:
    h.JPG
3.2.3 Read mode
   
function bSpiReadRegister reads the value of Si4432 internal register reg.

k.JPG


    It should be noted here that because the SSP controller has a receive/transmit FIFO, before normal read mode communication, the "junk" data in the receive FIFO needs to be read out and discarded. Similarly, referring to the read mode timing diagram shown in Figure 4, because the SSP is full-duplex, when the SDI pin sends the register address, the SDO pin is in a low level state, then the receive FIFO will first save 0x00, and the second byte received thereafter is the value of the Si4432 specified register. The program code is as follows:
   
j.JPG
3.3 Wireless data transmission and reception
3.3.1 RF chip initialization and parameter setting
   
Si4432 has two read-only registers: Reg00 (register with internal address 00h) represents the device type code, and Reg01 represents the version code. Its value is fixed when the chip leaves the factory and cannot be changed later. Here, you can read the values ​​of Reg00 and Reg01 during initialization to determine whether Si4432 has started normally. [page]
    First initialize LPC1766 and start the SSP1 controller. Reading Reg03 and Reg04 of Si4432 will automatically clear the interrupt flag and release the nIRQ pin. Writing 0x80 to Reg07, that is, the highest position is 1, will reset all internal registers to the default state. After a delay of 10 ms, wait for Si4432 to work normally, and then count the number of startups. After the values ​​of Reg00 and Reg01 meet the conditions, fill in the communication parameters in the corresponding registers, and then immediately enter the receiving state. The process is shown in Figure 5.

l.JPG


3.3.2 Wireless Transmission Program
   
Before sending data, first set the chip to the IDLE state. Specify the length of the data packet to be sent, and then fill the corresponding number of bytes of data into the transmit FIFO. Configure the interrupt return type to "data packet transmission completion interrupt", that is, after Si4432 successfully sends the data, it notifies LPC1766 through an interrupt. Then enable transmission, and Si4432 will automatically add parameters such as synchronization words to the data frame. The process is shown in Figure 6.

m.JPG


3.3.3 Wireless receiving program
   
When Si4432 receives data, it will notify LPC1766 to process it through interrupt triggering. First, get the interrupt status and determine the type of interrupt. If it is a "data packet transmission completion interrupt", switch the RF to the receiving state; if it is a "valid data packet reception interrupt", read the length value of the data packet, and then take out the data of the specified length value from the FIFO. Reconfigure the "valid data packet reception interrupt", reset the receiving FIFO, and set the module to the receiving state. When the interrupt processing function ends, return to the program processed before the interrupt. The process is shown in Figure 7.

n.JPG



Conclusion
   
This article introduces a wireless communication system based on LPC1766 and Si4432. The specific hardware circuit connection and software system design are introduced in detail, and the timing programming method of interacting with Si4432 through the SSP controller is emphasized. After a large number of experiments, it is proved that the system has reliable communication, strong stability, and good engineering application effect.

Keywords:LPC1766 Reference address:Design of wireless data transmission system based on LPC1766 and Si4432

Previous article:Local and remote monitoring of smart homes on Linux
Next article:Design of STM32 motion control card based on PCI bus

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号