Feature similarities and differences of MRF24WB0M and MRF24WG0M
MRF24WB0M |
MRF24WG0M |
1 , 2 Mbps |
802.11b and 802.11g rates |
Ad-hoc (OPEN, WEP) |
Ad-hoc (OPEN, WEP) |
Infrastructure (OPEN, WEP, WPA/WPA2) |
Infrastructure (OPEN, WEP, WPA/WPA2, WPS) |
|
SoftAP (OPEN, WEP) |
|
Wi-Fi Direct (WPS) |
|
WPA2-Enterprise Security Modes (EAP-PEAP/MSCHAPv2 and EAP-TTLS/MSCHAPv) |
Unlike Ethernet, a Wi-Fi 802.11 application needs to initiate a connection to an access point, Wi-Fi Direct or an ad hoc network, before data communications can commence.
The WF_Config.h file has several compile-time constants that can be customized (e.g. MY_DEFAULT_SSID_NAME) as needed.
In order to initiate a connection there is a sequence of steps that should be followed.
1) A connection profile must be created (see WF_CPCreate()). The connection profile contains information directing the WiFi driver about the nature of the connection that will be established. The connection profile defines:
a. SSID (name of Access Point)
b. Security (open, WEP, WPA, WPA2, WPS-PBC, WPS-PIN, etc.)
c. Network type (infrastructure, ad hoc, softAP, Wi-Fi Direct).
The Connection Profile functions are used to create and define an connection profile. These functions all begin with WF_CP…
2) The connection algorithm must be defined, and applies to all connection profiles. For most applications the defaults will be sufficient. For example, the default connection algorithm channel list for scanning is 1, 6, and 11. However, if, in your application you know the Access Point will always be on channel 6 you could change this setting, thus making the scan process more efficient. Functions pertaining to the connection algorithm all begin with WF_CA…
3) Once a connection profile and the connection algorithm are customized for an application, the WF_CMConnect() function must be called to initiate the connection process.
4) After WF_Connect() is called the host application will be notified when the MRF24WB0M / MRF24WG0M has succeeded (or failed) in establishing a connection via the event mechanism. The WF_Config.c file has a function, WF_ProcessEvent(), that is a template for processing MRF24WB0M / MRF24WG0M events. In the WiFi demos it simply prints to the console (if the UART is enabled) that the event occurred. This file can be modified to suit the needs of an application – for example, an application could pend on a global flag that would be set in WF_ProcessEvent() when the connection succeeded. Please refer to WF_ProcessEvent for more information on WiFi event handling.
This function is called by the Wi-Fi Driver when an event occurs that the host CPU needs to be notified of. There are several Wi-Fi connection related events that the application can choose whether to be notified or not. And, there are several events the application will always be notified of.
The function WF_ProcessEvent() can be customized to support desired handling of events.
The MRF2WB0M / MRF24WG0M demos (under the Demo App, WiFi Console, WiFi EZ Config and WiFi G demo directories) contain a function, WF_Connect(), in MainDemo.c that executes the above steps and can be referred to as an example of how to initiate a WiFi connection.
Below describes the host API to the MRF24WB0M / MRF24WG0M on-chip connection manager which creates and maintains Wi-Fi connections. The API is divided into these major sections:
API Section |
Description |
Wi-Fi Compilation Options |
Describes the various Wi-Fi compilation options |
Functions to initialize the host API and MRF24WB0M / MRF24WG0M | |
Wi-Fi Network Topologies |
Describes the various Wi-Fi network topologies |
Wi-Fi Connection Profile |
Functions to create and maintain one or more connection profiles |
Wi-Fi Connection Algorithm |
Functions to fine tune the connection algorithm |
Wi-Fi Connection Manager |
Functions to start and stop an 802.11 connection |
Wi-Fi Scan |
Functions to scan for wireless networks |
Wi-Fi Security |
Functions to handle wireless 802.11 security |
Wi-Fi Tx Power Control |
Functions to control the MRF24WB0M / MRF24WG0M Tx power |
Wi-Fi Power Save |
Functions to save power consumption by the MRF24WB0M / MRF24WG0M |
Wi-Fi Driver Management Functions |
Functions to provide access to the MRF24W Wi-Fi controller |
Wi-Fi Miscellaneous |
Functions to set a custom MAC address, get device information, etc. |
Functions to handle events from the MRF24WB0M / MRF24WG0M |
The WF_Spi.c file contains functions that the Wi-Fi Driver will use to initialize, send, and receive SPI messages between the host CPU and the MRF24WB0M / MRF24WG0M. To communicate with the MRF24WB0M / MRF24WG0M, which is always an SPI slave, the host CPU SPI controller needs to be configured as follows:
- Mode = 0
- CPOL (clock polarity) = 0
- CPHA (clock phase) = 0
- Host CPU set as master
- Clock idles high
- 8-bit transfer length
- Data changes on falling edge
- Data sampled on rising edge
Below is a list of functions in WF_Spi.c that must be customized for the specific host CPU architecture:
Function |
Description |
WF_SpiInit() |
Initializes the host CPU SPI controller for usage by the Wi-Fi driver. Called by the Wi-Fi driver during initialization. |
WF_SpiTxRx() |
Transmits and/or receives SPI data from the MRF24WB0M / MRF24WG0M. |
WF_SpiEnableChipSelect() |
Set slave select line on MRF24WB0M / MRF24WG0M low (start SPI transfer). If SPI bus is shared with any other devices then this function also needs to save the current SPI context and then configure the MRF24WB0M / MRF24WG0M SPI context. |
WF_SpiDisableChipSelect() |
Set slave select line on MRF24WB0M / MRF24WG0M high (end SPI transfer). If SPI bus is shared with any other devices then this function also needs to restore the SPI context (saved during WF_SpiEnableChipSelect()). |
The WF_Eint.c file contains functions that the Wi-Fi Driver will use to enable and disable the MRF24WB0M / MRF24WG0M external interrupt as well as get interrupt status. The functions in this module need to be customized for the specific host CPU architecture.
The MRF24WB0M / MRF24WG0M asserts its EXINT (external interrupt) line (active low) when specific events occur, such as a data message being received. Note that the host CPU has a choice to either configure the EXINT line to generate an actual interrupt, or, it can be polled. Below is a list of the Wi-Fi Driver functions within WF_Eint.c that must be customized for the specific Host CPU architecture.
Function |
Description |
WF_EintInit() |
Configures the interrupt for use and leaves it in a disabled state. Will be called by the Wi-Fi driver during initialization. If polling the EXINT pin then this function won’t have any work to do except leave the interrupt in a logically disabled state. |
WF_EintEnable() |
Enables the MRF24WB0M / MRF24WG0M external interrupt. If using real interrupts then enable the interrupt. If polling the EXINT pin then this function enables polling of the pin. |
WF_EintDisable() |
Disables the MRF24WB0M / MRF24WG0M external interrupt. If using real interrupts then disable the interrupt. If polling the EXINT pin then this function disables polling of the pin. |
WF_EintIsr() |
This is the interrupt service routine invoked when the EXINT line goes low. It should perform any necessary housekeeping , such as clearing the interrupt. The interrupt must remain disabled until the Wi-Fi Driver calls WF_EintEnable(). The Wi-Fi driver function, WFEintHandler() must be called. |
WF_EintIsDisabled() |
Returns true if the external interrupt is disabled, else returns false. |
WFEintHandler() |
This function does not need to be customized – it is part of the Wi-Fi driver. However, it is added to this list because it must be called each time the MRF24WB0M / MRF24WG0M interrupt service routine (ISR) occurs. |
Name |
Description |
Functions to setup, use, and teardown connection profiles | |
Functions to alter the behavior of the connection process | |
Functions to manage the connection process | |
Functions to direct the MRF24WB0M / MRF24WG0M to initiate a site survey | |
API to control the transmit (Tx) power of the MRF24WB0M / MRF24WG0M | |
Functions to alter the power savings features of the MRF24WB0M / MRF24WG0M | |
Functions for controlling miscellaneous features of the MRF24WB0M / MRF24WG0M |
Name |
Description |
Describes the various Wi-Fi compilation options. | |
Describes the various Wi-Fi network topologies | |
Describes the Wi-Fi security modes supported by MRF24WB0M and MRF24WG0M | |
Describes how to receive and act on events from the MRF24WB0M / MRF24WG0M | |
| |
Describes some basic tips for setting up and configuring a WiFi network. | |
Lists some answers to some common Wi-Fi questions. | |
Describes the wireless packets transactions according to 802.11 connection protocols |