Wireless Module (DWM)

From DAVE Developer's Wiki
Revision as of 11:20, 11 December 2012 by DevWikiAdmin (talk | contribs) (Make Wireless Tools)

Jump to: navigation, search
Info Box
Dwm 01.png Applies to DWM

Introduction[edit | edit source]

Wireless Module (DWM) is one of DAVE's Add-On Modules. These devices are conceived and designed to be easily included in embedded system, in order to ease the use from the system integrator's standpoint, in terms of hardware issues and software compatibility. These characteristics make them suitable for use in combination with a wide range of host devices, from low-cost microcontrollers to high-end embedded processors.

Dwm 02.png

DWM belongs to the Connectivity Modules subfamily and provides support for WiFi (802.11 b/g/n) and Bluetooth (2.1 + EDR) throgh, respectively, a SDIO interface and a UART interface.

Specification[edit | edit source]

The module is built around a LS Research TiWi-R2 Integrated Transceiver Modules for WLAN 802.11 b/g/n and Bluetooth. The module realizes the necessary PHY/MAC layers to support WLAN applications in conjunction with a host processor over a SDIO interface. The module also provides a Bluetooth platform through the HCI transport layer. Both WLAN and Bluetooth share the same antenna port.

Features[edit | edit source]

  • Based on Texas Instruments WL1271 Transceiver
  • IEEE 802.11 b,g,n,d,e,i, compliant
  • Bluetooth 2.1+EDR, Power Class 1.5
  • Reduced footprint: 25 mm x 38 mm
  • Low height profile
  • U.FL connector for external antenna
  • Integrated band-pass filter
  • Industrial operating temperature range: -40 / +85 °C

Interface timings[edit | edit source]

Please refer to the TiWi-R2 Datasheet for SDIO [WiFi] and UART [Bluetooth] interface timings.

Power consumption[edit | edit source]

Reset[edit | edit source]

Pinout and detailed pin functions[edit | edit source]

DWM can be connected to the host board through the J1 connector.

Pinout reference[edit | edit source]

The following picture shows the reference pins of the J1 connector (placed on the bottom side of the DWM module):

Dwm 05.png

J1 connector pinout table[edit | edit source]

The following table reports the connector pinout:

Pin number Name Type Description Voltage Note
1 BT_EN Input Bluetooth Enable 3.3V
2 WIFI_EN Input WLAN Enable 3.3V
3 UART2_RTSn Output Bluetooth HCI UART RTS 3.3V
4 WIFI_IRQ Output WLAN Interrupt Request 3.3V
5 UART2_TXD Input/Output Bluetooth HCI UART TX 3.3V
6 BT_F2 Output Bluetooth Wakeup / DC2DC Mode 3.3V
7 UART2_CTSn Input Bluetooth HCI UART CTS 3.3V
8 WIFI_CLK_REQ(A) Output HOST_WakeUp 3.3V
9 UART2_RXD Input Bluetooth HCI UART RX 3.3V
10 NC Reserved for future use - Please leave unconnected.
11 DGND Ground -
12 NC Reserved for future use - Please leave unconnected.
13 DAT3 Input/Output SDIO Data Bit 3 3.3V
14 NC Reserved for future use - Please leave unconnected.
15 DAT2 Input/Output SDIO Data Bit 2 3.3V
16 NC Reserved for future use - Please leave unconnected.
17 DAT1 Input/Output SDIO Data Bit 1 3.3V
18 NC Reserved for future use - Please leave unconnected.
19 DAT0 Input/Output SDIO Data Bit 0 3.3V
20 NC Reserved for future use - Please leave unconnected.
21 DGND Ground -
22 DGND Ground -
23 SDO_CMD Input/Output SDIO Command Line 3.3V
24 SDO_CLK Input SDIO Clock 3.3V
25 DGND Ground -
26 DGND Ground -
27 3.3V Power Input +3.3V Input Voltage 3.3V
28 3.3V Power Input +3.3V Input Voltage 3.3V
29 5V Power Input +5V Input Voltage 5V
30 5V Power Input +5V Input Voltage 5V

Antenna connector[edit | edit source]

The following picture shows the position of the WiFi/Bluetooth antenna connector:


Dwm 06.png

Integration guide[edit | edit source]

This section provides useful information and resources that allow the system designer to integrate DWM module in his/her application very quickly.

Typical scenarios[edit | edit source]

The following pictures shows conceptual block diagram of application where the role of the host is played by an Embedded PC.

Typical scenario

Mechanical information[edit | edit source]

The following image shows the module dimensions:

DWM dimensions

Layout[edit | edit source]

The following images show the module layout:

DWM Top View
DWM Bottom View

The component view (top and bottom) is avalable as PDF file:

3D[edit | edit source]

Qualification tests[edit | edit source]

How to enable WiFi support[edit | edit source]

Kernel setup[edit | edit source]

Edit kernel configuration adding support for MMC and WL1271 chipset. If needed, please apply the patches to enable support for DWM on the platform in use.

Make Wireless Tools[edit | edit source]

Wifi Tools

FW DWL

To build Wireless tools you need to modify the Makefile in order to cross-compile and install the tools:

Make:

  • Check that the root file system path is correct
  • Check the env CROSS_COMPILE and PATH variables
  • make all
  • sudo make install

Please note that this tools are included in some Linux Embedded distributions, so you could use the package manager to install them. See for example the Running Ubuntu Core page to learn how to run an Ubuntu-based root file system, so you can easily add the required tools using the apt package manager.

Module Firmware[edit | edit source]

Download the firmware binaries and copy them into <RFS>/lib/firmware:

  • wl1271-fw.bin
  • wl1271-nvs.bin

User space basics[edit | edit source]

Boot[edit | edit source]

[...cut...]
[    0.980000] cfg80211: Calling CRDA to update world regulatory domain
[...cut...]
[   12.950000] lib80211: common routines for IEEE802.11 drivers
[   12.960000] lib80211_crypt: registered algorithm 'NULL'
[...cut...]
[   13.190000] mmc1: card claims to support voltages below the defined range. These will be ignored.
[   13.210000] mmc1: queuing unknown CIS tuple 0x91 (3 bytes)
[   13.220000] mmc1: new SDIO card at address 0001
[   13.220000] PM: Adding info for mmc:mmc1:0001
[   13.230000] PM: Adding info for sdio:mmc1:0001:1
[   13.370000] PM: Adding info for sdio:mmc1:0001:2
[   13.380000] PM: Adding info for platform:wl1271
[   13.380000] PM: Adding info for No Bus:phy0
[   13.390000] PM: Adding info for No Bus:wlan0
[   13.390000] wl1271: loaded
[   13.390000] wl1271: initialized

Dev Check[edit | edit source]

Check module loading and device creation:

ifconfig -a
[...cut...]

wlan0     Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Set the wlan0 MAC address:

ifconfig wlan0 hw ether xx:yy:zz:kk:ww:jj

You can create a simple script: setwmac to set the MAC address:

Use:

setwmac 00:01:02:03:04:05

Example:

root@dm814x-evm:~# setwmac 00:50:C2:B9:CF:87
Disable Wlan0...
Set Wlan MAC: 00:50:C2:B9:CF:87
Enable Wlan0...
[   36.960000] PM: Adding info for No Bus:mmc1:0001:2
[   37.020000] PM: Removing info for No Bus:mmc1:0001:2
[   37.020000] PM: Adding info for No Bus:mmc1:0001:2
[   37.060000] PM: Removing info for No Bus:mmc1:0001:2
[   37.220000] wl1271: firmware booted (Rev 6.1.0.50.350)
Done!

Scan to find wireless network[edit | edit source]

iwlist wlan0 scan

Output example:

root@dm814x-evm:~# iwlist wlan0 scanning
wlan0     Scan completed :
          Cell 01 - Address: 00:1F:1F:BD:24:30
                    Channel:11
                    Frequency:2.462 GHz (Channel 11)
                    Quality=54/70  Signal level=-56 dBm
                    Encryption key:on
                    ESSID:"INTELLINET_AP"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 9 Mb/s
                              18 Mb/s; 36 Mb/s; 54 Mb/s
                    Bit Rates:6 Mb/s; 12 Mb/s; 24 Mb/s; 48 Mb/s
                    Mode:Master
                    Extra:tsf=0000000041e910e9
                    Extra: Last beacon: 10ms ago
                    IE: Unknown: 000D494E54454C4C494E45545F4150
                    IE: Unknown: 010882848B961224486C
                    IE: Unknown: 03010B
                    IE: Unknown: 2A0104
                    IE: Unknown: 32040C183060
                    IE: Unknown: 2D1AEE1117FF000000010000000000000000000000000C0000000000
                    IE: Unknown: 3D160B070700000000000000000000000000000000000000
                    IE: Unknown: 3E0100
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                       Preauthentication Supported
                    IE: Unknown: DD180050F2020101000003A4000027A4000042435E0062322F00
                    IE: Unknown: 0B05010007127A
                    IE: Unknown: 7F0101
                    IE: Unknown: DD07000C4304000000
                    IE: Unknown: DD1E00904C33EE1117FF000000010000000000000000000000000C0000000000
                    IE: Unknown: DD1A00904C340B070700000000000000000000000000000000000000

Example: connecting to an encrypted wireless network[edit | edit source]

To connect to a secured AP use wpa_supplicant

wpa_supplicant

Configure wireless security editing /etc/wpa_supplicant.conf

Example:

ctrl_interface=/var/run/wpa_supplicant
eapol_version=1
ap_scan=0
fast_reauth=1
# Only WPA-PSK is used. Any valid cipher combination is accepted.
network={
	ssid="INTELLINET_AP"
	proto=WPA2
	key_mgmt=WPA-PSK
	pairwise=CCMP TKIP
	group=CCMP TKIP
	psk="davedavedave"
	priority=2
}

Start with the following options:

    wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf -d -P/var/run/wpa_supplicant -B

Associate to AP

iwconfig wlan0 essid INTELLINET_AP

Log

[ 5102.560000] wlan0: authenticate with 00:1f:1f:bd:24:30 (try 1)
[ 5102.560000] wlan0: authenticated
[ 5102.610000] wlan0: associate with 00:1f:1f:bd:24:30 (try 1)
[ 5102.610000] wlan0: RX AssocResp from 00:1f:1f:bd:24:30 (capab=0x411 status=0 aid=1)
[ 5102.620000] wlan0: associated
[ 5103.300000] wl1271: Association completed.

How to enable Bluetooth support[edit | edit source]

Kernel Config[edit | edit source]

Edit kernel configuration adding support for Bluetooth and HCI protocol:

Networking Support

 --- Bluetooth subsystem support
  <*>   L2CAP protocol support
  <*>   SCO links support
  <*>   RFCOMM protocol support
  [*]     RFCOMM TTY support
  <*>   BNEP protocol support
  [*]     Multicast filter support
  [*]     Protocol filter support
  <*>   HIDP protocol support
        Bluetooth device drivers  --->   
        <*> HCI USB driver
        < > HCI SDIO driver
        <*> HCI UART driver
          [*]   UART (H4) protocol support
          [ ]   BCSP protocol support
          [ ]   Atheros AR300x serial support
          [*]   HCILL protocol support  


Module Firmware[edit | edit source]

Download the firmware binaries and copy them into <RFS>/lib/firmware:

  • TIInit_7.2.31.bts

User space basics[edit | edit source]

Boot[edit | edit source]

[    1.000000] Bluetooth: Core ver 2.15
[    1.010000] Bluetooth: HCI device and connection manager initialized
[    1.020000] Bluetooth: HCI socket layer initialized
[...cut...]
[   12.900000] Bluetooth: HCI UART driver ver 2.2
[   12.900000] Bluetooth: HCI H4 protocol initialized
[   12.900000] Bluetooth: HCILL protocol initialized
[   12.910000] Bluetooth: Generic Bluetooth USB driver ver 0.6
[...cut...]
[   13.080000] Bluetooth: L2CAP ver 2.15
[   13.080000] Bluetooth: L2CAP socket layer initialized
[   13.080000] Bluetooth: SCO (Voice Link) ver 0.6
[   13.090000] Bluetooth: SCO socket layer initialized
[   13.090000] Bluetooth: RFCOMM TTY layer initialized
[   13.100000] Bluetooth: RFCOMM socket layer initialized
[   13.110000] Bluetooth: RFCOMM ver 1.11
[   13.110000] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   13.110000] Bluetooth: BNEP filters: protocol multicast
[   13.120000] Bluetooth: HIDP (Human Interface Emulation) ver 1.2

Install Bluez & Obex tools[edit | edit source]

From target, with opkg package manager (usually on Angstrom or other OpenEmbedded derived distributions):

opkg install bluez4
opkg install obex-data-server
opkg install obexd
opkg install obexftp

Manual startup[edit | edit source]

BT module Enable via GPIO 81

# export GPIO=/sys/class/gpio
# echo 81 > $GPIO/export
# echo out > $GPIO/gpio81/direction
# echo 1 > $GPIO/gpio81/value
[   58.810000] PM: Adding info for No Bus:gpio81

BT Services[edit | edit source]

# bluetoothd
# hciattach /dev/ttyO2 texas 3000000 flow

Found a Texas Instruments' chip!
Firmware file : /lib/firmware/TIInit_7.2.31.bts
Loaded BTS script version 1
texas: changing baud rate to 3000000, flow control to 1
[   63.120000] PM: Adding info for No Bus:hci0
Device setup complete

Scan devices[edit | edit source]

hcitool scan

Scanning ...
        9C:4A:7B:F0:xx:xx       device 1
        00:07:AB:6F:xx:xx       device 2

Add Services[edit | edit source]

To set the BT module name

hciconfig hci0 name <NOME>

To set the visibile services

sdptool add <SERVICE>

The available services are the following:

Services:
        DID SP DUN LAN FAX OPUSH FTP PRINT HS HSAG HF HFAG SAP PBAP NAP
        GN PANU HCRP HID KEYB WIIMOTE CIP CTP A2SRC A2SNK AVRCT AVRTG
        UDIUE UDITE SEMCHLA SR1 SYNCML SYNCMLSERV ACTIVESYNC HOTSYNC
        PALMOS NOKID PCSUITE NFTP NSYNCML NGAGE APPLE ISYNC GATT

Example 1 : Obex FTP server[edit | edit source]

For each visible service, the associated daemon should be launched. As an example, for the FTP service, you need to launch:

obexftpd -b

To send a file using FTP on Bluetooth:

obexftp -b MAC-BT-DESTINO -p FILE

Example 2 : Obex push server[edit | edit source]

http://packages.debian.org/squeeze/obexpushd