A Reconfigurable MAC Protocol Design Based on ARM and FPGA

Publisher:760802csyLatest update time:2012-07-03 Source: 电子技术 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
0 Introduction
The advantages of the MAC protocol based on CSMA/CA are its simplicity and robustness. It is suitable for distributed networks. Each node does not need to maintain and dynamically update the status information of the surrounding adjacent nodes. It can independently decide when to access the channel. As long as the upper layer has data to be transmitted, the MAC layer will compete for the channel. Therefore, the application of this protocol is also quite extensive. The development of embedded technology also provides good technical support for the implementation of MAC protocols. This paper builds an embedded development platform based on ARM and FPGA, and designs and implements a MAC protocol based on CSMA/CA on this basis. Since ARM and FPGA are reconfigurable devices, and some protocol parameters in FPGA are set by ARM, the protocol function in FPGA can be adjusted by modifying the ARM code. It is convenient and fast, and there is no need to regenerate the bit file download, which is conducive to the reconfigurable implementation of the MAC protocol.

1 Protocol Function Description
1.1 Message Structure
This design implements the basic access mode of the MAC protocol based on CSMA/CA. The communication between nodes only has data frames (DATA) and acknowledgment frames (ACK). Figure 1 shows the message structure, in which ACK has no net data part. Since wireless communication within a one-hop range is considered, there are no relay nodes, etc., so there are only source node numbers and destination node numbers.

a.JPG


1.2 Network Design
The MAC protocol designed in this paper not only meets the basic mechanism of combining physical carrier sensing and virtual carrier sensing to detect channel busyness and idleness, but also includes inter-frame spacing, random backoff, response confirmation and retransmission mechanisms.
Nodes with data to send will first monitor the medium. If it is busy, they will continue to wait. If the idle time exceeds or equals DIFS or EIFS, they will enter the backoff process. During the backoff process, the node will randomly generate a backoff time to set the backoff timer and continue to monitor the medium. If the idle time reaches a time slot, the backoff timer will subtract a time slot. If the medium becomes busy during this period, the backoff process will be suspended until the idle time of the medium reaches DIFS or EIFS again. When the backoff timer becomes 0, the node is allowed to start sending data, and the timeout retransmission mechanism will also be started. If the desired ACK is not received within the specified time, the data frame will be retransmitted. When the number of node retransmissions exceeds the retransmission threshold, the data frame will be discarded, or the data frame will be discarded if the longest allowed transmission time of the data frame is exceeded; when the node receives ACK, it will start preparing for the next data transmission.
The receiving node will immediately reply to the source node ACK when it receives the correct data frame sent to this node. If the node does not receive the correct data frame, EIFS will be used; if the correct data frame is received, but not for this node, the node will parse the duration, update NAV, and regard the channel as occupied.
1.3 Functional Division
This design makes full use of the flexible and convenient advantages of ARM to implement the random backoff algorithm and protocol parameter management, such as the number of retransmissions, the setting of the inter-frame interval, etc. The random backoff algorithm uses a value randomly selected from 2i time slots as the value that the node needs to back off for the i-th backoff. The setting of protocol parameters is completed by ARM, mainly considering that FPGA is not conducive to parameter modification, which can also enhance the reconfigurability of the protocol. FPGA, with its excellent real-time signal processing advantages, is used to manage the sending and receiving control of MAC frames.

2 Protocol Design
The working state of the MAC layer is mainly determined by physical carrier sensing and virtual carrier sensing (i.e.: MAC_flag=CS_flag or NAV_flag). When both are displayed as idle, the MAC layer will enter the state of sending data frames. At the same time, the protocol also requires clock counting to participate. IFS_time is the time each node needs to wait before entering the backoff process to realize the function of inter-frame interval; Backoff_time is the time each node backs off in the backoff process; NAV_time is the time when the node that is not communicating reserves the channel. These three times are also related to the state of the entire protocol. Figure 2 shows a specific implementation flow chart, and the specific implementation process steps are as follows:

b.JPG

[page]

(1) If MAC_flag is false, it indicates that the channel is idle, and then enter (2); if MAC_flag is true, it means that the channel is now occupied. At this time, no matter what state the node is in, it will enter step 7, except for the node that is sending data. Since the node that is sending data cannot monitor the channel and cannot receive data from other nodes, the carrier sensing mechanism is invalid in this state, so the node that is sending data will not suddenly change from the sending state to the receiving state.
(2) Execute the inter-frame spacing process, decrement the IFS_time size until it is 0, and then enter (3). The initial value of IFS_time is DIFS.
(3) Backoff process. The size of the backoff time is mainly provided by ARM. When the node has experienced a time slot, the backoff time slot number is reduced by 1, but when the node has not completely experienced a time slot, the backoff time slot number will not change. After the backoff process ends, it will enter (4).
(4) Determine the sending type. The initial value of the sending type Tx_tpye in the design is 1. If Tx_tpye is 0, the node sends ACK, assembles the reply to the sending node ACK according to the source/destination node number and sequence number in the received data frame, and initializes IFS_time and Backoff_time for the node to send data frames. At the same time, NAV_flag is set to true, the value of NAV_time is updated, and virtual carrier sensing is continued to avoid the situation where the node sending ACK will occupy the channel first; if Tx_tpye is not 0, it means that the node can start sending data frames and go to (5).
(5) Before sending a data frame, first determine whether it exceeds the maximum allowed sending time. If it exceeds, the data frame is discarded, IFS_time is set to EIFS, Backof_time is initialized, and the timeout timer stops; if it does not exceed the maximum allowed sending time, the node formally sends the data frame and starts the single timeout. After sending, it waits for ACK and then goes to (6).
(6) While waiting for the ACK to arrive, determine whether the single transmission time has exceeded. If exceeded, the number of retransmissions will increase. Then determine whether the retransmission threshold has been exceeded. If exceeded, the data frame will be discarded. If not exceeded, IFS_time will be set to EIFS, and the ARM random backoff algorithm will be required to re-assign a backoff time slot number according to the number of retransmissions, and modify the retransmission bit in the data frame for the receiving node to identify.
(7) Save the Backoff_time in the current backoff process and the size of the inter-frame interval IFS_time that has just ended, receive the MAC frame and parse the relevant data in it to prepare for the subsequent assembly of ACK, and then enter (8), and set NAV_flag to true to ensure that the MAC layer can process the data.
(8) Check whether the received MAC frame is correct. If not, set IFS_time to EIFS, NAV_flag to false, and NAV_time to 0, so that the node enters the inter-frame interval process. If the check is correct, enter (9).
(9) Compare the destination node number parsed by FPGA with the current node to determine whether it is sent to this node. If it is not sent to this node, then compare whether the current NAV_time value of this node is greater than the NAV in the received MAC frame. If it is greater, this node continues to execute according to the existing NAV_time value; if it is less than the NAV in the received MAC frame, use the NAV in the MAC frame to update the NAV_time value of this node, and then decrement the latest NAV_time value until it reaches 0, and the virtual carrier sense displays idle. However, during the execution of NAV_time decrement, new MAC frames may be received at any time, and they are not sent to this node. This step must be executed as usual, and it is not necessary to wait until NAV_time becomes 0 before updating. If it is sent to this node, it will enter (10).
(10) If the node receives a data frame. That is, Rx_type is 1, FPGA uploads the received data frame to ARM; at the same time, IFS_time is updated to SIFS, and Backoff_time is set to 0, so that the time interval between receiving the data frame and sending ACK is SIFS, and Tx_tpye is set to 0, NAV_flag becomes false, and enter (2) to prepare to send ACK. If Rx_type is 0, the node receives ACK, indicating that a data transmission and reception process has ended. The node will initialize relevant parameters, stop timing, etc., and the FPGA will release space, indicating that the data frame has been sent successfully.

3 Simulation Verification
The key to the implementation of the MAC protocol based on CSMA/CA lies in the processing of various situations by each node. Therefore, the simulation verification of a node protocol function can also illustrate the correctness of the design. The design of the FPGA part is the focus of this design, so ModelSim is used to simulate and observe the processing process of the node FPGA.
3.1 Channel Competition Process
In the MAC protocol based on CSMA/CA, each node does not know the status of the nodes around it, so the node may detect that the channel is occupied at any time when competing for the channel. Figure 3 shows that when the node detects that the physical carrier sense becomes busy during the backoff process, it immediately stops the backoff process and suspends the backoff time slot number at this time, that is, the backoff time slot number is retained as 31. When the channel is idle again for more than the inter-frame interval DIFS, the backoff process will continue with the reserved backoff time slot number, and the data frame will be sent after it becomes 0. In the figure, you can also see the process of updating NAV after the node receives the correct ACK. The execution flow of the simulation diagram shows that the designed MAC protocol meets the functional requirements of carrier sensing mechanism, inter-frame spacing, and random backoff.

c.JPG


3.2 Data transmission process
From Figure 4, it can be observed that after the node sends the first data frame, the timeout counter starts timing, but if no ACK is received within the specified time, the data frame is retransmitted, and the retransmission backoff time is reassigned, and the inter-frame interval is no longer DIFS, but EIFS; when the node receives the correct ACK, it starts to send a new data frame. It shows that the designed MAC protocol can realize the confirmation retransmission mechanism.

4 Conclusion
On the hardware structure mainly based on ARM and FPGA, a MAC protocol based on CSMA/CA is designed and implemented. The protocol has functions such as carrier sensing mechanism, random backoff, confirmation retransmission, etc. After simulation testing, the feasibility of the designed MAC protocol is verified.

Reference address:A Reconfigurable MAC Protocol Design Based on ARM and FPGA

Previous article:Application of ATmega8 chip in brushless DC motor speed control system
Next article:Subdivision control principle and application of instrument stepper motor based on ATMEGA48 single chip microcomputer

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号