Author Archives: vonger

VoCore2: Use UBOOT Latest Version

Currently latest version of uboot is working well on VoCore2. But because of the partition is not big enough for all uboot features, we have to do such cut off.

We upload the config to https://github.com/Vonger/vocore2/blob/master/uboot/vocore2_defconfig

Have a try 🙂 https://vonger.cn/misc/vocore2/u-boot-with-spl.bin

1. This is for 192KB partition of uboot, for mainline version you will need to adjust the uboot partition size to 312KB, but that will also need to modify Linux partition DTS file.

This define is in vocore2_defconfig of uboot: CONFIG_MTDPARTS_DEFAULT=”spi0.0:192k(u-boot),64k(env),64k(factory),-(kernel)”

2. uboot will not boot Linux after install, you will need to setup, choose and run one of the following uboot commands.

=fast bootup=========================
setenv bootcmd 'bootm 0xbc050000'
saveenv
reset
=common bootup=========================
setenv bootcmd 'sf probe; sf read ${loadaddr} 0x50000 0x200000; bootm;'
saveenv
reset

Note: it works after setup env, common bootup pretty slow at load firmware, take totally 15s to load Linux then unzip. fast bootup has limit, your compressed kernel can not >4MB

Note: 0xbc000000 is flash map to memory, and first 0x50000 we used for uboot and factory, so start at 0xbc050000

mainline uboot support

Now VoCore2 has mainline uboot available, but need more testing to verify that everything is stable.

if you need it, see below:

before replace uboot ,you need read how to fix dead uboot: https://vonger.cn/?p=8054

flash layout difference of mainline uboot and ralink uboot:

mainline uboot:

ubootuboot-envfactoryfirmware
312k4k4k

uboot from mtk:

ubootuboot-envfactoryfirmware
192k64k64k

mainline uboot’s layout can include more code in uboot, but it not compatible with the mtk’s uboot.

if you need 192k mainline uboot, please use uboot/vocore2_defconfig to compile maineline uboot:

cp path/to/thisrepo/uboot/vocore2_defconfig path/to/mainlineubootsrc/.config

note: before replace uboot, you must ensure your ‘u-boot-with-spl.bin’ size is < 192k

To support mainline of the uboot, also need to modify Linux kernel partition DTS. openwrt/target/linux/ramips/dts/mt7628an_vocore_vocore2.dts

                        partition@0 {
                                label = "u-boot";
                                reg = <0x0 0x4e000>;
                                read-only;
                        };

                        partition@30000 {
                                label = "u-boot-env";
                                reg = <0x30000 0x1000>;
                                read-only;
                        };

                        factory: partition@40000 {
                                label = "factory";
                                reg = <0x40000 0x1000>;
                                read-only;
                        };

PS: before do anything change to your VoCore, better to backup the hole flash to avoid any calibrate data lost.

PayPal locked our account today

PayPal just locked our account this morning, no reason provide and no idea, they required us submit a lot of paperwork to prove our business is real. We have submitted in first time but seems like the review still need three days.

Possible reason: our sales agent is locked at home because of virus and their home network is very slow to login PayPal, so around one week we can not fill trace on PayPal(but we do have trace on our site…)

For recently order, please directly email to sales@vocore.io, so we have to use old way to handle this, email and wire transfer to our company account.

If any other good third party to replace PayPal please suggest. 🙂 Sometimes we are just too lazy to take action but seems like this time we have to move, PayPal is very expansive and not friendly to seller anymore.

PS: at Nov.20, our account is unlocked. But the our stock distinct is locked because of COVID…It is so hard this year. :'(

VoCore2: Boot from memory/USB

Sometimes we need to do some test fast, or test new system like ECOS, so maybe boot from flash is not a good idea, it is slow to write and load. Then maybe good idea is boot from memory.

First, enable ramdisk from openwrt menuconfig, this is default enabled normally.

If not, it is at make menuconfig => Target Images => [*] ramdisk

After setup and compile, you will find openwrt-ramips-mt76x8-vocore_vocore2-initramfs-kernel.bin at openwrt/bin/targets/ramips/mt76x8 folder.

Then we can copy it to a USB disk which formatted in FAT(because default uboot only support this disk format), rename to ram.bin (because FAT might not good at support too long file name)

Plug the usb disk to your VoCore2, and power on it. When uboot menu shows up from UART, press 4 to entry uboot command console. Then call “usb start” to enable usb, “usb storage” to load usb disk, “fatload usb 0:1 0x81000000 ram.bin” to load ram.bin to memory and final “bootm 0x81000000 ” to boot from memory.

PS: if your flash is 32MB or more, need to modify start address.

The log I attach here:

flash manufacture id: ef, device id 40 18                                       
find flash: W25Q128BV                                                           
============================================                                    
Ralink UBoot Version: VOCORE2                                                   
--------------------------------------------                                    
ASIC 7628_MP (Port5<->None)                                                     
DRAM component: 1024 Mbits DDR, width 16                                        
DRAM bus: 16 bit                                                                
Total memory: 128 MBytes                                                        
Flash component: SPI Flash                                                      
Date:Aug  8 2019  Time:16:16:35                                                 
============================================                                    
icache: sets:512, ways:4, linesz:32 ,total:65536                                
dcache: sets:256, ways:4, linesz:32 ,total:32768                                
                                                                                
 ##### The CPU freq = 575 MHZ ####                                              
 estimate memory size =128 Mbytes                                               
RESET MT7628 PHY!!!!!!                                                          
Please choose the operation:                                                    
   0: Load system code then write to Flash via Serial.                          
   1: Load system code to SDRAM via TFTP.                                       
   2: Load system code then write to Flash via TFTP.                            
   3: Boot system code via Flash (default).                                     
   4: Entr boot command line interface.                                         
   5: Load system code then write to Flash via USB Storage.                     
   7: Load Boot Loader code then write to Flash via Serial.                     
   9: Load Boot Loader code then write to Flash via TFTP.                       
   r: Reset firmware to first boot.                                             
                                                                                
You choosed 4                                                                   
                                                                                
 0                                                                              
                                                                                
                                                                                
4: System Enter Boot Command Line Interface.                                    
                                                                                
U-Boot 1.1.3 (Aug  8 2019 - 16:16:35)                                           
MT7628 # usb start                                                              
(Re)start USB...                                                                
USB0:   *********ehci_hcd_init**********                                        
Mediatek/Ralink USB EHCI host init hccr b01c0000 and hcor b01c0010 hc_length 16 
 6. u2phydcr0(0xb0120860)=0x00aaaa02                                            
 FM_OUT value: u4FmOut = 0(0x00000000)                                          
 FM_OUT value: u4FmOut = 149(0x00000095)                                        
 FM detection done! loop = 1                                                    
 SR calibration value u1SrCalVal = 5                                            
                                                                                
                                                                                
Register 1111 NbrPorts 1                                                        
USB EHCI 1.00                                                                   
scanning bus 0 for devices... 2 USB Device(s) found                             
       scanning bus for storage devices... 1 Storage Device(s) found            
MT7628 # usb storage                                                            
  Device 0: Vendor: Generic  Prod.: STORAGE DEVICE   Rev: 0272                  
            Type: Removable Hard Disk                                           
            Capacity: 29862.0 MB = 29.1 GB (61157376 x 512)                                                                    
MT7628 # fatload                                                                
usage: fatload <interface> <dev[:part]> <addr> <filename> [bytes]               
MT7628 # fatload usb 0:1 0x81000000 ram.bin                                     
reading ram.bin                                                                 
...                                                                             
................................................................................
..                                                                              
                                                                                
5420311 bytes read                                                              
MT7628 #                                                                        
MT7628 # bootm 0x81000000                                                       
## Booting image at 81000000 ...                                                
   Image Name:   MIPS OpenWrt Linux-5.4.215                                     
   Image Type:   MIPS Linux Kernel Image (lzma compressed)                      
   Data Size:    5420247 Bytes =  5.2 MB                                        
   Load Address: 80000000                                                       
   Entry Point:  80000000                                                       
   Verifying Checksum ... OK                                                    
   Uncompressing Kernel Image ... OK                                            
No initrd                                                                       
## Transferring control to Linux (at address 80000000) ...                      
[    0.000000] Linux version 5.4.215 (...)
[    0.000000] Board has DDR2                                                   
[    0.000000] Analog PMU set to hw control                                     
[    0.000000] Digital PMU set to hw control                                    
[    0.000000] SoC Type: MediaTek MT7628AN ver:1 eco:2                          
[    0.000000] printk: bootconsole [early0] enabled                             
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)                          
[    0.000000] MIPS: machine is VoCore2                                         
[    0.000000] Initrd not found or empty - disabling initrd                     
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes. 

VoCore2 Super: Combine Ultimate/PoE

This version I planed a long time, but because it is super hard, tried many times all failed. I faced many problems:

  1. PoE voltage is 50V~60V but VoCore2 is only 5V, how to protect VoCore2 from outside noise or unexpect high voltage(like lighting from ethernet)?
  2. PoE heat is pretty much, VoCore2 Ultimate already very small, how to reduce the heat without a fan?
  3. PoE use a lot of parts, include a big cap(electrolytic capacitor), such high voltage cap(100V) we do not have small part as replacement. Also such cap can not stand high temperture or its life time will be reduce a lot. How to place it into so limited space?
  4. We have low speed signal like I2C; high speed signal like USB, SDXC, ethernet; analog signal for sound card headphone output, micphone input and high voltage power input, low voltage power output, how to arrange them into only coin sized space without a war?
  5. Ethernet need transformer which is big; PoE need two diode bridge which is big; Sound card, USB2TTL, POE power convert chip, and their capacitor, all are space eater.

Finally I find a way to make it work 🙂 This is a really adventure. Later blog will explain how I did it.

Screen: Special Command

The screen has some special commands which can be used to control its brightness and flip the screen, but because the command is not compatible for all type of screen, so test it before use it. Here is a reference for use such command.

For fbusb driver, we have a file named command in /sys folder, we can use it to send the command.

# turn off backlight
echo -e '\x00\x51\x02\x00\x00\x00\x00\x00' > `find /sys/devices/platform/ -name command`
# set backlight brightness to max
echo -e '\x00\x51\x02\x00\x00\x00\xff\x00' > `find /sys/devices/platform/ -name command`
# set backlight brightness to 128(half)
echo -e '\x00\x51\x02\x00\x00\x00\x80\x00' > `find /sys/devices/platform/ -name command`

Here is an example of libusb.

#include <stdio.h>
#include <stdlib.h>
#include <memory.h>

#include <libusb-1.0/libusb.h>

static libusb_context *context = NULL;
static libusb_device_handle *handle = NULL;

unsigned char cmd_rotate[] = {0x00, 0x36, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00};
unsigned char cmd_backlight[] = {0x00, 0x51, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00};

int main(int argc, char *argv[])
{   
    if (argc != 3) {
        printf("usage: send_cmd [cmd: m|b] [param]\n");
        printf("example: mirror by axis x,y [0,1,2,3]\n\tsend_cmd m 1\n");
        printf("example: set backlight [0~255]\n\tsend_cmd b 120\n");
        return 0;
    }
    
    libusb_init(&context);
    handle = libusb_open_device_with_vid_pid(context, 0xc872, 0x1004);
    if (handle == NULL) {
        printf("no device.\n");
        return -1;
    }

    libusb_claim_interface(handle, 0);
    libusb_set_interface_alt_setting(handle, 0, 0);
    
    switch (argv[1][0]) {
    case 'm':
        cmd_rotate[6] = atoi(argv[2]);
        libusb_control_transfer(handle, 0x40, 0xb0, 0, 0, cmd_rotate, 8, 100);
        break;
        
    case 'b':
        cmd_backlight[6] = atoi(argv[2]);
        libusb_control_transfer(handle, 0x40, 0xb0, 0, 0, cmd_backlight, 8, 100);
        break;
        
    default:
        printf("command is not supported.");
        break;
    }
        
    libusb_release_interface(handle, 0);
    libusb_close(handle);
    libusb_exit(context);
    return 0;
}

Also please check https://vocore.io/screen.html, the v2scrctl source code for libusb.

Screen: I2C to Drive RGB LEDs

Currently our V7B board has I2C interface exported, and actually we can control it through USB port.

Note: This I2C mainly is used for upgrade firmware on the usb bus, so it might be risk to use, if you send wrong data to it, it might broken firmware.

Here is the I2C API, only three commands:

#define CMD_SCREEN_I2C          0xb5
#define CMD_SCREEN_I2C_WR 0xb6
#define CMD_SCREEN_I2C_RD 0xb7

0xb5 [i2c address 1byte] [write size 1byte] [read size 1byte] [write data …] this is used to tell i2c bus how many data we will write and how many data we will read then follows the data we will write to i2c, that data will save to a buffer.

0xb6 [i2c address 1byte] this is used to trigger write, send address to it then I2C will write data from its buffer to external device.

0xb7 this is used to read the data from device i2c, it will return the required data bytes(0xb5 read size) max one time can send/receive 58 – 5 = 53bytes, so for data better not to exceed 53 bytes.

Here is the example of writing data to I2C EEPROM, BLOCK_SIZE = 16.

        if (load_from_file(argv[2], buf, 0x2000) < 0) {
            printf("no firmware file.\n");
            return -1;
        }
        
        for (pos = 0; pos < 0x2000; pos += BLOCK_SIZE) {
            cmd[0] = EEPROM_ADDR;    // I2C address
            cmd[1] = BLOCK_SIZE + 2; // write 18 bytes for register address 2byte and data 16byte.
            cmd[2] = 0;              // read zero byte, no read for i2c write.
            cmd[3] = pos >> 8;       // write first byte, register address 
            cmd[4] = pos;            // write second byte, register address
            // put rest data to the buffer.
            memcpy(cmd + 5, buf + pos, BLOCK_SIZE);
            // send i2c command head to screen, require control the i2c bus.
            ret = libusb_control_transfer(handle, 0x40, CMD_SCREEN_I2C, 0, 0, cmd, BLOCK_SIZE + 5, 200);
            // write register address and data to i2c bus.
            ret = libusb_control_transfer(handle, 0xc0, CMD_SCREEN_I2C_WR, 0, 0, cmd, 1, 200);
            
            if (pos % 0x100 == 0) {
                printf(".");
                fflush(stdout);
            }
        }

Here is the example of reading data from I2C EEPROM

        for (pos = 0; pos < 0x2000; pos += BLOCK_SIZE) {
            cmd[0] = EEPROM_ADDR; // I2C address
            cmd[1] = 2;           // write two bytes for register address.
            cmd[2] = BLOCK_SIZE;  // read 16 bytes
            cmd[3] = pos >> 8;    // write data first byte
            cmd[4] = pos;         // write data second byte
            
            ret = libusb_control_transfer(handle, 0x40, CMD_SCREEN_I2C, 0, 0, cmd, 5, 200);
            // write register address to i2c bus.
            ret = libusb_control_transfer(handle, 0xc0, CMD_SCREEN_I2C_WR, 0, 0, cmd, 1, 200);
            // read data from i2c bus.
            ret = libusb_control_transfer(handle, 0xc0, CMD_SCREEN_I2C_RD, 0, 0, cmd, BLOCK_SIZE + 1, 200);
            
            memcpy(buf + pos, cmd + 1, BLOCK_SIZE);
            if (pos % 0x100 == 0) {
                printf(".");
                fflush(stdout);
            }
        }

With this I2C interface, we can easy control RGB LED driver chip like AW9523 and other chips. Then it will save a lot of cost make customized board, do not need arduino and USBhub chip anymore.

To be continue…

Screen: 7inch ready

After months hard work, the 7inch(6.8in exactly) screen is ready in time. 🙂

This screen is pretty special, because the screen main design target is for real car but not like our current 4inch/5inch screen for consumer usage. So it can stand even worse environment like hot area over 65C.

Here is its shape:

Screen: 5inch upgrade

New 5inch screen comes, old version will keep production for a while for compatible, but later we consider move to new version.

New screen(D500FPC9373-C) we have four improvements.

  1. stronger border, this is in order to provide better protection of the screen.
  2. increase backlight brightness.
  3. better color for display.
  4. better supply, old version screen driver chip is pretty shortage.

Also these improvements caused shape adjust. The display screen thickness increased 0.2mm, and border is wider 0.2mm. Touch screen and display area still same size.

PS: new screen currently only test with our screen_test and SimHub, rest application might not compatible, need to upgrade. For non-developer, recommend to keep using the old stable version to avoid any mystery problem.

Why shitty like PayPal still exists?!

This happens more than one time. I think we have already stand enough to use PayPal and need to find an alter one asap. It is too risk to use it for online shop.

Case is like this: some people go to our store and purchase something, suddenly they think they buy wrong items. And did not email us but open a disputes case and ask for refund. All in 5 minutes.

Once case is open, whatever we reply or we do not reply, it will be automaticlly submit and of course, buyer’s favor.

I really understand and willing to refund people for mistake buying from our store, but why the paypal charge us 8USD for dispute fee?! It is terrible.


I think move our store to aliexpress.com and use alipay is the only choice…

Screen: hand solder driver board to customized board

Some DIYers complained it is pretty hard for hand solder the small screen driver board on their designed board. So I find a way for them easier hand solder screen driver board to their board.

On the screen driver board bottom, we have some test points which is used for test at production also for SMT the board to other customized board. It is not designed for hand solder. We need some tricky for hand solder.

We can design like this, add a oval hole on the PCB, size should be enough for the thin iron

Then we can directly solder through the hole to the pads. This way we do not need use pins or other connectors, low cost and simple. 🙂

Attach the position of the pads(KiCAD), one note is they are on the bottom side.

For mass production, I still recommend directly use SMT machine solder it. :p