VoCore2: Hack the Wifi

Now, open the mystery wifi driver package, we will find two folders, one is build, another is src.

build folder contains two files, one is Kconfig and another is Makefile. The two are standard Linux kernel compile makefile, Kconfig normally used to embed itself to menuconfig and Makefile is used to tell linux compiler which files are necessary to compile the final model(mt7628.ko). More details about Kconfig and Makefile, you can check linux kernel documentation or buy a linux kernel beginner book 🙂

Let’s open Kconfig check what it support:

AP_SUPPORT: emm, I think it is the base function support for wifi AP.
WDS_SUPPORT: WDS, I do not need this, not making a router.
MBSS_SUPPORT: Its full name is MBSSID, ignore, just use default setting. 🙂 I guess this is something related to SSID.
APCLI_SUPPORT: AP + CLIENT mode, absolutely need this.
MAC_REPEATER_SUPPORT,CON_WPS_SUPPORT: …emm, not using yet, use default.
LLTD_SUPPORT: it says “Link Layer Topology Discovery Protocol”, link here: https://en.wikipedia.org/wiki/Link_Layer_Topology_Discovery
AIRPLAY_SUPPORT: not use at all.

Fix Totally bricked VoCore2 by another VoCore2

Finally I have a chance to write this tutorial. I want use this blog to show you a simple way to fix a totally bricked VoCore2 or uboot dead VoCore2.

This is the principle, we are using a SPI flash, so we should fix it using SPI interface.

wire 5 is important, that keep bricked vocore2 flash in “dead” status.

connection

Normal VoCore2 ==== Bricked VoCore2
1. +3.3V     ======== +3.3V
2. SPI CS1   ======== SPI CS0
3. SPI MOSI  ======== SPI MOSI
4. SPI MISO  ======== SPI MISO
5. GND       ======== PORST(RESET)
6. SPI CLK   ======== SPI CLK
7. GND       ======== GND

 

You will need the following items to do this:

  1. 1x working VoCore2(Normal VoCore2).
  2. 7x wires.

 

Compile a firmware with second spi flash.
Update ~/openwrt/target/linux/ramips/dts/VOCORE2.dts palmbus section to enable second SPI flash.
A sample of my DTS and compiled firmware: http://vonger.cn/misc/vocore2/vocore2.fixbrick.zip

Upgrade your working VoCore2 with the new firmware.

Connect every wire.

Here is my connection:

DSC02710

If everything correct, you will find the second SPI flash from normal VoCore2 once it boot up:

[    0.280000] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    0.290000] m25p80 spi32766.0: found w25q128, expected en25q64
[    0.300000] m25p80 spi32766.0: w25q128 (16384 Kbytes)
[    0.300000] m25p80 spi32766.0: using chunked io
[    0.310000] 4 ofpart partitions found on MTD device spi32766.0
[    0.320000] Creating 4 MTD partitions on "spi32766.0":
[    0.320000] 0x000000000000-0x000000030000 : "u-boot"
[    0.330000] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.330000] 0x000000040000-0x000000050000 : "factory"
[    0.340000] 0x000000050000-0x000000800000 : "firmware"
[    0.380000] 2 uimage-fw partitions found on MTD device firmware
[    0.380000] 0x000000050000-0x0000001682fe : "kernel"
[    0.390000] 0x0000001682fe-0x000000800000 : "rootfs"
[    0.390000] mtd: device 5 (rootfs) set to be root filesystem
[    0.400000] 1 squashfs-split partitions found on MTD device rootfs
[    0.410000] 0x0000006c0000-0x000000800000 : "rootfs_data"
[    0.420000] m25p80 spi32766.1: found gd25q64, expected en25q64
[    0.420000] m25p80 spi32766.1: gd25q64 (8192 Kbytes)
[    0.430000] m25p80 spi32766.1: using chunked io
[    0.430000] 1 ofpart partitions found on MTD device spi32766.1
[    0.440000] Creating 1 MTD partitions on "spi32766.1":
[    0.440000] 0x000000000000-0x000001000000 : "attached"
[    0.450000] mtd: partition "attached" extends beyond the end of device "spi32766.1" -- size truncated to 0x800000
[    0.470000] ralink_soc_eth 10100000.ethernet: generated random MAC address 3a:20:00:a8:c9:ce
[    0.480000] ralink_soc_eth 10100000.ethernet eth0: ralink at 0xb0100000, irq 5

I rename the second flash to “attached”, yours might slightly different, my second flash is VoCore2 Lite 8MB flash, so it shows “size truncated to 0x800000”, this is not a big issue, just ignore it.

Download flash image from http://vonger.cn/misc/vocore2/ultimate.16m.img, this is for VoCore2(not lite), or you can download and compile uboot from github.com/vonger/, write uboot to it and use uboot to load other data.

Using scp or other file upload tool copy the image to the normal VoCore2 memory(/tmp/).

Now we can call “mtd -e attached write /tmp/ultimate.16m.img attached”, this command is used to erase all data in the bricked VoCore2 flash, and write the new image to it. After this is done, you can disconnect your bricked VoCore2, and connect it to power, it should work normal.

Note: after the flash, your factory setting will be erase too. Before you call mtd erase the flash, first you could call “cp /dev/mtd7 /tmp/mtd7 and download mtd7 to your local disk as a backup of the hole flash, then later you can copy factory setting out of mtd7 from its partition(factory: partition@40000, size 0x10000).

If you find any issue or blocked at any part of the blog, please leave a message in comment, I will fix it in time. 🙂

Update May.20: download the image from vocore.io is not necessary. We can cat /proc/mtd in normal vocore2

dev:    size   erasesize  name
mtd0: 01000000 00010000 "ALL"
mtd1: 00030000 00010000 "Bootloader"
mtd2: 00010000 00010000 "Config"
mtd3: 00010000 00010000 "Factory"
mtd4: 00fb0000 00010000 "firmware"
mtd5: 00e73d2d 00010000 "rootfs"
mtd6: 00c50000 00010000 "rootfs_data"

find “All” is mtd0, this image is working, so we can use “cp /dev/mtd0 /tmp/mtd0”, then use “mtd -e attached write /tmp/mtd0 attached” to clone the flash. At this point, must notify the image size better not exceed the flash size, or might cause boot fail.

VoCore2: Hack the Driver

Current VoCore2 default are using a blob wifi driver from link-it. So it is not very stable sometimes. Recently I just find MTK OPENWRT source code online and find there is an open-sourced wifi driver just in the dl folder, which is tested to be very stable. 🙂 Wahaha, let start the hack!!

Here is the clone of the source:  http://vonger.cn/misc/vocore2/mt7628-p4rev-113862.tar.bz2 (I find it by searching baidu(link here: http://www.openwrtdl.com/wordpress/mt76xx-p4rev%E7%B3%BB%E5%88%97%E4%B8%8B%E8%BD%BD), do not know wether or not ralink intent to public this, if not, please email to support@vocore.io. I will delete it. This source is only for study. )

I will spend hours on this driver everyday, and will show what I find on my blog. :p

Fix VoCore2 LuCI no WPA Issue

WPA

Everything works, just add two lines to file: /usr/lib/lua/luci/model/cbi/admin_network/wifi.lua

+encr:value("psk", translate("WPA PSK"), {mode="ap"}, {mode="sta"})
+encr:value("psk2", translate("WPA2 PSK"), {mode="ap"}, {mode="sta"})

 

Here is the patch:

--- a/usr/lib/lua/luci/model/cbi/admin_network/wifi.lua
+++ b/usr/lib/lua/luci/model/cbi/admin_network/wifi.lua 

@@ -689,6 +689,8 @@
encr:value("none", "No Encryption")
encr:value("wep-open", translate("WEP Open System"), {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"}, {mode="ahdemo"}, {mode="wds"})
encr:value("wep-shared", translate("WEP Shared Key"), {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"}, {mode="ahdemo"}, {mode="wds"})
+encr:value("psk", translate("WPA PSK"), {mode="ap"}, {mode="sta"})
+encr:value("psk2", translate("WPA2 PSK"), {mode="ap"}, {mode="sta"})

if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
local supplicant = fs.access("/usr/sbin/wpa_supplicant")

 

I will add this patch to later firmware at Apr 🙂

Lite: Shipping…

Just in short, we are shipping them 😉

Once it is online(around next Monday), please trace it at bottom of vocore.io by your email.

PoE Version Ready

Finally find the problem, it is simple and stupid, I place an electrolytic capacitor at wrong direction… 🙂

Continue do more test…Hopefully tomorrow I will get good result.

PS: we contacted the factory about the lite version, sadly, they find the sample is not work, reason is simple,  crystal and a capacitor are short circuit, have to delay two days.

VoCore2: Process..

Good news is VoCore2 Lite batch almost done 🙂 The factory will start test them tomorrow,  and we can ship all of them in this month.

Bad news is I get a lot of trouble when develop the PoE version… The heat, the strong EMC all solved but still something wrong.. Just feel like back to the noob time. :'(

I know, you know, everybody knows, as a developer,  we always have couple of days every month — everywhere is a dead end…

Hope this pass soooon…

This is also why I love this job.

can not write anymore…work, work 🙂

VoCore2 Firmware: Compile from Source

How stupid I am… I could do this months ago. Just remove the folder named bin, staging_dir, build_dir, dl, then compress, the source code is small enough to download.

 

1. install Ubuntu 14.04 64bit Server to Virtual Machine.

2. in virtualbox, we will need install some packages to compile openwrt:

sudo apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils subversion libncurses5-dev ncurses-term zlib1g-dev libssl-dev python

3. download openwrt at vonger.cn/misc/vocore2/openwrt.tar.bz2

4. call “tar -jxvf openwrt.tar.bz2” to uncompress the package.

5. call “make menuconfig” in the openwrt folder, configure openwrt in menu, choose MT7688/28/VoCore2 in menu.

6. call “make” in the openwrt folder, start the make process

 

PS: recently I have no word about the lame post carrier…

VoCore2: EAGLE version PCB

Now, we convert the raw PCB file to EAGLE. I guess this should help a lot of people who are using EAGLE 🙂

Source could download here: http://vonger.cn/misc/vocore2/source.zip, in the zip file name is vocore-eagle.pcb.

eagle