VoCore2: WiFi Driver for Linux 4.9(LEDE latest version) 2

Magic!!

This new wifi driver fix a weird bug of VoCore2 Ultimate.

We found using the on board antenna, it will crosstalk to the sound chip, when it play music, we can hear some noise from the radio.

But when I am using the new wifi driver, just find the noise disappear!

That’s really weird. Need more test. :p

VoCore2: WiFi Driver for Linux 4.9(LEDE latest version)

I have spend a lot of time on this, finally it is working perfect with latest LEDE!!
This firmware also enable sniffer/monitor mode for possible fun.

This driver is more stable than last time one for Linux 4.5, I have used iperf3 test one hour, average speed is greater than 40Mbps — one on board blue antenna, and over 50Mbps for one external antenna. Of course double external antennas will be much faster.

firmware with blob here: http://vonger.cn/misc/vocore2/lede-ramips-mt76x8-vocore2-squashfs-sysupgrade.bin
md5: 9a7ef2de60713cfb7c951ba4a6a92b81

mt7628.ko: http://vonger.cn/misc/vocore2/mt7628.ko for Linux 4.9
iwpriv and iwconfig: http://vonger.cn/misc/vocore2/wireless-tools_29-5_mipsel_24kc.ipk

mt7628.dat: used to config wifi kernel. uncompress and put it to /etc, link here http://vonger.cn/misc/vocore2/wireless.zip

mt7628.dat should in this path /etc/wireless/mt7628/mt7628.dat

PS: unfortunately, because of MTK NDA, I can not public its source code.

How to use?
First of all: insmod mt7628

1. Enable wifi AP mode:

ifconfig ra0 192.168.1.1 up
brctl addif br-lan ra0

2. Enable monitor/sniffer mode(I never use sniffer mode before, maybe it works)

ifconfig mon0 up

3. Enable STA mode…(this need compile iwpriv into the firmware, I did not try)

iwpriv ra0 set SiteSurvey=1
sleep 1
iwpriv ra0 set SiteSurvey=0
iwpriv ra0 get_site_survey

iwpriv ra0 set Channel=11 (must same as your AP, this value can get from "iwpriv ra0 get_site_survey")
iwpriv apcli0 set ApCliEnable=0
iwpriv apcli0 set ApCliAuthMode=WPA2PSK (normally WPA2 personal we use this setting)
iwpriv apcli0 set ApCliEncrypType=AES
iwpriv apcli0 set ApCliSsid=[YOUR SSID]
iwpriv apcli0 set ApCliWPAPSK=[YOUR SSID PASSWORD]
iwpriv apcli0 set ApCliEnable=1

TODO:
make uci work with this driver. Currently have to manually insert the driver and start up it. :p

VoCore2: Wireless Driver for Linux 4.9

xxxx, LEDE Linux 4.9 kernel has changed a lot! Transport MediaTek wireless driver is very painful this time, part of the code have to be rewriten. :'(

PS: I think MTK should hire me for transport driver to openwrt/LEDE, I guess I know the driver even better than some of their engineers, lol :p

monitor mode, multi SSID, mesh network, and various of packages… everything is that delicious…attract me spend my time, have to work harder πŸ™‚

VoCore2: remote debug with GDB

I love command line recently, Eclipse might be easy to use(I do not like Java complex depends), Qt creator looks nice(this is my favorite IDE), but command line, the GDB, is their core.

First, let’s compile gdb…
This article is focus on cross-compile. (I do not think you can compile gdb on VoCore2 magically πŸ™‚

Once you compile openwrt or LEDE on your host linux computer, it already have gdb(mipsel-openwrt-linux-uclibc-gdb), but it has a bug, when you run it later it will report “Remote ‘g’ packet reply is too long”. This is easy to fix, we need to modify gdb Makefile, in openwrt/toolchain/gdb/Makefile, section “Host/Configure”, add “–with-expat” to CFLAGS. Better to delete old compiled gdb file in build_dir.

You might also need to install expat lib, call “apt-get install libexpat-dev”

Then compile…

Now let’s make a simple app to debug
I’d like to use “mem”, this small app is used to read and write to memory directly. I use it to develop driver and do quick hack to the kernel.
Source code is here: Link to Source

Uncompress it and get mem.c

Next step, compile it with debug information
One command line will do this, do not forget -g, it is used to generate debug links.

mipsel-openwrt-linux-uclibc-gcc -g mem.c -o mem

Make gdbserver
In openwrt “make menuconfig”, Development section, select gdbserver.
Compile and install gdbserver to your VoCore.
Also you can copy mem to your VoCore.

We can happy debug
On VoCore2, run command

gdbserver 192.168.61.1:8888 ./mem

On your host, run command

mipsel-openwrt-linux-uclibc-gdb ./mem
(gdb) set sysroot ~/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/
(gdb) target remote 192.168.61.1:8888

Now we can use gdb command:

r: run the app.
l: show source code list.
b: add break point, parameter is the line number.
ni: step over one line.
si: step in one line.
p: show the parameter value.
d: delete break point.
i b: show current break point.
c: continue and run to next break point.

VoCore2: Login to Terminal from Browser

1. Download the package Makefile from https://github.com/paradislover/shellinabox, current version it is 2.19.

2. Put it in openwrt source/package/utils

3. Call “make menuconfig”, select shellinabox in Network submenu.

4. Compile openwrt, and upgrade VoCore2 firmware.

5. Connect to VoCore2 by wire or wifi, now we can login to it from browser 192.168.61.1:4200.

Good luck!

VoCore2: New Dock with microUSB Ethernet!

I made another dock for VoCore2 Ultimate, added on board USB to Ethernet to replace old on board USB to TTL, this alter will make VoCore2 more flexble.

Currently the microUSB port is not only for power, but also it is another ethernet port(using port 1).

Once we connect it to computer, we can debug VoCore2 by USB LAN10/100, much faster and more stable.

PS: USB2TTL is removed from dock but still able to use an external device connect to UART0 for the console debug.

Now we can have more advanced usage:

ifconfig will find this device once it is connect to your Linux/MacOS computer.(Windows should be same)

en7: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=2b<RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4>
	ether 00:e0:3c:36:e2:xx
	inet6 fe80::10ad:1794:b44f:59xx%en7 prefixlen 64 secured scopeid 0xf 
	inet6 fdac:96e9:9938::1874:61ba:9aca:6axx prefixlen 64 autoconf secured 
	inet6 fdac:96e9:9938::f85f:93f7:4c10:82xx prefixlen 64 autoconf temporary 
	inet 192.168.61.110 netmask 0xffffff00 broadcast 192.168.61.255
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect (100baseTX)
	status: active

It allocedΒ 192.168.61.110 for my computer.
This dock is specially for portable router, VPN connection.

Its shape is exactly same as VoCore2 Ultimate. πŸ™‚
Here is the raw dock, based on RTL8152

VoCore2 Tips

1. Switch port0 between “wan” and “lan”

change in VoCore2, /etc/config/network, first vlan is lan ports, second vlan is wan port, put 0 into second one, port0 will become lan port.

config switch_vlan
...
...
    option ports '0 2 3 4 6t'


config switch_vlan
...
...
    option ports '1 6t'

2. Restart wifi in console.

wifi


3. Clean memory of VoCore2 for long time usage.

sync && echo 3 > /proc/sys/vm/drop_caches


4. Play radio with VoCore2 Ultimate

(sleep 5;wget -O - http://icecast.cogecomedia.com:8000/chmp.mp3 | madplay -)&

(Canada Radio πŸ™‚

5. Add password for UART console.

modify /etc/inittab

::askconsole:/bin/ash --login
------------------------------
::askconsole:/bin/login

note: make sure busybox enable login command when compile busybox.

6. Windows7 or lower system can not install driver for USB2TTL
check this link: Connecting to the serial console on Windows 7

 

Special Thanks

Patrick Coutu (contribute 3, 4)
Noble Pepper (contribute 6)