VoCore2 USB Screen Part6

Bug fixed. Now it is stable 🙂
Test frame rate again, it is around 20~20.5fps, emm, it does not reach my target 24fps, still have space to optimize.

I send two pictures to the screen in a loop and use my phone record 5 seconds(slow motion), count frame by frame, it is 102 frames.

[embedyt]https://youtu.be/6zqGlMJCh9g[/embedyt]

Next step, write Linux driver and use frame buffer driver.

PS: looks like it is so smoothly from blog 1 to 6, step by step… actually the develop process is so painful and hopeless… I spend over two months full time on this. I had the thought of giving up over thousands times…
I can not go this far without my family’s encouragement.
Finally, the result is so beautiful, can not believe I made this! crying like a baby. T-T

VoCore2 USB Screen Part5

Still picture, 50% chance works.

Moving picture, shit always happens. It is really moving, but it should show static still image.

[embedyt] https://www.youtube.com/watch?v=H_8iSRbW08Q[/embedyt]

PS: I use phone camera recorded 240fps video, and use ffplay count every frame, true 25fps and true 24bit color.

Hopefully I can fix it today. Looks like there are some data corrupt or timing issue. :p

VoCore2 USB Screen Part4

The three days I have made a great process.

Backlight PWM control is working now and the screen can reach at least 24fps. I checked send 144 frames time is 5.8s.

This is a simple code I do the test:
first create three random pictures, and then use libusb bulk mode send it to the screen. Totally 48 loops and every loops send three “true color” pictures. Also a video of the test is attached.

#define FRAMESIZE		((unsigned int)800 * 480 * 3)

...


    buf1 = (unsigned char *)malloc(FRAMESIZE);
    for (i = 0; i < FRAMESIZE; i++)
        buf1[i] = (unsigned char)(rand() & 0xff);
    buf2 = (unsigned char *)malloc(FRAMESIZE);
    for (i = 0; i < FRAMESIZE; i++)
        buf2[i] = (unsigned char)(rand() & 0xff);
    buf3 = (unsigned char *)malloc(FRAMESIZE);
    for (i = 0; i < FRAMESIZE; i++)
        buf3[i] = (unsigned char)(rand() & 0xff);

    for(i = 0; i < 48; i++) {
        // send to out endpoint 2.
        code = libusb_bulk_transfer(handle, 0x02, buf1, FRAMESIZE, &trans, 1000);
        if (code) {
            printf("output endpoint2 error code: %d, %d\n", code, i);
            return code;
        }
        code = libusb_bulk_transfer(handle, 0x02, buf2, FRAMESIZE, &trans, 1000);
        if (code) {
            printf("output endpoint2 error code: %d, %d\n", code, i);
            return code;
        }
        code = libusb_bulk_transfer(handle, 0x02, buf3, FRAMESIZE, &trans, 1000);
        if (code) {
            printf("output endpoint2 error code: %d, %d\n", code, i);
            return code;
        }
    }

The screen is 80% done, I think I can fix rest bugs very soon 🙂

[embedyt]https://youtu.be/zA81GuyK6qY[/embedyt]

VoCore2 USB Screen Part3

It works now but not the backlights.

I have to make the backlight to fixed level to avoid the process delay too much. I was planing to use LCD PWM to control its backlight brightness.

Currently the FPS is very low, around one frame per second, power consume is 200mA.

But this is just the first step. If I am lucky enough and the screen datasheet is showing real parameters, I should get a wonderful result in two or three days 😉

VoCore2 USB Screen Part2

The feeling is very bad…

I find the problem of the back light. It is because I am using screen-chip PWM to control LED brightness. When I send command to the screen, it do not action at all, keep output 0 to the LED power control chip.

Looks like the problem is the screen chip accept my command but ignore the parameters. weird issue, I have worked on this over three days but no way out.

…Emm, maybe I need change another screen and try …

VoCore2 USB Screen Part1

First Merry Christmas! We do not have Christmas but still happy, anyway New Year is coming.

Finally I have chance get back to develop the screen.

PS: this two weeks I am busy on take care of my baby. That should be one of the most hard work in the world.

This is the new board I assemble manually.

Of course it is very small, I like small board 🙂

But today is not my lucky day, nothing works on this board, USB is not working, even the LCD backlight is not working either.

LCD = data + backlight, data from USB, and backlight from onboard boost DCDC powered by 5V.

Hopefully tomorrow once I wake up, the old Santa man have already fixed it.

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.