wiki:802.11/wlan_exp/app_notes/tutorial_hop_mac/slow_hopping

Version 3 (modified by chunter, 9 years ago) (diff)

--

Tutorial: A Custom Hopping MAC

based on Ref. Des. v1.3

Slow Hopping Approach

Among many other enhancements, the 2003 802.11h amendment added the "Channel Switch Announcement" as an optional tagged parameter in management frames (e.g. beacons). Section 8.4.2.21 of 802.11-2012 describes the element. It contains a "New Channel Number" field that describes, as you might expect, the new channel that associated stations should tune to. Additionally, it contains a "Channel Switch Count" which tells STAs when they should tune to the new channel. A value of 0 informs them that they should tune immediately while any value N for N > 0 informs them they should tune immediately before the beacon Nth Target Beacon Transmission Time (TBTT). Since beacons are multicast and have no error recovery, a large value of N increases the reliability of client stations tuning to the new channel since they only need to overhear one of the N beacons to properly schedule the retuning event. Of course, the counterpoint to a large value of N is that the speed with which the network hops frequencies can be quite slow. For this reason, we call this technique for frequency hopping the "Slow Hopping Approach."

Changes to the 802.11 Reference Design

To implement the behavior of the Channel Switch Announcement, we only need to make changes to the AP and STA high-level designs. Since this behavior is standard in modern Wi-Fi devices, however, we will not bother altering our STA design to be compatible with the changes to the AP. Instead, we'll test our new frequency hopping AP by connecting associating a commercial Wi-Fi device. Modifying the STA to also honor the Channel Switch Announcement is a good exercise for the reader.

Access Point (AP)

Changes should be made to wlan_mac_ap.c in the project SDK workspace zip.


First, we should add a global variable to the top of the AP code to determine whether or not the AP should be hopping. We will tie this variable to a push button interrupt on the board so we can enable or disable frequency hopping at runtime. At the very top of the AP code, add the following code snippet:

// 0 - No hop
// 1 - Slow hop
u8 HOP_MODE;
#define HOP_INTERVAL_NUM_TBTT 100

The HOP_INTERVAL_NUM_TBTT definition will determine how many beacon intervals pass before the AP hops to a new frequency. Next, we need to set the HOP_MODE variable in main(). We will default to no frequency hopping. Before the main while(1){} loop, add the following line:

HOP_MODE = 0;

Finally, we will use the existing up_button() callback to toggle frequency hopping on and off whenever we press the top button in the User I/O section of the WARP v3 hardware. Replace the existing up_button() function with the following:

void up_button(){
    HOP_MODE = (HOP_MODE+1)%2;
    return;
}


Characterization

Standard 802.11
Slow Frequency Hopping 802.11