How to configure wireless interfaces (UMTS, WLAN, Bluetooth)
is configured as SDIO card "mmc1".
Driver: Marvel 8686 (libertas) Firmware: sd8686.bin
Alternative driver: libertas_tf Firmware: sd8686tf.bin
The difference is that less things are done in the firmware. Pro: more control on kernel side, e.g. wifi can be configured as an access point. Con: more work has to be done on kernel side. Less power management is supported, driver is not in main tree (for sdio).
power is switched on by ifconfig wlan0 up and switched off by ifconfig down.
Please note that the WLAN module may draw up to 250 mA which drains a completely charged the battery in less than 4 hours. There are various ways to reduce the power consumption. Most of them are implemented in the 2.6.32-hw-validation kernel. IEEE80211 power saving mode reduces power consumption when the WLAN module is connected by only listening for incoming traffic periodically. The access point has to buffer the traffic. Implemented is this also in the 3.7-neil-plus-plus kernels and recent 4.4-rc kernels where it is enabled by default. Besides of the reduced power consumption, symptoms of enabled power saving are variating ping times. If the driver does not support power saving, iwconfig still shows "Power Management:on"!
Options for being waked by incoming packets can be set via ethtool -s wlan0 wol... (untested)
The libertas and libertas_sdio kernel modules should be loaded automatically after setting the interface to "up".
iwconfig wlan0 ifconfig wlan0 up (ifup wlan0 is broken) iwlist wlan0 scan
Note: the interface name wlan0, wlan1 etc. is tied to the MAC address of the WLAN chip by udev. So if you swap your SD card to a different GTA04 device, the interface name will change as well (wlan0, wlan1, wlan2, ...)!
Power saving can be switched off via
iwconfig wlan0 power off
and be switched on via
iwconfig wlan0 power on
Create an ad-hoc network
On the phone run:
ifconfig wlan0 up iwconfig wlan0 mode ad-hoc essid GTA04 enc off channel 6 ifconfig wlan0 10.1.1.1
On a laptop run:
ifconfig wlan0 up iwconfig wlan0 mode ad-hoc essid GTA04 enc off ifconfig wlan0 10.1.1.2
Now they should be connected. To verify this try to ping each other.
The call to iwconfig will search for a network with the specified essid and join it. If none is found, a new one will be created. You can check if the devices are connected to the same network by comparing the cell address which can be displayed with 'iwconfig wlan0'.
Depending on the chipsets the syntax may be slightly different. Try 'enc none' if 'off' does not work.
just the usual
wpa_supplicant -c configfile -i wlan0 & dhclient wlan0
should work. Or have some graphical tools which do that in background for you.
Host AP mode
To use the GTA04 as an access point, you have to unload the libertas and libertas_sdio modules
rmmod libertas_sdio rmmod libertas
and load the libertas_tf_sdio module
You should have CONFIG_VLAN_8021Q enabled in your kernel, start the hostapd, configure the interface:
hostapd configfile ifconfig wlan0 x.x.x.x up
Data rate can be quite slow (like 100 KBytes/s) if the sdio host driver does not support sdio irqs. In contrast to sd memory cards they can provide input asynchronously, like receiving packets. To handle that efficiently, proper irq support is important. Patches for that are in the 2.6.32-hw-validation kernel, 3.7-neil-plus-plus kernel and recent 4.4-rc kernels
is accessed through UART1 (/dev/ttyO0 = oh-zero).
is powered on by accessing /dev/ttyO0, e.g. starting hciattach
is powered of if /dev/ttyO0 is no longer used.
Attach to UART1 as HCI interface
SPEED=3000000 # choose 115200 for GTA04A3 boards hciattach -s $SPEED /dev/ttyO0 any $SPEED flow && sleep 2 hciconfig -a hciconfig hci0 up; sleep 2 hciconfig hci0 name GTA04 hcitool dev hcitool scan
Remember to activate where necessary the bluetooth device via the rfkill switches after launching hciatttach.
This assumes a default bit rate of 3 MBit/s. Please check with the manual of your version.
Increase data rate to benefit from bluetooth 2.0 EDR
If your bluetooth chip does not come with 3 MBit/s (only GTA04A3 boards) you can reprogram the interface. This assumes kernel 3.x (or hw-validation kernel after 17th dec 2011) as the UART speed of older kernels might be limited to 115200.
hciattach -s 115200 /dev/ttyO0 any 115200 flow hciconfig hci0 up bccmd -d hci0 psset baudrate 12288 bccmd -d hci0 warmreset killall hciattach hciattach -s 3000000 /dev/ttyO0 any 3000000 flow hciconfig hci0 up
If everything went right (watch your kernel log for tx timeout error messages) you should now get the full bluetooth 2.0 EDR speed.
This change is not permanent and has to be done every time you power up the Wi2Wi module.
To save the new baudrate use the following command, but PLEASE make sure everything worked with these settings. If not you might brick your bluetooth chip!
bccmd -d hci0 psset -s 0x1 baudrate 12288
If you personally don't like such high baudrates you can choose your own using the equation:
BAUDRATE = PSKEY_UART_BAUDRATE / 0.004096
where PSKEY_UART_BAUDRATE is the value you need for bccmd (12288 for 3MBaud) and BAUDRATE is the value needed for hciattach.
If you want to know the current baudrate of your chip you could use
bccmd -d hci0 psget -s 0x0 baudrate
The default (power up) baudrate will be shown with
bccmd -d hci0 psget -s 0x1 baudrate
Cofiguring bluetooth in Debian
You can configure bluetooth in init scripts:
echo "-s 3000000 /dev/ttyO0 any 3000000 flow" > /etc/bluetooth/uart
will be working and you can use bluez dbus interface.
Please note that this powers on Bluetooth right after booting which may draw more power than you expect!
is connected to the internal HS-USB. Use lsusb to identify the modem and the bus.
Operation needs the OPTION HSO-kernel driver modules which load automatically as soon as the device is recognized on the bus.
The AT command interface is usually /dev/ttyHS3 (or ttyHS4 depending on some race condition during initialization).
On the GTA04A3 board the module powers up automatically. Due to a hardware bug in the GTA04A3 it can not be completely powered down. So it will go to sleep mode (3-10 mA) and drain the battery slowly even if the OMAP system is halted. If there is an incoming call, it will even draw more, trying to wake the CPU.
On the GTA04A4 board give a 200ms impulse (0-1-0) on GPIO186 top power on. And a second one to power off. You can identify if the device has been powered up (after approx. 1-2 seconds) through lsusb.
echo 0 >/sys/devices/virtual/gpio/gpio186/value echo 1 >/sys/devices/virtual/gpio/gpio186/value # 0->1: on sleep 1 echo 0 >/sys/devices/virtual/gpio/gpio186/value lsusb ... do something echo 1 >/sys/devices/virtual/gpio/gpio186/value # stops operation (but not power) sleep 1 echo 0 >/sys/devices/virtual/gpio/gpio186/value # 1->0: off
NOTE: the module does not automatically power down if the kernel is shut down or the TPS65950 is forced to remove power from the CPU. Depending on network registration state and reception quality this may draw between 3 and 100 mA.
Here are the most important commands:
|AT+COPS=1||make ATD block until connection set up is sent or rejected|
|ATDnumber;||the semicolon is important to start a voice connection; number allows [0-9]+#*GgIg|
|AT_OPCMENABLE=1||enable the PCM interface|
|AT+VTS=[0-9A-D]+*||send DTMF (if connection is established)|
You can choose between voice going directly to the Audio codec:
amixer set 'Voice route' 'Voice to twl4030'
or going to the CPU (McBSP):
amixer set 'Voice route' 'Voice to SoC'
In the latter case you can use arecord to record incoming voice and aplay to send outgoing voice/music. This can e.g. be used to build a telephone answering machine. Please note that arecord/aplay and pipes introduce a significant delay that deteriorates the telephony signals and handsfree operation. People will report echo.
To set up a connection between microphone, speakers and the UMTS voice channel use this command:
arecord -fS16_LE -r8000 | aplay -Dhw:1,0 & arecord -Dhw:1,0 -fS16_LE -r8000 | aplay &
Use amixer to control the volume etc. If voice is provided in speakerphone mode or through a (bluetooth) headset, switch to the appropriate filter profile by AT_OPCMPROF