Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Difference between revisions of "Rock/Wireless"

(Configure dhcp server,wifi(user,password),autorun the softAP)
 
(14 intermediate revisions by 3 users not shown)
Line 5: Line 5:
  
 
== Before start ==
 
== Before start ==
The Radxa Rock provides various ways to connect, wired and wireless. The full version has wifi and bluetooth on board, and lite version has wifi only. Both module are connect to the cpu via the USB interface.
+
The Radxa Rock provides various ways to connect, wired and wireless. The full version has wifi and BT on board, and lite version has wifi only. Both module are connect to the cpu via the USB interface.
  
 
== Using wireless under Android ==
 
== Using wireless under Android ==
  
The wifi and bluetooth(if has) works out of the box, check out in the Setting to configure it.
+
The wifi and BT (if has) works out of the box, check out in the Setting to configure it.
  
 
== Using wireless under Linux ==
 
== Using wireless under Linux ==
Line 103: Line 103:
 
     wpa-conf /etc/wpa_supplicant.conf
 
     wpa-conf /etc/wpa_supplicant.conf
  
==== AP mode(RR acts as wireless router) ====
+
==== AP mode(RR as the wireless router) ====
=====Build the driver for softAP=====
+
一.  Prepare works
+
  
1.1 Download the source driver from the address:
+
=====Easily Make Your Own HostAP(8723au) =====
      wget http://dl.radxa.com/rock/source/RTL8723A_WiFi_linux_v4.1.7_8023_BTCOEX20130528_ver3.3_beta.rar
+
  
1.2 [[Rock/install toolchain|Install toolchain]].
+
first ,ensure your network function well on board
  
1.3 Download the kernel from the address:
+
to get the hostap package('''8723au''') [http://dl.radxa.com/rock_pro/source/rock_pro_8723au_hostapd_linux.tar.gz  8723au_hostapd_linux.tar.gz].
      git clone -b radxa-stable-3.0 https://github.com/radxa/linux-rockchip.git
+
tar zxf  rock_pro_8723au_hostapd_linux.tar.gz
      or download here
+
  cd rock_pro_8723au_hostapd_linux
      http://pan.baidu.com/s/1jfOTo (china)
+
make install
 +
reboot
  
二. Compile the driver
+
=====Easily Make Your Own HostAP(8188eu)=====
Attention please: first,ensure your kernel has been compiled
+
  
    root@radxa:/tmp# unrar x RTL8723A_WiFi_linux_v4.1.7_8023_BTCOEX20130528_ver3.3_beta.rar
+
In the same way,to get the hostap package('''8188eu''') [http://dl.radxa.com/rock_lite/source/8188eu_hostapd_linux.tar.gz 8188eu_hostapd_linux.tar.gz].
    root@radxa:/tmp# cd RTL8723A_WiFi_linux_v4.1.7_8023_BTCOEX20130528_ver3.3_beta
+
tar zxf 8188eu_hostapd_linux.tar.gz
    root@radxa:/tmp# cd driver
+
cd 8188eu_hostapd_linux
    root@radxa:/tmp/driver# tar zxvf rtl8723A_WiFi_linux_v4.1.7_8023.20130628_BTCOEX20130528_ver3.3_beta.tar.gz
+
make install
    root@radxa:/tmp/driver# cd rtl8723A_WiFi_linux_v4.1.7_8023.20130628_BTCOEX20130528_ver3.3_beta
+
reboot
    root@radxa:/tmp/driver/rtl8723A_WiFi_linux_v4.1.7_8023.20130628_BTCOEX20130528_ver3.3_beta# vim Makefile
+
  
To select target platform for compilation,Only one entry is allowed to be set with value ‘y’ and others with ‘n’ :
+
You can also configure wifi as AP mode manually, please refer [[Rock/Wireless/AP_mode_manually | AP mode manually]].
47 CONFIG_PLATFORM_I386_PC = n
+
'''48 CONFIG_PTFORM_ANDROID_X86 = n'''
+
49 CONFIG_PLATFORM_JB_X86 = n
+
...
+
...
+
66 CONFIG_PLATFORM_ARM_TCC8920_JB42 = n
+
'''67 CONFIG_PLATFORM_ARM_RK2818 = y'''
+
68 CONFIG_PLATFORM_ARM_URBETTER = n
+
  
you should modify the corresponding entry inside platform setting section
+
=== BT ===
<syntaxhighlight lang="make">
+
603 ARCH := arm
+
604 CROSS_COMPILE := arm-eabi-
+
605 KSRC := /media/jim/radxa_rock_linux/linux-rockchip
+
</syntaxhighlight>
+
ARCH
+
The ARCH is used to specify the architecture of the target platform CPU.
+
CROSS_COMPILE
+
The CROSS_COMPILE is used to specify the toolchain prefix used for driver compilation.
+
KSRC
+
The KSRC is used to specify the path of kernel source used for driver compilation
+
 
+
build wlan.ko
+
    root@radxa:/tmp/driver/rtl8723A_WiFi_linux_v4.1.7_8023.20130628_BTCOEX20130528_ver3.3_beta# make
+
 
+
you will get wlan.ko, copy the wlan.ko to your rock pro board and run
+
    root@radxa:~# rm /lib/modules/3.0.36+/kernel/drivers/net/wireless/rtl8723au_lwfinger/8723au.ko
+
    root@radxa:~# cp wlan.ko /lib/modules/3.0.36+/kernel/drivers/net/wireless/rtl8723au_lwfinger/
+
    root@radxa:~# reboot
+
 
+
=====Configure dhcp server,wifi(user,password),autorun the softAP=====
+
三. configure service:
+
3.1 Configure static IP
+
root@radxa:/etc#vim /etc/network/interfaces
+
auto wlan0
+
iface wlan0 inet static
+
address 192.168.2.1
+
netmask 255.255.255.0
+
 
+
3.2 Configure the dhcp server
+
root@radxa:/etc# '''apt-get install dnsmasq'''
+
root@radxa:/etc# '''vim dnsmasq.conf'''
+
 
+
<syntaxhighlight lang="make" enclose="div">
+
interface=wlan0
+
bind-interfaces
+
except-interface=lo 
+
dhcp-range=192.168.2.150,192.168.2.254,12h  #configure the range of available ip
+
dhcp-option=3,192.168.2.1  #configure the server
+
</syntaxhighlight>
+
 
+
3.3 Make your network faster
+
root@radxa:/etc# '''apt-get install haveged'''
+
 
+
3.4  Configure the wifi(user,password):
+
root@radxa:/etc# '''cp /tmp/RTL8723A_WiFi_/wpa_supplicant_hostapd/rtl_hostapd_2G.conf  /etc/hostapd/hostapd.conf'''
+
root@radxa:/etc# vim /etc/hostapd/hostapd.conf
+
 
+
<syntaxhighlight lang="make" enclose="div">
+
interface=wlan0
+
ctrl_interface=/var/run/hostapd
+
ssid="user-name"
+
channel=6
+
wpa=2
+
wpa_passphrase="password"
+
#bridge=br0
+
</syntaxhighlight>
+
 
+
3.5 autorun your softAP:
+
 
+
root@radxa:/etc# vim wifs.sh
+
<syntaxhighlight lang="bash" enclose="div">
+
#!/bin/sh
+
#start the AP service
+
#Start hostapd, and it will automatically be bringed up
+
sudo hostapd -B /etc/hostapd/hostapd.conf
+
#Set ip on wlan0
+
sudo /sbin/ip addr add 192.168.2.1/24 dev wlan0
+
#Start dnsmasq
+
sudo /usr/sbin/service dnsmasq start
+
#Start ip_forward
+
sudo echo 1 > /proc/sys/net/ipv4/ip_forward
+
#add iptables rule for NAT
+
sudo /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
+
#start haveged
+
sudo /etc/init.d/haveged start
+
</syntaxhighlight>
+
 
+
root@radxa:/etc/init.d# vim rc.local
+
add the following befor '''exit'''
+
<syntaxhighlight lang="bash" enclose="div">
+
  . /etc/wifs.sh
+
  . /lib/init/vars.sh
+
  . /lib/lsb/init-functions
+
</syntaxhighlight>
+
root@radxa:/etc/init.d# reboot
+
 
+
=== Bluetooth ===
+
 
to get the driver:
 
to get the driver:
  
Line 235: Line 135:
 
Then on your Linux host computer you will find a directory "/lib/modules/3.0.36+/" containing a "kernel" directory and two symbolic links called "build" and "source" to your Rockchip kernel source directory (originally called "rockchip-3.0") wherever you downloaded it to. This is the prerequisite for compiling rockchip modules.
 
Then on your Linux host computer you will find a directory "/lib/modules/3.0.36+/" containing a "kernel" directory and two symbolic links called "build" and "source" to your Rockchip kernel source directory (originally called "rockchip-3.0") wherever you downloaded it to. This is the prerequisite for compiling rockchip modules.
  
Then change into the bluetooth driver directory rtl8723au_bt and edit the textfile called "Makefile".
+
Then change into the BT driver directory rtl8723au_bt and edit the textfile called "Makefile".
 
My "Makefile" now looks like this, I marked the changes bold:
 
My "Makefile" now looks like this, I marked the changes bold:
  
Line 289: Line 189:
 
   sudo insmod rtk_btusb.ko
 
   sudo insmod rtk_btusb.ko
  
Now "hcitool dev" recognizes the adapter (hci0) and "hcitool scan" finds remote bluetooth devices.
+
Now "hcitool dev" recognizes the adapter (hci0) and "hcitool scan" finds remote BT devices.
 
But I could not get any device to pair. Any ideas appreciated.
 
But I could not get any device to pair. Any ideas appreciated.
  
 
Alex
 
Alex
 
letux@arcor.de
 
letux@arcor.de

Latest revision as of 03:15, 29 September 2022

Before start

The Radxa Rock provides various ways to connect, wired and wireless. The full version has wifi and BT on board, and lite version has wifi only. Both module are connect to the cpu via the USB interface.

Using wireless under Android

The wifi and BT (if has) works out of the box, check out in the Setting to configure it.

Using wireless under Linux

Wifi

The model number of the module on RR and RR lite is RTL8723AU on RR full version and RTL8188ETV on lite version. You can see the id of the module with the following command on RR:

   sudo apt-get install usbutils
   lsusb

For RR full version the output is

   root@radxa:~# lsusb
   Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
   Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
   Bus 002 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
   Bus 002 Device 003: ID 0bda:0724 Realtek Semiconductor Corp.

on lite version, the output is:

   Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub                  
   Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub                  
   Bus 002 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB         
   Bus 002 Device 003: ID 0bda:0179 Realtek Semiconductor Corp.    

The 0bda:0724 is the id of rtl8723 modlue, the 0bda:0179 is the id of rtl8188etv module.

Desktop

   Go to Start menu -> Perference -> Network Connections -> wifi, choose the wifi network you want to join and click edit -> wifi security, input the wifi password and save. Then click the right corner to join your wifi network.

Manually connect with Network Manager

You can use nmcli (Network Manager Command Line Interface) to configure your network interfaces.

List wireless networks

# nmcli dev wifi list
SSID                              BSSID               MODE             FREQ       RATE       SIGNAL   SECURITY   ACTIVE  
'MY-ACCESS-POINT'                 12:34:56:78:90:AB   Infrastructure   2412 MHz   44 MB/s    100      WPA WPA2   yes
'OTHER-ACCESS-POINT'              34:12:78:56:AB:90   Infrastructure   2416 MHz   54 MB/s    70       WPA WPA2   yes

Connect to your wireless network

# nmcli dev wifi connect MY-ACCESS-POINT password MY-PASSWORD

List network devices

# nmcli device
DEVICE     TYPE              STATE        
wlan1      802-11-wireless   connected    
eth0       802-3-ethernet    unavailable

List saved networks

# nmcli connection
NAME                      UUID                                   TYPE              TIMESTAMP-REAL                    
MY-ACESS-POINT            a2301195-5c6a-4000-adc5-dd388a58822e   802-11-wireless   Tue 15 Apr 2014 10:30:30 PM UTC   
OTHER-ACCESS-POINT        83202209-1328-4e85-b7fa-e8c4a902e9ef   802-11-wireless   never                             
Wired connection 1        413fdf5a-27bf-4f88-93c5-a4da394e20ce   802-3-ethernet    Tue 15 Apr 2014 10:10:33 PM UTC   
Auto Ethernet             e96a5543-1235-4497-9e10-b431f588a94d   802-3-ethernet    Fri 14 Mar 2014 11:36:21 AM UTC   

Manually config to connect wireless router

To use RR(lite) to connect to your wireless router, you need to do the following:

   sudo apt-get install wireless-tools
   sudo apt-get install wpasupplicant
   sudo ifconfig wlan0 up

If you are unable to bringup wlan0, mean drivers are not installed. Follow this step to add driver. Assumes you have net connection thru ethernet, else download and move

   sudo mkdir -p /lib/modules && cd /lib/modules
   sudo wget http://dl.radxa.com/rock/images/ubuntu/partitions/modules_3.0.36+_14-04-12.tar.gz
   sudo tar zxvf modules_3.0.36+_14-04-12.tar.gz
   sudo rm modules_3.0.36+_14-04-12.tar.gz
   sudo modprobe 8723au

now you should see wlan0 by ifconfig

Now you can view is the wifi module works by scanning the AP nearby

   iwlist wlan0 scan

For the new wifi driver, iwlist will report wlan0 Interface doesn't support scanning. you need to use the new tool iw instead

   iw dev wlan0 scan

edit /etc/wpa_supplicant.conf

   ctrl_interface=/var/run/wpa_supplicant
   network={
   	ssid="your ssid name"
   	psk="your wireless password"
   }

and then run

   wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf 

to connect to the wireless router.

run the following to get an IP from the router.

   dhclient wlan0

If you want to set the RR to connect to the wireless router automatically every time it boot up. Add the following to the /etc/network/interfaces

   auto wlan0
   iface wlan0 inet dhcp
   wpa-conf /etc/wpa_supplicant.conf

AP mode(RR as the wireless router)

Easily Make Your Own HostAP(8723au)

first ,ensure your network function well on board

to get the hostap package(8723au) 8723au_hostapd_linux.tar.gz.

tar zxf  rock_pro_8723au_hostapd_linux.tar.gz
cd rock_pro_8723au_hostapd_linux
make install
reboot
Easily Make Your Own HostAP(8188eu)

In the same way,to get the hostap package(8188eu) 8188eu_hostapd_linux.tar.gz.

tar zxf 8188eu_hostapd_linux.tar.gz
cd 8188eu_hostapd_linux
make install
reboot

You can also configure wifi as AP mode manually, please refer AP mode manually.

BT

to get the driver:

  git clone https://github.com/lwfinger/rtl8723au_bt

To compile the driver, you need to have compiled your own Kernel like described in

 http://wiki.radxa.com/Rock/Booting_Linux

Then on your Linux host computer you will find a directory "/lib/modules/3.0.36+/" containing a "kernel" directory and two symbolic links called "build" and "source" to your Rockchip kernel source directory (originally called "rockchip-3.0") wherever you downloaded it to. This is the prerequisite for compiling rockchip modules.

Then change into the BT driver directory rtl8723au_bt and edit the textfile called "Makefile". My "Makefile" now looks like this, I marked the changes bold:

 FW_DIR	:= /lib/firmware/rtk_bt
 MDL_DIR	:= /lib/modules/3.0.36+
 DRV_DIR	:= $(MDL_DIR)/kernel/drivers/bluetooth
     
 ifneq ($(KERNELRELEASE),)
     
        obj-m := rtk_btusb.o
     
 else
    PWD := $(shell pwd)
    KVER := "3.0.36+"
    KDIR := /lib/modules/3.0.36+/build
      
 all:
    $(MAKE) -C $(KDIR) M=$(PWD) modules
   
     
 clean:
     rm -rf *.o *.mod.c *.mod.o *.ko *.symvers *.order *.a
 endif
     
 install:
      mkdir -p $(FW_DIR)
      cp -f rlt8723a_chip_b_cut_bt40_fw_asic_rom_patch-svn8511-0x0020342E-20121105-LINUX_USB.bin $(FW_DIR)/rtk8723a.bin
      cp -f rtk_btusb.ko $(DRV_DIR)/rtk_btusb.ko
      #depmod -a $(MDL_DIR)'
      #echo "install rtk_btusb success!
      
 uninstall:
      rm -f $(DRV_DIR)/rtk_btusb.ko
      depmod -a $(MDL_DIR)
      rm -f $(FW_DIR)/rtk8723a.bin
      echo "uninstall rtk_btusb success!"


Then do

 export ARCH=arm
 export CROSS_COMPILE=arm-linux-gnueabihf-
 make
 sudo make install

After that copy the following files from the host system into the same folder on Radxa Rock:

 /lib/firmware/rtk_bt/rtk8723a.bin
 /lib/modules/3.0.36+/kernel/drivers/bluetooth/rtk_btusb.ko

Last on Radxa Rock system change into the folder

 /lib/modules/3.0.36+/kernel/drivers/bluetooth 

and enter the command

 sudo insmod rtk_btusb.ko

Now "hcitool dev" recognizes the adapter (hci0) and "hcitool scan" finds remote BT devices. But I could not get any device to pair. Any ideas appreciated.

Alex letux@arcor.de