introduction

Wireless Sensor Network (WSN) based on IEEE 802.15.4 is a combination of sensor technology, information processing technology and wireless communication technology. It uses a large number of nodes to cover the monitoring area to form a self-organizing network system. Automatic control, environmental monitoring and other fields have been widely used. Based on the in-depth study of the MAC layer of the wireless sensor network, combined with the TI's SoC chip CC2530, the point-to-point communication between nodes is realized, which lays the foundation for the study of the upper layer protocol.

1 CC2530 chip introduction

The CC2530 is the second on-chip integrated chip supporting the ZigBee/IEEE 802.15.4 protocol introduced by TI for the 2.4 GHz ISM band. It integrates a high-performance RF transceiver, an industry-standard enhanced 8051 MCU core, 256 KB Flash ROM, and 8 KB of RAM. Its main features: 2 USART, 8-bit and 16-bit timers, watchdog timer, 8-channel input configurable 12-bit ADC, 21 GPIO, AES128 coprocessor, hardware support CSMA-CA, digital RSSI/LQI and powerful DMA function, with battery monitoring and temperature sensing function; support 5 kinds of working modes, and short conversion time, can better meet the requirements of ultra-low power system; in the receive and transmit modes, current The losses are 24 mA and 29 mA, respectively. Due to its simple hardware design, small package and low power consumption, it has been more and more widely used in wireless sensor networks.

2 CSMA-CA mechanism

The IEEE 802.15.4 protocol uses the CSMA-CA mechanism to avoid data collisions. According to the use of beacons, the network is divided into non-beacon network and beacon network. In the non-beacon mode, the nodes use the CSMA-CA mechanism to contend for the channel: the node randomly backs off for a period of time and performs CCA (Empty Channel Estimation). If the channel IDLE then transmits data, if the channel BUSY waits for a random period of time and then performs CCA.

In the beacon network, the super frame is divided into 16 time slots, so the backoff time is performed in units of time slots, and the CCA starts execution at the boundary of the back-off period. Figure 1 is the CSMA-CA algorithm flow defined by the IEEE 802.15.4 standard.

CC2530 Wireless Data Transceiver Design Based on IEEE 802.15.4

Each node needs to maintain 3 variables each time it attempts to transmit: number of backoffs NB, contention window CW, and backoff index BE. The variable NB is the number of times that the CSMA-CA algorithm performs random backoff during the current frame transmission attempt, and the NB should be initialized to 0 before each new transmission attempt. In IEEE802.15.4, the maximum value of NB is defined as 4, if the node cannot access the data transmission after being busy for four times, the data transfer is abandoned and reported to the upper layer. The variable CW is the length of the contention window. It indicates the time required to allow the channel to be continuously idle before transmission. It is only used for the time slot CSMA-CA algorithm and can leave the processor with different time slots to protect the data frame. The size of the BE value affects the ability of the node to access the channel. If the value of the BE is too small, the effect of reducing the collision cannot be achieved. If the value of the BE is too large, the delay does not play a significant role. The IEEE 802.15.4 recommended default is 3 and the maximum is 5. When BE is set to 0, only one collision detection is performed.

3 command strobe coprocessor

The CC2530's on-chip command strobe coprocessor (CSP) provides the interface between the MCU and the radio. There are two modes for immediate strobe commands and program execution that can handle MCU commands. At the same time there is also a 24-byte program memory, with the MAC timer to automatically execute the CSMA-CA algorithm, acting as a MCU coprocessor. After the CSP is reset, the instruction write pointer is reset to position 0 and the instruction write pointer is incremented by 1 during each RFST write until the end of the program memory. In addition, the CSP has four registers: CSPT, CSPX, CSPY, and CSPZ. The MCU can read and write to them and set the parameters required for CSP operation. The process of running a CSP in program execution mode is shown in Figure 2.

CC2530 Wireless Data Transceiver Design Based on IEEE 802.15.4

4 Node Communication Implementation 4.1 Communication Mechanism

CC2530 transmits and receives data through register TXFIFO and RXFIFO. When data is transmitted, data is written to the TXFIFO. The radio module automatically adds the PHY layer synchronization header and the FCS and sends data through the strobe command STXON or STXONCCA. When data reception is completed, an RXPKTDONE interrupt is generated and the RXFIFO is read in the interrupt service routine. You can.

This paper defines a simplified MAC layer frame format according to the IEEE 802.15.4 protocol, as shown in Figure 3.

CC2530 Wireless Data Transceiver Design Based on IEEE 802.15.4

The frame control domain occupies one byte. Among them, the frame type occupies 2 bits, 00 represents a synchronization frame, 01 represents a data frame, 10 represents an acknowledgment frame, 11 represents a command frame; an acknowledgment request occupies 1 bit, and 1 indicates that the receiving device judges whether it has received a data frame or a command frame. An acknowledgement frame is fed back to the sending device for a valid frame, and 0 indicates that the receiving device does not need a feedback acknowledgement frame. The frame number uniquely identifies each frame and is used to match the acknowledgment frame and data frame or command frame. The target address and source address are represented by 2 bytes. Since the maximum length of the physical service data unit (PSDU) defined in the IEEE 802.15.4 specification is 127 bytes and 8 bytes are already used, the payload-payload byte length is 1 ~ 119 bytes.

There are three modes of data transmission: non-CSMA-CA, time slot CSMA-CA, and non-slot CSMA-CA. After the data is written to TXFIFC in the above format, execute "RFST_ISTXON" to start the CSP program.

The following is the CSP program code based on the time slot CSMA-CA mode:

CC2530 Wireless Data Transceiver Design Based on IEEE 802.15.4

4.2 Experimental results

This network is a star network consisting of a central node and 10 terminal nodes. The hardware uses a sensor board made of CC2530, and the test data is provided by on-chip temperature sensors.

As shown in Figure 4, the central node collects terminal data in a polling manner and displays it to the upper computer software through the serial port. Among them, a represents the command frame sent by the central node; b is the uploaded data frame; c is the confirmation frame sent by the central node. The terminal node uses non-time slot CSMA-CA to send data.

CC2530 Wireless Data Transceiver Design Based on IEEE 802.15.4

The test result shown in Fig. 5 shows that within the communication radius of the node, when the polling time is greater than or equal to 15.36 ms, no data packet is lost in the communication between the nodes, and there is no error phenomenon. As the node distance increases, the packet loss rate of the node gradually increases. The cycle time increases with the increase of nodes, and the delay accumulation is obvious.

CC2530 Wireless Data Transceiver Design Based on IEEE 802.15.4

Conclusion

In this paper, a wireless sensor network node based on CC2530 is designed, and the realization of point-to-point communication between two nodes is described in detail. At the same time, the CSMA-CA algorithm is described in detail. Experimental results show that the nodes can communicate normally.

This paper provides the foundation for further upper layer communication protocol design and has certain reference value.

VAPEAK TINY Vape

VAPEAK TINY Vape is so convenient, portable, and small volume, you just need to take them
out of your pocket and take a puff, feel the cloud of smoke, and the fragrance of fruit surrounding you. It's so great.
We are the distributor of the ovns & vapeak vape brand, we sell ovns disposable vape,ovns vape kit, ovns juul compatible refillable pod, and so on.
We are also China's leading manufacturer and supplier of Disposable Vapes puff bars, disposable vape kit, e-cigarette
vape pens, and e-cigarette kit, and we specialize in disposable vapes, e-cigarette vape pens, e-cigarette kits, etc.

vapeak tiny vape bar,vapeak tiny vape box,vapeak tiny vape starter kit,vapeak tiny vape disposable,vapeak tiny vape mod kit

Ningbo Autrends International Trade Co.,Ltd. , https://www.mosvapor.com