DIVELK-AN-003: Using WiFi-Bluetooth combo plugin with SBCD

From DAVE Developer's Wiki
Jump to: navigation, search
Info Box
SBC-DIVA-02.png Applies to SBC DIVA
Diva-am335x-overview.png Applies to Diva
Warning-icon.png This application note was validated against specific versions of the kit only. It may not work with other versions. Supported versions are listed in the History section. Warning-icon.png

History[edit | edit source]

Version Date Divelk version Notes
4.0.0 April 2018

March 2019
DIVELK 4.0.0

DIVELK 4.0.1

Introduction[edit | edit source]

SBC Diva can be populated with DWM WiFi/Bluetooth combo plugin to easily add wireless connectivity. In order to enable the bluetooth, the correct device tree configuration must be passed to the kernel. The sbcd comes with two possible devicetree configurations. The default one enables the UART1 and therefore the bluetooth and wifi module while the other enables the CAN interface and disables the UART1.

DWM module for SBCD

Note: In order to enable the DWM module, the correct device tree file must be loaded.

Wifi[edit | edit source]

To enable the wifi, the gpio114 pin must be configured. Once this has been done, the wlan0 interface should become accessible.

The gpio pin can be enabled as follow:

echo 114 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio114/direction
echo 1 > /sys/class/gpio/gpio114/value

E.g

root@diva:~# echo 114 > /sys/class/gpio/export
root@diva:~# echo out > /sys/class/gpio/gpio114/direction
root@diva:~# echo 1 > /sys/class/gpio/gpio114/value
root@diva:~# [  109.511538] omap_hsmmc 481d8000.mmc: card claims to support voltages below defined range
[  109.538676] mmc1: new SDIO card at address 0001
[  109.565955] PM: Cannot get wkup_m3_ipc handle
[  109.929840] wlcore: loaded
[  110.616596] wlcore: firmware booted (Rev 6.3.10.0.133)
[  110.647936] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready

Scan and connection test:

root@diva:~# ifconfig wlan0 192.168.11.10
root@diva:~# iw wlan0 scan
BSS ca:d7:19:92:f9:16(on wlan0)
        TSF: 12272295971 usec (0d, 03:24:32)
        freq: 2412
        beacon interval: 100 TUs
        capability: ESS Privacy ShortSlotTime (0x0411)
        signal: -89.00 dBm
        last seen: 3360 ms ago
        SSID: guest2
        Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0 
        DS Parameter set: channel 1
        ERP: <no flags>
        ERP D4.0: <no flags>
        RSN:     * Version: 1
                 * Group cipher: TKIP
                 * Pairwise ciphers: TKIP
                 * Authentication suites: PSK
                 * Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)
        Extended supported rates: 6.0 9.0 12.0 48.0 
        WMM:     * Parameter version 1
                 * u-APSD
                 * BE: CW 15-1023, AIFSN 3
                 * BK: CW 15-1023, AIFSN 7
                 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
                 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS ca:d7:19:92:f9:17(on wlan0)
        TSF: 12272293743 usec (0d, 03:24:32)
        freq: 2412
        beacon interval: 100 TUs
        capability: ESS Privacy ShortSlotTime (0x0411)
        signal: -89.00 dBm
        last seen: 3360 ms ago
        SSID: guest3
        Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0 
        DS Parameter set: channel 1
        ERP: <no flags>
        ERP D4.0: <no flags>
        RSN:     * Version: 1
                 * Group cipher: TKIP
                 * Pairwise ciphers: TKIP
                 * Authentication suites: PSK
                 * Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)
        Extended supported rates: 6.0 9.0 12.0 48.0 
        WMM:     * Parameter version 1
                 * u-APSD
                 * BE: CW 15-1023, AIFSN 3
                 * BK: CW 15-1023, AIFSN 7
                 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
                 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS c8:d7:19:92:f9:15(on wlan0)
        TSF: 12272295195 usec (0d, 03:24:32)
        freq: 2412
        beacon interval: 100 TUs
        capability: ESS Privacy ShortSlotTime (0x0411)
        signal: -88.00 dBm
        last seen: 3360 ms ago
        SSID: guest4
        Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0 
        DS Parameter set: channel 1
        ERP: <no flags>
        ERP D4.0: <no flags>
        RSN:     * Version: 1
                 * Group cipher: TKIP
                 * Pairwise ciphers: TKIP
                 * Authentication suites: PSK
                 * Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)
        Extended supported rates: 6.0 9.0 12.0 48.0 
        WMM:     * Parameter version 1
                 * u-APSD
                 * BE: CW 15-1023, AIFSN 3
                 * BK: CW 15-1023, AIFSN 7
                 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
                 * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
......
root@diva:~# iw wlan0 connect guest5
root@diva:~# [  669.489889] wlan0: authenticate with fc:f5:28:cc:03:90
[  669.507747] wlan0: send auth to fc:f5:28:cc:03:90 (try 1/3)
[  669.523177] wlan0: authenticated
[  669.528427] wlan0: associate with fc:f5:28:cc:03:90 (try 1/3)
[  669.545913] wlan0: RX AssocResp from fc:f5:28:cc:03:90 (capab=0x421 status=0 aid=1)
[  669.571713] wlcore: Association completed.
[  669.582367] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[  669.588971] wlan0: associated

root@diva:~# ping 192.168.11.243
PING 192.168.11.243 (192.168.11.243): 56 data bytes
64 bytes from 192.168.11.243: seq=0 ttl=64 time=13.544 ms
64 bytes from 192.168.11.243: seq=1 ttl=64 time=2.456 ms
64 bytes from 192.168.11.243: seq=2 ttl=64 time=2.329 ms
^C
--- 192.168.11.243 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 2.329/6.109/13.544 ms

Performance test[edit | edit source]

The following example shows a throughput performance test, carried out with the well-known iperf tool:

root@diva:~# iperf -c 192.168.11.85 -t 100 -i 5
------------------------------------------------------------
Client connecting to 192.168.11.153, TCP port 5001
TCP window size: 43.8 KByte (default)
------------------------------------------------------------
[  3] local 192.168.11.154 port 51484 connected with 192.168.11.85port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 5.0 sec  55.4 MBytes  92.9 Mbits/sec
[  3]  5.0-10.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3] 10.0-15.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3] 15.0-20.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3] 20.0-25.0 sec  56.0 MBytes  94.0 Mbits/sec
[  3] 25.0-30.0 sec  56.2 MBytes  94.4 Mbits/sec
[  3] 30.0-35.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3] 35.0-40.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3] 40.0-45.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3] 45.0-50.0 sec  56.0 MBytes  94.0 Mbits/sec
[  3] 50.0-55.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3] 55.0-60.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3] 60.0-65.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3] 65.0-70.0 sec  56.0 MBytes  94.0 Mbits/sec
[  3] 70.0-75.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3] 75.0-80.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3] 80.0-85.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3] 85.0-90.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3] 90.0-95.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3] 95.0-100.0 sec  56.1 MBytes  94.2 Mbits/sec
[  3]  0.0-100.0 sec  1.10 GBytes  94.1 Mbits/sec

Bluetooth[edit | edit source]

The bluetooth can also be configured by enabling the correct gpios:

echo 114 > /sys/class/gpio/export
echo 115 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio114/direction
echo out > /sys/class/gpio/gpio115/direction
echo 1 > /sys/class/gpio/gpio114/value
echo 1 > /sys/class/gpio/gpio115/value

E.g

root@diva:~# echo 114 > /sys/class/gpio/export
root@diva:~# echo out > /sys/class/gpio/gpio114/direction
root@diva:~# echo 1 > /sys/class/gpio/gpio114/value
root@diva:~# echo 115 > /sys/class/gpio/export
root@diva:~# echo out > /sys/class/gpio/gpio115/direction
root@diva:~# echo 1 > /sys/class/gpio/gpio115/value
root@diva:~# rfkill list
0: phy0: wlan
        Soft blocked: no
        Hard blocked: no

Attaching the device:

root@diva:~# hciattach  /dev/ttyS1 texas 30000000 flow
Found a Texas Instruments' chip!
Firmware file : /lib/firmware/ti-connectivity/TIInit_7.6.15.bts
Loaded BTS script version 1
texas: changing baud rate to 3000000, flow control to 1
Device setup complete

Once the device has been attached using hciattach the hci0 interface should become visible:

root@diva:~# rfkill list
0: phy0: wlan
        Soft blocked: no
        Hard blocked: no
1: hci0: bluetooth
        Soft blocked: no
        Hard blocked: no

Bluetooth scan example:

root@diva:~# hciconfig hci0 up
root@diva:~# hcitool scan
Scanning ...
        18:F0:E4:E1:DC:F8       Redmi
        C8:94:BB:A0:7C:1F       wifi mp

The devices have been successfully recognized.