USB 2.0 WiFi Adapter Support

Frozen Content

Altium Designer provides USB 2.0 WiFi adapter support added through the Software Platform, based on a modified OpenBSD driver framework. Current driver support includes the OpenBSD Ralink chipset drivers run and rum. Utilizing this new WiFi support, and with a USB WiFi Adapter plugged into one of its USB Hub ports, a 3000-series NanoBoard will act as a wireless station (same as a Windows PC) running in infrastructure mode.

USB-Host Wireless Network Driver Context

This driver is available when growing the stack for the ISP1760 USB Host Controller. It sits above the Host USB Context, and below the Ethernet Networking Context and TCP/IP Networking Context, as shown in the following image.

Example of the full stack required to implement USB WiFi communications, incorporating the USB-Host Wireless Network Driver Context.

The associated options – or WiFi configuration data – for the USB-Host Wireless Network Driver Context relate to the Access Point Router that you want to connect to:

  • Interface MAC – the MAC Address of the USB WiFi Adapter device. Currently, this should be left as Auto to use the manufacturer-assigned address. In a future release, you will be able to use any MAC if the device supports custom MAC addresses.
  • Network SSID – method used by the interface to connect to a wireless local area network (WLAN). If you wish to specify an access point SSID then set this to Custom, and specify the network in the SSID field. If Auto is chosen, the interface will attempt to connect (or attach) to the first access point that is compatible with the current configuration.
  • SSID – if the Network SSID field is set to Custom, enter here the name of the wireless local area network (WLAN) with which the interface is to connect to.
  • Security – access point authentication/encryption method. The following methods are currently supported:
     
    • OPEN – Open network
    • WEP – Wired Equivalent Privacy (available only when a specific network SSID is defined)
    • WPA_PSK – Wi-Fi Protected Access Shared Key (available only when a specific network SSID is defined)
       
  • Passphrase – access point passphrase key, from which a number of network keys are generated. The same passphrase must be used on the access point you intend to connect to. Additionally, the default key must match that as selected on the target access point.
  • Default Key – default transmission key when using the WEP security method. Valid values in the range 1-4.
  • Autostart Device – enable this option to automatically attempt to bring up the link as soon as a USB WiFi adapter device is detected on the USB Bus.

Loading a WiFi Configuration from an Attached USB Mass Storage Device

A USB WiFi adapter is, by its very nature, also a mass storage device (MSD). The system supports the ability to load WiFi Configuration information directly from the device, dynamically overriding corresponding configuration data defined for the USB-Host Wireless Network Driver Context in the Software Platform.

To use this feature, simply ensure that the required configuration data is saved as a simple text-based file in the root directory of your USB Adapter device, with the file name and extension alt_wifi.ini. The following example demonstrates the required format of the file:

[WIFI_CONFIG]
;The SSID of the target network
SSID=MY_NETWORK_SSID
;Starting channel
Channel=0
;Pass Phrase used to generate a network key
PassPhrase=MY_PASS_PHRASE
;Crypt=[OPEN, WEP, WPA]
Crypt=OPEN

[WEP_CONFIG]
; Uncomment to specify precalculated WEP keys
;Key0=
;Key1=
;Key2=
;Key3=

[WPA_CONFIG]
; Uncomment to specify a precalculated WPA key
;Key=0x1234567890123456789012345678901234567890123456789012345678901234

As the configuration data is read from a removable storage device, you are free to quickly change the WiFi settings without having to rebuild your design.

USB WiFi Support Service

USB WiFi Support Service and related options.

Current driver support includes the following OpenBSD Ralink Technology chipset drivers:

  • BSD run Driver – RT2700U/RT2800U/RT3000U chipset driver
  • BSD rum Driver – RT2501USB/RT2601USB chipset driver

These two drivers are permanently enabled as they are an integral requirement to providing USB WiFi support.

These drivers are basically unmodified. As such, their respective OpenBSD "man" pages are relevant:

NOTE: In addition to the CAVEATS mentioned in the above documents, only BSS Mode (infrastructure mode) is currently supported.

BSD Support Service

BSD Support Service and related options.

The following options are available as part of this service:

  • BSD System Support – enable this option to enable the BSD system compatibility layer.
  • USB Driver Support – enable this option to enable the BSD USB compatibility layer.

These two options are permanently enabled as they are an integral requirement to providing USB WiFi support.

Modified TCP/IP Networking Service

TCP/IP Networking Service and related options.

The following options are available as part of this service:

  • DHCP – Dynamic Host Configuration Protocol. Enabling this option will use DHCP to dynamically configure the IP Address, Network Mask and Default Gateway Address. DNS Server addresses (Primary and Secondary) will also be dynamically configured, when the DNS option is also enabled. If disabled, you will need to manually enter this information in the options associated with the TCP/IP Networking Context, in the upper region of the Software Platform document.
  • DNS – Domain Name System. With this option enabled, the function dns_gethostbyname can be used to resolve host names into IP addresses.
  • Custom Options Header – with this option enabled, the plugin will use the lwipopts_user.h file from the project directory for configuration. If disabled, a default configuration will be used that is suitable for basic TCP/IP usage.
  • Default Interface – the name of the default network interface.
  • Statistics – with this option enabled, the plugin will collect statistical data on your running TCP/IP networking stack. You can view and refresh the data during a debugging session by means of the TCP/IP panel, accessible from the Embedded panels menu.

Example Reference Design

An example design, demonstrating a http webserver available over a wireless link using a mass storage device as a content source, is included as part of your Altium Designer installation:

  • NB3000_USB_WiFi_MSD_Webserver.PrjFpg – located in the \Examples\Soft Designs\Showcases\NB3000 USB WiFi MSD Webserver folder.

After building and downloading the example the output on the terminal instrument should look something like this:

Kernel LWIP HTTP server test
Init USB subsystem
Init plugged USB devices
Found wireless network device
run0: MAC/BBP RT3070 (rev 0x0201), RF RT3020 (MIMO 1T1R), address 00:12:34:56:78:90
------------------------------------
Loading WiFi configuration from MSD
Setting SSID: MY_SSID
Setting passphrase: MY_PASS_PHRASE
Setting channel: 10
Set IFCONFIG_IEEE80211_CRYPT_WPAPSK
Set Key: 0x1234567890123456789012345678901234567890123456789012345678901234
------------------------------------
Starting interface....
Interface Started!
Starting TCP/IP example server...
Server Started.
addr = 192.168.1.5
threads running

The addr in this case is the listening address. Pointing a web browser at this address without a mass storage device plugged in to the NanoBoard will return the following error:

HTTP 404 - File not found

This is actually a good thing as it means a link is established. Also you should be able to "ping" the specified address if ICMP packets are allowed on your network.

To deliver a website over the wireless link we need to copy a suitable (i.e. static) website, or any files really, to the USB mass storage device and plug it in to the NanoBoard. Content on the mass storage device is accessed using standard http requests from a browser. For example:

http://192.168.1.5/usb0/index.html

for an attached mass storage device with a folder called usb0 containing a html file named index.html. The output displayed on the terminal device in this case would show:

HTTP[Found]: /usb0/index.html
FileSize: 485

Another example could be:

http://192.168.1.5/usb0/img/test.jpg

for an attached mass storage device with a folder called usb0 containing a sub-folder img, which in turn contains a JPEG image file named test.jpg. The output displayed on the terminal device in this case would show:

HTTP[Found]: /usb0/img/test.jpg
FileSize: 211552

Further Reading

For a good overview of wireless networking, refer to the following linked documents:

You are reporting an issue with the following selected text and/or image within the active document: