Access Point Wi-Fi configuration on i.MX8 Family

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Access Point Wi-Fi configuration on i.MX8 Family

Access Point Wi-Fi configuration on i.MX8 Family

Access Point Wi-Fi configuration on i.MX8 Family

 

Sometimes it is necessary to setup the Wi-Fi as Access Point (AP) mode. This guide explains how to achieve that, using the i.MX8M Plus EVK (8MP) as the AP device and the i.MX8M Mini EVK (8MM) as the connected device.

Note: Currently there is no WPA2 protection explained in this tutorial, but will be added soon.

 

Configure the Access Point:

  1. First, we have to enable the Wi-Fi driver using the following command on both 8MM and 8MP:
    # On the i.MX8M Plus:
    root@imx8mpevk: modprobe moal mod_para=nxp/wifi_mod_para.conf
     
    # On the i.MX8M Mini:
    root@imx8mm-lpddr4-evk: modprobe moal mod_para=nxp/wifi_mod_para.conf
  2. Now that both 8MM and 8MP have the Wi-Fi driver enabled, let's make sure that 8MP has hostapd command available. We will use this tool to configure and enable the AP on the 8MP:
    root@imx8mpevk: hostapd -v

     

    • Output:
      hostapd v2.9
      User space daemon for IEEE 802.11 AP management,
      IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
      Copyright (c) 2002-2019, Jouni Malinen <j@w1.fi> and contributors
  3. To configure the AP we need to modify the file called hostapd.conf. This file allows us to configure both 2.4GHz and 5.0GHz bands of Wi-Fi. Open the file with your preferred editor, in this case vim:
    root@imx8mpevk: vi /etc/hostapd.conf

    • Parameters for 2.4GHz Access Point without WPA2 protection:
      interface=mlan0
      ssid=<name_of_AP>
      country_code=US
      hw_mode=g
      channel=0
      ieee80211n=1
    • Parameters for 5.0GHz Access Point without WPA2 protection:
      interface=mlan0
      ssid=<name_of_AP>
      country_code=US
      hw_mode=a
      channel=0
      ieee80211n=1

      Note 1: If country_code=US is not enabled, some channels won't be available and transmit power will be limited.

      Note 2: You can set channel=0 which in that case the channel will be selected automatically at runtime, or be specific by providing the exact desired channel. To see available channels, use the iwlist mlan0 freq command on either 8MP or 8MM.

Start the Access Point:

  1. Before starting the AP, run the following commands:
    # Kill following processes:
    root@imx8mpevk: killall wpa_supplicant
    root@imx8mpevk: killall hostapd
     
    # Set IP address with corresponding netmask. Feel free to change below IP
    root@imx8mpevk: ifconfig mlan0 192.168.0.102 netmask 255.255.255.0 up
     
    # Set default gateway
    root@imx8mpevk: route add default gw 192.168.0.1
  2. Now, let's start the AP by running below command. Depending on the parameters that were set, either 4.2GHz or 5.0GHz band will be used. If you prefer, run below command in background using & argument.
    root@imx8mpevk: hostapd /etc/hostapd.conf
    • Output example for 2.4GHz Access Point:
      Configuration file: /etc/hostapd.conf
      rfkill: Cannot open RFKILL control device
      mlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
      ACS: Automatic channel selection started, this may take a bit
      [ 9431.410616] wlan: SCAN COMPLETED: scanned AP count=7
      mlan0: interface state COUNTRY_UPDATE->ACS
      mlan0: ACS-STARTED
      [ 9431.905764] wlan: SCAN COMPLETED: scanned AP count=3
      [ 9432.396609] wlan: SCAN COMPLETED: scanned AP count=6
      [ 9432.890450] wlan: SCAN COMPLETED: scanned AP count=4
      [ 9433.386962] wlan: SCAN COMPLETED: scanned AP count=8
      mlan0: ACS-COMPLETED freq=2412 channel=1
      [ 9433.403864] wlan: HostMlme mlan0 send deauth/disassoc
      Using interface mlan0 with hwaddr 00:e9:3a:0d:c7:81 and ssid "imx8mpevk"
      [ 9433.412187] wlan: Starting AP
      [ 9433.418490] Get ht_cap from beacon ies: 0xc
      [ 9433.425522] fw doesn't support 11ax
      [ 9433.443575] wlan: AP started
      [ 9433.449525] Set AC=3, txop=47 cwmin=3, cwmax=7 aifs=1
      [ 9433.457727] Set AC=2, txop=94 cwmin=7, cwmax=15 aifs=1
      [ 9433.465378] Set AC=0, txop=0 cwmin=15, cwmax=63 aifs=3
      [ 9433.472966] Set AC=1, txop=0 cwmin=15, cwmax=1023 aifs=7
      mlan0: interface state ACS->ENABLED
      mlan0: AP-ENABLED
    • Output example for 5.0GHz Access Point: 
      Configuration file: /etc/hostapd.conf
      rfkill: Cannot open RFKILL control device
      mlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
      ACS: Automatic channel selection started, this may take a bit
      [ 9961.582458] wlan: SCAN COMPLETED: scanned AP count=0
      mlan0: interface state COUNTRY_UPDATE->ACS
      mlan0: ACS-STARTED
      [ 9961.988556] wlan: SCAN COMPLETED: scanned AP count=0
      [ 9962.392371] wlan: SCAN COMPLETED: scanned AP count=0
      [ 9962.796598] wlan: SCAN COMPLETED: scanned AP count=0
      [ 9963.200666] wlan: SCAN COMPLETED: scanned AP count=0
      mlan0: ACS-COMPLETED freq=5180 channel=36
      [ 9963.215660] wlan: HostMlme mlan0 send deauth/disassoc
      Using interface mlan0 with hwaddr 00:e9:3a:0d:c7:81 and ssid "imx8mpevk"
      [ 9963.224039] wlan: Starting AP
      [ 9963.230636] Get ht_cap from beacon ies: 0xc
      [ 9963.238979] fw doesn't support 11ax
      [ 9963.255302] wlan: AP started
      [ 9963.259854] Set AC=3, txop=47 cwmin=3, cwmax=7 aifs=1
      [ 9963.268339] Set AC=2, txop=94 cwmin=7, cwmax=15 aifs=1
      [ 9963.276258] Set AC=0, txop=0 cwmin=15, cwmax=63 aifs=3
      [ 9963.284783] Set AC=1, txop=0 cwmin=15, cwmax=1023 aifs=7
      mlan0: interface state ACS->ENABLED
      mlan0: AP-ENABLED

Connect to the Access Point:

  1. On the 8MM (or any other device) modify the wpa_supplicant.conf file as follows:
    ctrl_interface=/var/run/wpa_supplicant
    ctrl_interface_group=0
    update_config=1
     
    network={
            ssid="<name_of_AP>"
            key_mgmt=NONE
    }
  2. Same as 8MP, let's kill all processes before starting the connection:
    # Kill following processes:
    root@imx8mm-lpddr4-evk: killall wpa_supplicant
    root@imx8mm-lpddr4-evk: killall hostapd
     
    # Start connection:
    root@imx8mm-lpddr4-evk: wpa_supplicant -B -i mlan0 -c /etc/wpa_supplicant.conf -D nl80211
  3. Wait until similar output appears on 8MP and 8MM:
    • Output on AP (8MP):
      [ 9710.435272] mlan0:
      [ 9710.435283] wlan: HostMlme Auth received from ec:XX:XX:XX:02:71
      [ 9710.443948] wlan: HostMlme mlan0 send Auth
      mlan0: STA ec:2e:98:f7:02:71 IEEE 802.11: authenticated
      [ 9710.463940] mlan0:
      [ 9710.463950] wlan: HostMlme MICRO_AP_STA_ASSOC ec:XX:XX:XX:02:71
      [ 9710.473997] wlan: UAP/GO add peer station, address =ec:XX:XX:XX:02:71
      [ 9710.481129] wlan: HostMlme mlan0 send assoc/reassoc resp
      mlan0: STA ec:2e:98:f7:02:71 IEEE 802.11: associated (aid 1)
      mlan0: AP-STA-CONNECTED ec:2e:98:f7:02:71
      mlan0: STA ec:2e:98:f7:02:71 RADIUS: starting accounting session BCCEB42CD615739A

       

    • Output on connected device (8MM):
      Successfully initialized wpa_supplicant
      rfkill: Cannot open RFKILL control device
      [ 4615.277698] wlan: mlan0 START SCAN
      [ 4619.664025] wlan: SCAN COMPLETED: scanned AP count=9
      [ 4619.691562] mlan0:
      [ 4619.691573] wlan: HostMlme Auth received from 00:XX:XX:XX:c7:81
      [ 4619.731691] wlan: HostMlme mlan0 Connected to bssid 00:XX:XX:XX:c7:81 successfully
      [ 4619.740509] IPv6: ADDRCONF(NETDEV_CHANGE): mlan0: link becomes ready
  4. Finally, let's give an IP address to the 8MM using the following command:
    root@imx8mm-lpddr4-evk: ifconfig mlan0 192.168.0.101
  5. At this point, 8MM should be connected to the 8MP through Wi-Fi. We can confirm by pinging the 8MP from 8MM:
    root@imx8mm-lpddr4-evk: ping 192.168.0.102
    
    PING 192.168.0.102 (192.168.0.102) 56(84) bytes of data.
    64 bytes from 192.168.0.102: icmp_seq=1 ttl=64 time=1.41 ms
    64 bytes from 192.168.0.102: icmp_seq=2 ttl=64 time=1.25 ms
    64 bytes from 192.168.0.102: icmp_seq=3 ttl=64 time=1.46 ms
    64 bytes from 192.168.0.102: icmp_seq=4 ttl=64 time=1.23 ms
    64 bytes from 192.168.0.102: icmp_seq=5 ttl=64 time=1.15 ms
     
    --- 192.168.0.102 ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 4006ms
    rtt min/avg/max/mdev = 1.147/1.299/1.464/0.118 ms

 

References: This user guide was based on the UM11512 document "Wireless Feature Configuration Guide for i.MX 8M Nano EVK with 88W8987-based Wireless Module".

0% helpful (0/1)
Version history
Last update:
‎04-04-2022 08:10 AM
Updated by: