Monthly Archives: December 2019

VoCore2: install python3

Currently we can directly use python3.6 on VoCore2.
Install python3 is easy, need to download some ipk packages.
I have uploaded them to
Download the ipk files to VoCore2 /tmp folder, call opkg install *.ipk to install.

note: or download from, it should be latest version.

Then in VoCore2 directly call python3 to run it.

VoCore2: develop SPI driver 5

In order to start further hack on MT7628 spi driver, must make the test process clear first.

I am using spidev_test.c in linux kernel for the test.
To compile it,
1. enable spidev in make menuconfig -> Kernel Modules -> SPI Support -> kmod-spi-dev
2. enable spidev_test in make menuconfig -> Utilities -> spidev_test

For firmware part, need to prepare DTS.
add this to openwrt/target/linux/ramips/dts/VOCORE2.dts:&spi0

        spidev@1 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "rohm,dh2228fv";
                reg = <1>;
                spi-max-frequency = <100000000>;

modify one line to enable spi0 cs1 in openwrt/target/linux/ramips/dts/mt7628an.dtsi
note: this should be optional, without it still work for me, because the cs1 register is default set to cs1 already.

-pinctrl-0 = <&spi_pins>;
+pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>;

And we can use this way to add more SPI device by set some GPIO as CS pin. Later I will write a patch for it.

compatible = “rohm,dh2228fv” this line is necessary, without it, kernel will complain…but actually we do not care which type of device is used.
spi-max-frequency = <100000000> this line means max spi we can set upto 100MHz, I do not think its SPI can reach 100MHz. And from my test, 66MHz should be its max speed. Anyway, without DMA, even 10MHz it can not reach.

spi-mt7621.c this spi driver full duplex mode do not allow buffer size more than 16byte, we use half duplex to avoid issue when test, remove it.

static int mt7621_spi_transfer_one_message(struct spi_master *master,
                                           struct spi_message *m)
        struct spi_device *spi = m->spi;
#ifdef CONFIG_SOC_MT7620
      int cs = spi->chip_select;

      if (cs)
              return mt7621_spi_transfer_full_duplex(master, m);
        return mt7621_spi_transfer_half_duplex(master, m);

OK, now we can make the firmware and start to test the origin spi driver.

call “spidev_test -D /dev/spidev0.1 -p 12345678901234567890”, works normal.

VoCore2: Compile on new MacOS SDK issue

Every time when macos update to new version, always broken something, I guess that is an important reason it has very few virus.

When I compile openwrt 18.06.5 in macos, I get new problems.

1. GCC compiler version must greater than 4.8

I have no idea about this issue…it works before, I do not remember I change anything.

brew install gcc@9
ln -s /usr/local/bin/gcc-9 /usr/local/bin/gcc
ln -s /usr/local/bin/g++-9 /usr/local/bin/g++
add /usr/local/bin to $PATH(in ~/.profile), set it at higher level than /usr/bin to cover macos default gcc path.

2. variably modified ‘bytes’ at file scope

I think this is because xcode update change the header file…
in standard C language, array size must be const, a fixed number.

This is not allowed(as I remember this way is allowed in C++?):
const int kAuthorizationExternalFormLength = 32;
int array[kAuthorizationExternalFormLength];

But this is OK:
#define kAuthorizationExternalFormLength 32
int array[kAuthorizationExternalFormLength];


sudo vi /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Headers/Authorization.h

directly change const to #define. Ugly but works 🙂

3. Emm, after a while, cmake can not compile…
rm /usr/local/bin/gcc /usr/local/bin/g++
ln -s /usr/bin/gcc /usr/local/bin/gcc
ln -s /usr/bin/g++ /usr/local/bin/g++

change it back, then works…maybe I should directly patch openwrt Makefile. :’)

Finally I find a better solution
Once 1 passed, we can change it back to gcc 4.2.1 which is macos clang, then everything works normal. so weird.

VoCore2: 3D module

I make a simple 3D module of VoCore2, hopefully this can help more or less. 🙂



VoCore2: WDS (Mesh Network)

Once I want to use AdHoc as mesh network base…but mt7628 driver do not support it.

Now I just find WDS in the menu…it should be a better way to do mesh, I will study into this, must be a lot of fun 🙂
VoCore2 has so many hidden features, from 2014, it is almost five years, I still can not totally master it.

VoCore2: kermit upload tool

I wrote a simple tool to update vocore2 firmware or uboot through serial port, now upload to github.
This tool might still have bugs…use carefully, I only tested it with VoCore2 uboot. 🙂

Usage is very simple:

1. use usb2ttl connect to your vocore2 uart2(TXD2/RXD2)
2. reboot vocore2 (or power up it), it will show a list of uboot.
3. press ‘0’, call uboot upgrade firmware.
4. once VoCore2 uboot console shows “## Ready for binary (kermit) download to 0x80100000 at 115200 bps…”, close console. then use this tool, call “nkermit [your port] [file]”
The port is the TTY port, for example, in windows, it is COM1, COM2, COM4 etc…in macos it is /dev/tty.xxxxxxxxx. File is the file you want to upload, normally VoCore2 upgrade firmware file is named by date, like 20191127.bin.

github link: