Using WiFi in Linux Print

 

This application note explains how to configure and use the WiFi/BT module on the i.MX 8M SOM to obtain network access to the Internet over WiFi. The WiFi/BT module interfaces to the i.MX 8M through a PCIe bus and provides high-end WiFi connectivity.

Step through the following procedure:

  1. Boot Linux to the shell interface and validate that the on-board WiFi chip has been detected and initialized by the Linux kernel successfully. You should see output similar to the snapshot shown below in the iwconfig print-out just after the system boot up:
  2. root@imx8m-som:~# iwconfig wlp1s0 IEEE 802.11 ESSID:off/any Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm Retry short limit:7 RTS thr:off Fragment thr:off Encryption key:off Power Management:on lo no wireless extensions. eth0 no wireless extensions.

  3. Run wpa_supplicant in order to scan the wireless network for WiFi access points available to the i.MX 8M:
  4. root@imx8m-som:~# wpa_supplicant -i wlp1s0 -c /etc/wpa_supplicant.conf -B Successfully initialized wpa_supplicant root@imx8m-som:~# wpa_cli scan Selected interface 'wlp1s0' OK root@imx8m-som:~# wpa_cli scan_results Selected interface 'wlp1s0' bssid / frequency / signal level / flags / ssid ec:43:f6:e1:4a:d8 2422 -77 [WPA2-PSK-CCMP][WPS][ESS] My_access_point

  5. To connect to your access point, use the following commands (in the example below replace My_access_point and My_password with the parameters of your access point):
  6. root@imx8m-som:~# wpa_cli add_network Selected interface 'wlp1s0' 1 root@imx8m-som:~# wpa_cli set_network 1 ssid '"My_access_point"' Selected interface 'wlp1s0' OK root@imx8m-som:~# wpa_cli set_network 1 psk '"My_password"' Selected interface 'wlp1s0' OK root@imx8m-som:~# wpa_cli enable_network 1 Selected interface 'wlp1s0' [ 231.741551] wlp1s0: authenticate with ec:43:f6:e1:4a:d8 OK [ 231.815377] wlp1s0: send auth to ec:43:f6:e1:4a:d8 (try 1/3) [ 231.822753] wlp1s0: authenticated [ 231.833499] wlp1s0: associate with ec:43:f6:e1:4a:d8 (try 1/3) [ 231.849830] wlp1s0: associate with ec:43:f6:e1:4a:d8 (try 2/3) [ 231.859419] wlp1s0: RX AssocResp from ec:43:f6:e1:4a:d8 (capab=0x411 status=0 aid=2) [ 231.870567] wlp1s0: associated root@imx8m-som:~# wpa_cli reassociate

  7. Obtain the IP, verify connection to the Internet:
  8. root@imx8m-som:~# udhcpc -i wlp1s0 udhcpc (v1.24.1) started Sending discover... Sending discover... Sending discover... Sending select for 192.168.1.48... Lease of 192.168.1.48 obtained, lease time 25200 /etc/udhcpc.d/50default: Adding DNS 8.8.8.8 /etc/udhcpc.d/50default: Adding DNS 192.168.1.1 root@imx8m-som:~# ping -c 5 google.com PING google.com (173.194.222.139) 56(84) bytes of data. 64 bytes from lo-in-f139.1e100.net (173.194.222.139): icmp_seq=1 ttl=47 time=39.1 ms 64 bytes from lo-in-f139.1e100.net (173.194.222.139): icmp_seq=2 ttl=47 time=50.6 ms 64 bytes from lo-in-f139.1e100.net (173.194.222.139): icmp_seq=3 ttl=47 time=43.4 ms 64 bytes from lo-in-f139.1e100.net (173.194.222.139): icmp_seq=4 ttl=47 time=48.7 ms 64 bytes from lo-in-f139.1e100.net (173.194.222.139): icmp_seq=5 ttl=47 time=32.4 ms --- google.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4004ms rtt min/avg/max/mdev = 32.489/42.909/50.649/6.591 ms