Difference between revisions of "Wifi and Bluetooth on the DEV-IOT6U"

From wiki.emacinc.com
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 7: Line 7:
  
 
== Wifi ==
 
== Wifi ==
Most of the information regarding Wifi can be found in the [[Wifi|Wifi wiki page]]. <br>  
+
The packages required to connect using the wireless interface should be pre-installed on the DEV-IOT6U. ([[Wifi|Steps to install needed packages]])<br/>
For this kit, the setup should already be preinstalled, and you can skip to [[Wifi#Wireless_Networking| Wifi: Wireless Networking]] <br>
+
<cl>1. Changes to some configuration files will be necessary, so remount the root filesystem with read and write permissions.
If when attempting to establish a connection in step 6 with:  
+
{{cli | indent=2 |  mount -o remount,rw / | hostname=somimx6ul}}
<syntaxhighlight lang="text">/etc/init.d/wpa_supplicant start</syntaxhighlight>
+
 
the command seems to do nothing, attempt to restart the connection with:
+
* Wireless networks can be found using the scan option of <code>iw</code>.
<syntaxhighlight lang="text">/etc/init.d/wpa_supplicant restart</syntaxhighlight>
+
{{cli | indent=2 | iw dev wlan0 scan | hostname=somimx6ul}}
 +
: A detailed list of the nearby networks will be printed out to the terminal. To identify the SSIDs and respective signal strengths of the network(s) more easily, pipe the output of the <code>iw scan</code> command through <code>grep</code> to scan for the keywords "SSID" or "signal". The closer the value of the signal strength is to 0, the stronger the connection.
 +
{{clo | indent=2}}
 +
{{clio| iw dev wlan0 scan {{!}} grep SSID|hostname=somimx6ul}}
 +
:SSID: EMAC-A
 +
{{clio| iw dev wlan0 scan {{!}} grep signal|hostname=somimx6ul}}
 +
:signal: -78.00dBm
 +
{{clio||hostname=somimx6ul}}
 +
{{clos}}
 +
 
 +
<br/>
 +
The <code>/etc/wpa_supplicant.conf</code> file will need to be modified to provide the necessary connection information, the details of which depend upon the type of encryption used for the wireless network.
 +
<br/>
 +
 
 +
* For an open network, uncomment the following lines in <code>/etc/wpa_supplicant.conf</code> and fill in the correct SSID for the network to which the machine should connect.
 +
<syntaxhighlight lang=bash>
 +
###open network
 +
#network={
 +
#      ssid="SSID"
 +
#      scan_ssid=1
 +
#      key_mgmt=NONE
 +
#}
 +
</syntaxhighlight>
 +
 
 +
* Networks protected by either WEP or WPA2 encryption will need a pre-shared key (PSK), which is generated for the specific network and its password. To get the PSK, use <code>wpa_passphrase</code> with the SSID and password for the desired network as arguments.
 +
{{clo|indent=2}}
 +
{{clio | indent=2 | wpa_passphrase 'your-ESSID' 'your-passphrase' {{!}} sudo tee /etc/wpa_supplicant.conf |hostname=somimx6ul}}
 +
network={
 +
:ssid="your-ESSID"
 +
:&#35;psk="your-passphrase"
 +
:psk=b99d2c0fb66194f93ad52b71051e1095dc76e12529321334b3feb18332608eb7
 +
}
 +
{{clos}}
 +
 
 +
* The contents of the <code>/etc/wpa_supplicant.conf</code> should now look similar to the following:
 +
{{clo|indent=2}}
 +
{{clio | cat /etc/wpa_supplicant.conf | hostname=somimx6ul}}
 +
network={
 +
:ssid="your-ESSID"
 +
:&#35;psk="your-passphrase"
 +
:psk=b99d2c0fb66194f93ad52b71051e1095dc76e12529321334b3feb18332608eb7
 +
}<br />
 +
{{clio||hostname=somimx6ul}}
 +
{{clos}}
 +
<br />
 +
 
 +
* The {{icli | /etc/init.d/wpa_supplicant start | hostname=somimx6ul}} command will attempt to establish a connection with the network by starting the wpa_supplicant process. <br>Use {{icli | /etc/init.d/wpa_supplicant stop | hostname=somimx6ul}} to stop the process, <br>and {{icli | /etc/init.d/wpa_supplicant restart | hostname=somimx6ul}} to restart the process.
 +
 
 +
: As the command is running, watch the terminal output for the status of the connection. A connection has been established when output stops and the last line reads:
 +
{{clo | indent=2}}IPv6 ADDRCONF(NETDEV_CHANGE):wlan0: link becomes ready{{clos}}
 +
 
 +
:A connection has failed if output to the terminal continues and the following line is seen repeatedly:
 +
{{clo | indent=2}}IPv6: ADDRCONF(NETDEV_UP):wlan0: link is not ready{{clos}}
 +
 
 +
:'''Successful connection''' (waiting a full minute to ensure output to the terminal stopped); <br />
 +
{{clo|indent=2}}
 +
{{clio| /etc/init.d/wpa-supplicant start| hostname=somimx6ul}}
 +
Successfully initialized wpa_supplicant<br/>
 +
rfkill: Cannot open RFKILL control device<br/>
 +
{{clio| wlan0: authenticate with 1c:7e:e5:40:10:fd| hostname=somimx6ul}}
 +
wlan0: send auth to 1c:7e:e5:40:10:fd (try 1/3)<br/>
 +
wlan0: send auth to 1c:7e:e5:40:10:fd (try 2/3)<br/>
 +
wlan0: authenticated<br/>
 +
wlan0: associating with AP with corrupt beacon<br/>
 +
wlan0: associate with 1c:7e:e5:40:10:fd (try 1/3)<br/>
 +
wlan0: RX AssocResp from 1c:7e:e5:40:10:fd (capab=0x431 status=0 aid=6)<br/>
 +
wlan0: associated<br/>
 +
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
 +
{{clos}}
 +
:'''Failed connection''' (waiting more than a minute as output continues to print to the terminal). The repeated lines indicate an issue establishing the connection. <br />  
 +
{{clo|indent=2}}
 +
{{clio|/etc/init.d/wpa-supplicant start| hostname=somimx6ul}}
 +
Successfully initialized wpa_supplicant                                        
 +
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready                           
 +
{{clio| IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready|hostname=somimx6ul}}       
 +
cfg80211: Calling CRDA to update world regulatory domain<br/>
 +
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready<br/>                 
 +
cfg80211: Calling CRDA to update world regulatory domain<br/>                 
 +
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready<br/>                 
 +
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready<br/>                       
 +
cfg80211: Calling CRDA to update world regulatory domain<br/>                 
 +
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready<br/>                 
 +
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready<br/>                       
 +
{{clos}}
 +
:'''A failed connection is likely the result of an improper password.''' Use <code>wpa_passphrase</code> to make sure you have the right psk for the password.
 +
* If the wpa-supplicant successfully initializes, yet a connection is not made, use the following to ensure the interface is up:
 +
{{clop|indent=2}}{{clio | ifup wlan0 | hostname=somimx6ul}}
 +
udhcpc: started, v1.31.1
 +
udhcpc: sending discover
 +
udhcpc: sending select for 10.0.6.116
 +
udhcpc: lease of 10.0.6.116 obtained, lease time 28800
 +
{{closp}} 
 +
* The <code>ifconfig</code> command will be used to determine that the device is wirelessly connected to the network. Look to see that <code>wlan0</code> has an IP address.
 +
{{clop|indent=2}}wlan0  Link encap:Ethernet HWaddr A8:54:B2:42:89:8D
 +
:::inet addr:10.0.4.148 Bcast:10.0.255.255 Mask:255.255.0.0
 +
:::UP BROADCAST RUNNING MULTICAST MTU:1500 METRIC:1
 +
:::RX packets:3395 errors:0 dropped:6 overruns:0 frame:0
 +
:::TX packets:60 errors:0 dropped:0 overruns:0 carrier:0
 +
:::collisions:0 txqueuelen:1000
 +
:::RX bytes:346619 (338.4 KiB) TX bytes:6318 (6.1 Kib){{closp}}   
 +
 
 +
* Disconnect any physical connections from the system and ping to [http://www.emacinc.com www.emacinc.com] to verify that the system can wirelessly connect to the Internet. <br />
 +
{{clop|indent=2}}
 +
{{cliop| ping -c 3 www.emacinc.com | hostname=somimx6ul}}
 +
PING www.emacinc.com (172.16.0.10): 56 data bytes
 +
64 bytes from 172.16.0.10: seq=0 ttl=63 time=1.910 ms
 +
64 bytes from 172.16.0.10: seq=1 ttl=63 time=1.748 ms
 +
64 bytes from 172.16.0.10: seq=2 ttl=63 time=2.061 ms
 +
 
 +
--- www.emacinc.com ping statistics ---
 +
3 packets transmitted, 3 packets received, 0% packet loss
 +
round-trip min/avg/max = 1.748/1.906/2.061 ms
 +
{{cliop||hostname=somimx6ul}}{{closp}}
 +
<br clear=all>
 +
</cl>
 
== Bluetooth ==
 
== Bluetooth ==
 
On the DEV-IOT6U, bluetooth is disabled by default. Enable it by:
 
On the DEV-IOT6U, bluetooth is disabled by default. Enable it by:
Line 22: Line 136:
  
 
===Where to Next===
 
===Where to Next===
*Bluetooth on the DEV-IOT6U
+
*[[Bluetooth_LE_Demo_on_the_DEV-IOT6U|Bluetooth LE Demo on the DEV-IOT6U]]
  
  
  
 
== Further Information ==
 
== Further Information ==
 +
:{{:Templateimpl:Navti | [[Getting_Started_with_the_DEV-IOT6U | Getting Started with the DEV-IOT6U]]}}
 +
:{{:Templateimpl:Navti | [[Bluetooth_LE_Demo_on_the_DEV-IOT6U | Bluetooth LE Demo on the DEV-IOT6U]]}}

Latest revision as of 15:17, 30 September 2020

Wifi

The packages required to connect using the wireless interface should be pre-installed on the DEV-IOT6U. (Steps to install needed packages)

  1. Changes to some configuration files will be necessary, so remount the root filesystem with read and write permissions.

    root@somimx6ul:~# mount -o remount,rw /
  2. Wireless networks can be found using the scan option of iw.

    root@somimx6ul:~# iw dev wlan0 scan
    A detailed list of the nearby networks will be printed out to the terminal. To identify the SSIDs and respective signal strengths of the network(s) more easily, pipe the output of the iw scan command through grep to scan for the keywords "SSID" or "signal". The closer the value of the signal strength is to 0, the stronger the connection.
    root@somimx6ul:~# iw dev wlan0 scan | grep SSID
    SSID: EMAC-A
    root@somimx6ul:~# iw dev wlan0 scan | grep signal
    signal: -78.00dBm
    root@somimx6ul:~#


    The /etc/wpa_supplicant.conf file will need to be modified to provide the necessary connection information, the details of which depend upon the type of encryption used for the wireless network.

  3. For an open network, uncomment the following lines in /etc/wpa_supplicant.conf and fill in the correct SSID for the network to which the machine should connect.

    ###open network
    #network={
    #      ssid="SSID"
    #      scan_ssid=1
    #       key_mgmt=NONE
    #}
    
  4. Networks protected by either WEP or WPA2 encryption will need a pre-shared key (PSK), which is generated for the specific network and its password. To get the PSK, use wpa_passphrase with the SSID and password for the desired network as arguments.

    root@somimx6ul:~# wpa_passphrase 'your-ESSID' 'your-passphrase' | sudo tee /etc/wpa_supplicant.conf

    network={

    ssid="your-ESSID"
    #psk="your-passphrase"
    psk=b99d2c0fb66194f93ad52b71051e1095dc76e12529321334b3feb18332608eb7

    }

  5. The contents of the /etc/wpa_supplicant.conf should now look similar to the following:

    root@somimx6ul:~# cat /etc/wpa_supplicant.conf

    network={

    ssid="your-ESSID"
    #psk="your-passphrase"
    psk=b99d2c0fb66194f93ad52b71051e1095dc76e12529321334b3feb18332608eb7

    }

    root@somimx6ul:~#


  6. The root@som9x25:~# /etc/init.d/wpa_supplicant start command will attempt to establish a connection with the network by starting the wpa_supplicant process.
    Use root@som9x25:~# /etc/init.d/wpa_supplicant stop to stop the process,
    and root@som9x25:~# /etc/init.d/wpa_supplicant restart to restart the process.

    As the command is running, watch the terminal output for the status of the connection. A connection has been established when output stops and the last line reads:
    IPv6 ADDRCONF(NETDEV_CHANGE):wlan0: link becomes ready
    A connection has failed if output to the terminal continues and the following line is seen repeatedly:
    IPv6: ADDRCONF(NETDEV_UP):wlan0: link is not ready
    Successful connection (waiting a full minute to ensure output to the terminal stopped);
    root@somimx6ul:~# /etc/init.d/wpa-supplicant start

    Successfully initialized wpa_supplicant
    rfkill: Cannot open RFKILL control device

    root@somimx6ul:~# wlan0: authenticate with 1c:7e:e5:40:10:fd

    wlan0: send auth to 1c:7e:e5:40:10:fd (try 1/3)
    wlan0: send auth to 1c:7e:e5:40:10:fd (try 2/3)
    wlan0: authenticated
    wlan0: associating with AP with corrupt beacon
    wlan0: associate with 1c:7e:e5:40:10:fd (try 1/3)
    wlan0: RX AssocResp from 1c:7e:e5:40:10:fd (capab=0x431 status=0 aid=6)
    wlan0: associated
    IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

    Failed connection (waiting more than a minute as output continues to print to the terminal). The repeated lines indicate an issue establishing the connection.
    root@somimx6ul:~# /etc/init.d/wpa-supplicant start

    Successfully initialized wpa_supplicant IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready

    root@somimx6ul:~# IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

    cfg80211: Calling CRDA to update world regulatory domain
    IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
    cfg80211: Calling CRDA to update world regulatory domain
    IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
    IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
    cfg80211: Calling CRDA to update world regulatory domain
    IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
    IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

    A failed connection is likely the result of an improper password. Use wpa_passphrase to make sure you have the right psk for the password.
  7. If the wpa-supplicant successfully initializes, yet a connection is not made, use the following to ensure the interface is up:

    root@somimx6ul:~# ifup wlan0

    udhcpc: started, v1.31.1 udhcpc: sending discover udhcpc: sending select for 10.0.6.116 udhcpc: lease of 10.0.6.116 obtained, lease time 28800

  8. The ifconfig command will be used to determine that the device is wirelessly connected to the network. Look to see that wlan0 has an IP address.

    wlan0 Link encap:Ethernet HWaddr A8:54:B2:42:89:8D
    inet addr:10.0.4.148 Bcast:10.0.255.255 Mask:255.255.0.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 METRIC:1
    RX packets:3395 errors:0 dropped:6 overruns:0 frame:0
    TX packets:60 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:346619 (338.4 KiB) TX bytes:6318 (6.1 Kib)
  9. Disconnect any physical connections from the system and ping to www.emacinc.com to verify that the system can wirelessly connect to the Internet.

    root@somimx6ul:~# ping -c 3 www.emacinc.com

    PING www.emacinc.com (172.16.0.10): 56 data bytes 64 bytes from 172.16.0.10: seq=0 ttl=63 time=1.910 ms 64 bytes from 172.16.0.10: seq=1 ttl=63 time=1.748 ms 64 bytes from 172.16.0.10: seq=2 ttl=63 time=2.061 ms

    --- www.emacinc.com ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 1.748/1.906/2.061 ms

    root@somimx6ul:~#


Bluetooth

On the DEV-IOT6U, bluetooth is disabled by default. Enable it by:

gpioset gpiochip0 5=1
hciattach /dev/ttymxc3 -t 30 bcm43xx 115200 noflow

Use hciconfig to check that hci0 device interface is enabled, and use

hciconfig hci0 up

to open and initialize the HCI device. See hciconfig manual for more information on configuring your Bluetooth device.


From there you have multiple different approaches to using the bluetooth device. bluetoothctl, rfcomm, etc.

Where to Next


Further Information

  • Getting Started with the DEV-IOT6U
  • Bluetooth LE Demo on the DEV-IOT6U