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 Configuration

From Texas Instruments Wiki
Jump to: navigation, search

Purpose[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 remote stationto the AP through the WLAN media. At the end, connection verification is done using ping command.

Soft AP demo.jpg

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

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:~#

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


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 Configuration 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 Configuration 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 Configuration 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 Configuration 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 Configuration 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 Configuration 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 Configuration 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 Configuration 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 Configuration 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