NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

OMAP Wireless Connectivity WLAN AP demo NLCP

From Texas Instruments Wiki
Jump to: navigation, search

Access Point use-cases[edit]

This section presents guide-lines to operating the SoftAP mode; The EVM acts as an AP that is building the WiFi network with the Access Point, and then connecting via a remote laptop (that acts as a Station) to the AP through the WLAN media. At the end, connection verification is done using Ping commands.

Soft AP demo.jpg
This page demonstrates two main demo use-cases:

  1. Web Browsing.
  2. Web Browsing with a Local Web Browser.

Soft AP Configuration Flow[edit]

This section explains the SoftAP configuration work flow.
Prerequisites - one-time procedures

  • Calibration process: This is a one-time procedure, done before any WLAN operation. Calibration is performed once after the board assembly, or in any case that the 1271 connectivity daughtercard or EVM is replaced by a new one.
  • MAC address setting : This is a one-time procedure, performed before any WLAN operation is done, and after performing the calibration procedure.

For detailed instruction, use the following links: <Calibration Process> and <modifying WLAN MAC Address>.



Steps to perform connection to WiFi network




Define SoftAP Parameters in /etc/hostapd.conf File[edit]

The hostapd.conf file (located under the /etc folder) defines the Soft AP settings.
For the following demo, create a hostapd.conf file with the content below, and modify some basic fields according to the expected AP behavior such as SSID, channel etc.

Note: most common fields are:

  1. “ssid” field, modify according to the requested SSID WiFi network, generated by the AP.
  2. "channel" field, defines the channel that the AP will work on
  3. "hw_mode" field, in case it is "g" then the AP works in 802.11g band
  4. "beacon_int" field, is the Beacon interval
  5. "dtim_period" field, is the DTIM period


Access Point configuration - Band support

  1. hw_mode=g - to support bg band
  2. hw_mode=b - to support b only band
  3. ieee80211n=1 - to support 802.11n band


for more detailed information on hostapd.conf, use the following link: <hostapd.conf information>

hostapd.conf Creation for non-secured Network[edit]

Following is the /etc/hostapd.conf content to generate a non-secured Network.

interface=wlan0
driver=nl80211
channel=1
hw_mode=g
preamble=1
dtim_period=2
beacon_int=100
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
supported_rates=60 90 120 180 240 360 480 540
basic_rates=60 90 120 180 240
ssid=MAC_AP
max_num_sta=5
macaddr_acl=0
auth_algs=3
ieee80211d=0
uapsd_advertisement_enabled=1
wep_rekey_period=0
own_ip_addr=127.0.0.1
wpa_group_rekey=0
wpa_strict_rekey=0
wpa_gmk_rekey=0
wpa_ptk_rekey=0
#ap_table_max_size=255
#ap_table_expiration_time=60
eap_server=1
disassoc_low_ack=1
ap_max_inactivity=4294967295

Define the DHCP Configuration in /etc/udhcpd.conf File[edit]

The file /etc/udhcpd.conf contains configuration information specific to the udhcp server.
Following are the main parameters:

  • "start" field - The start-address of the IP lease block; default value: 192.168.0.20.
  • "end" field - The end-address of the IP lease block; default value: 192.168.0.254.
  • "interface" field - The udhcp server should listen on INTERFACE. The default is eth0, and we will modify it to wlan0.
  • "dns" fiels - The list of DNS servers; In this example, the public google DNS servers were used.
  • "subnet" field - The subnet mask
  • "router" field - The list of routers; In this example, the SoftAP WLAN IP address is used.
  • "lease" field - The lease time in seconds; In this example: 10 days.


For the following demo, create the udhcpd.conf file with the content below, store it in /etc folder, and modify some basic fields according to the expected DHCP behavior (such as “start”, “end” address etc.).

# Sample udhcpd configuration file (/etc/udhcpd.conf)
# The start and end of the IP lease block
start 		192.168.0.20	#default: 192.168.0.20
end		192.168.0.254	#default: 192.168.0.254
# The interface that udhcpd will use
interface   wlan0		#default: eth0
#Examles
opt	dns	8.8.8.8  8.8.4.4 # public google dns servers
option	subnet	255.255.255.0
opt	router	192.168.0.1
option	lease	864000		# 10 days of seconds


As an example, you may click the following link to get a sample of <udhcpd.conf file>. Unzip the file to get the udhcpd.conf file.

Run the EVM in Access Point Mode[edit]

Note: The wlan0 port IP address that is defined as "ifconfig wlan0 192.168.0.1" below, should be the same IP address as defined in the “router” field in the /etc/udhcpc.conf file
in order to run the Soft AP, run the following:

  • Run hostapd (SoftAP functionality)
  • Run udhcpd to operate the dhcp server
  • Run iptables to enable the NAT (Network Address Translation)

and the commands looks like the following:

echo 1 > /proc/sys/net/ipv4/ip_forward
ifconfig wlan0 192.168.0.1
hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid
udhcpd /etc/udhcpd.conf
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

See the expected console output below:

root@am37x-evm:~# echo 1 > /proc/sys/net/ipv4/ip_forward
root@am37x-evm:~# ifconfig wlan0 192.168.0.1
hostapd -B /etc/hostapd.conf -P /var/r[70837.517822] wl1271: firmware booted (Rev 6.1.5.50.69)
uroot@am37x-evm:~# hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid
Configuration file: /etc/hostapd.conf
u[70837.767639] wl1271: down
dhcpd /etc/udhcpd.conf
iptables -t nat -A[70838.417083] wl1271: firmware booted (Rev 6.2.1.0.54)
 PUsing interface wlan0 with hwaddr 08:00:28:99:55:32 and ssid 'MAC_AP'
root@am37x-evm:~# udhcpd /etc/udhcpd.conf
Oroot@am37x-evm:~# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
root@am37x-evm:~#

Use your Station to Connect to the AP[edit]

Now that the AP is up, the following sequence can be used to connect to the access point:

  • Perform a scan on your station laptop and make sure that the 'MAC_AP' (or whatever name you picked for the AP) is visible.
  • Connenct to the 'MAC_AP' access point.
  • use "ping 192.168.0.1" (i.e., ping the access point MAC address), to make sure the connection is working.

Exit from Access Point Mode[edit]

Follow the next commands to exit from Access Point mode and return to WLAN Station mode: First, you need to kill both the hostapd and the udhcpd. To do so, use the ps command to aquire the Process ID of hostapd and udhcpd

root@am37x-evm:/etc# ps
  PID USER       VSZ STAT COMMAND
 2702 root      4904 S    hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid
 2704 root      2936 S    udhcpd /etc/udhcpd.conf
 2714 root      3128 R    ps

once we have aquired the Process ID, we can kill it:

kill -9 2702
kill -9 2704
echo 0 > /proc/sys/net/ipv4/ip_forward
iptables -F
ifconfig wlan0 down
iwconfig wlan0 mode managed
ifconfig wlan0 up


Web Browsing[edit]


Soft AP web browsing demo.jpg
Following is a demo showing how to use the EVM in Soft AP mode, and how to use it a Router to surf the web. Follow the instructions below:

  1. Connect the EVM Ethernet port to the WAN network using an Ethernet cable.
  2. Use dhcp to aquire an ip address for the EVM ethernet port from the router:
udhcpc -i eth0
  1. Activate the EVM in Soft AP mode, the first step is to configure the hostapd configuration file. For simple configuration, use a non-secured network, as shown in the following link: <Connect to non Secured network>
  2. Set the DHCP server configuration as shown in the following link: <setting DHCP server configuration>
  3. Activate the DHCP server and the NAT functionality, as shown in the following link: <Activate the EVM as Access point>
  4. Connect the PC to the WiFi network created by the EVM.
  5. Define the PC to get the IP address using DHCP.
  6. Open the Web Browser application on the PC and start surfing the web.


Web Browsing with a Local Web Browser[edit]



Soft AP web browsing demo with local webServer.jpg

In case there is no internet connection available for Demonstrating the Web Access, as an alternative - it possible to demonstrate web browsing where the web server is located on the PC which is connected to the EVM (that works in Soft AP mode) through the Ethernet port.
For Web server we used Apache (any other web server can be suitable as well), it is an open-source HTTP server for modern operating systems including UNIX and Windows. The web server can be downloaded from: <Apache web server>. (for demo we used the Apache HTTP Server 2.2.19 Release, that was published on 2011-05-22)

For the Demo, follow the steps below:

  1. For Demo, use Apache web server (or any other available web server) that can be downloaded from: <Apache web server>
  2. install the web server on the PC that will behave as the internet cloud.
  3. Download the wiki page html source from: <wiki Page Source>
  4. Extract the zip file to a local folder on the PC.
  5. set the html web page that is seen when browsing the web server to the location where you extracted the wiki page sources.
  6. Connect the Web Server PC to the EVM using an Ethernet cable.
  7. Set the PC Ethernet port to have a static IP, for example: use 192.168.2.2


Set Ethernet port IP Addr.jpg

  1. Set the EVM Ethernet port to have a static IP address in the same subnet, for example: 192.168.2.3
Ifconfig eth0 192.168.2.2 up

Now verify the IP address of the Ethernet port, using the following command:

root@am37x-evm:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:C2:7E:96:48
          inet addr:192.168.2.3  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:3874 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2968 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5344162 (5.0 MiB)  TX bytes:377563 (368.7 KiB)
          Interrupt:80
  1. Activate the EVM in Soft AP mode, the first step is to configure the hostapd configuration file. For simple configuration, use a non-secured network, as shown in the following link <Connect to non Secured network>
  2. Set the DHCP server configuration as shown in the following link <setting DHCP server configuration>
  3. Activate the DHCP server and the NAT functionality as shown in the following link <Activate the EVM as Access point>
  4. Connect the PC to the WiFi network created by the EVM
  5. Define the PC to get the IP address using DHCP (for example the IP Address is 192.168.0.20)
  6. Add to the PC routing table the routing command in the command line
route add 192.168.0.0 mask 255.255.255.0 192.168.2.3

Were the IP address are:
192.168.2.3 – is the EVM Ethernet address
192.168.2.2 is the PC Ethernet IP address
192.168.0.1 is the EVM Wireless Lan IP address
192.168.0.20 is the PC Wireless Lan IP address

  1. Open the Web Browser application on the PC and start surfing the web


For more information...[edit]

For more information on Soft AP (hostapd) configuration, use the following link <wl12xx hostapd configuration >

HomepageIcon.jpgHOME

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article OMAP Wireless Connectivity WLAN AP demo NLCP here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article OMAP Wireless Connectivity WLAN AP demo NLCP here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article OMAP Wireless Connectivity WLAN AP demo NLCP here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article OMAP Wireless Connectivity WLAN AP demo NLCP here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article OMAP Wireless Connectivity WLAN AP demo NLCP here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article OMAP Wireless Connectivity WLAN AP demo NLCP here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article OMAP Wireless Connectivity WLAN AP demo NLCP here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article OMAP Wireless Connectivity WLAN AP demo NLCP here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article OMAP Wireless Connectivity WLAN AP demo NLCP here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity