7 | | Among many other enhancements, the [https://en.wikipedia.org/wiki/IEEE_802.11h-2003 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 {{{N}}}th [https://en.wikipedia.org/wiki/Beacon_frame 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. |
| 7 | Among many other enhancements, the [https://en.wikipedia.org/wiki/IEEE_802.11h-2003 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 {{{N}}}th [https://en.wikipedia.org/wiki/Beacon_frame 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." |
| 10 | |
| 11 | 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. |
| 12 | |
| 13 | === Access Point (AP) === |
| 14 | Changes should be made to {{{wlan_mac_ap.c}}} in the project SDK workspace zip. |
| 15 | |
| 16 | ---- |
| 17 | |
| 18 | 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: |
| 19 | |
| 20 | {{{ |
| 21 | #!c |
| 22 | |
| 23 | // 0 - No hop |
| 24 | // 1 - Slow hop |
| 25 | u8 HOP_MODE; |
| 26 | #define HOP_INTERVAL_NUM_TBTT 100 |
| 27 | |
| 28 | }}} |
| 29 | |
| 30 | 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: |
| 31 | |
| 32 | {{{ |
| 33 | #!c |
| 34 | |
| 35 | HOP_MODE = 0; |
| 36 | |
| 37 | }}} |
| 38 | |
| 39 | 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: |
| 40 | |
| 41 | {{{ |
| 42 | #!c |
| 43 | |
| 44 | void up_button(){ |
| 45 | HOP_MODE = (HOP_MODE+1)%2; |
| 46 | return; |
| 47 | } |
| 48 | |
| 49 | }}} |
| 50 | |
| 51 | ---- |
| 52 | |
| 53 | |