Monthly Archives: August 2019

VoCore2: Reset to firstboot by uboot

Currently VoCore2 do not have reset button, so some beginners are hard to reset the firmware once it is bricked by wrong setting…

This new patch of uboot is used to solve that, it is much easier than upload firmware from serial port, but maybe still hard for beginner.

If you want to have a try of the new uboot, please download from vonger.cn/misc/vocore2/uboot128m.20190808.bin (Lite version please use uboot64m.20190808.bin, or it will failed to boot).

You can use exists uboot on vocore, choose 7 to upload new uboot to VoCore2 by serial port(kermit protocol)

To active first boot from uboot, you need to connect I2C_SD pin(GPIO5) to GND then power on your VoCore2. Another way is in uboot menu, press ‘r’, then it will reset firmware automatically, this way need serial port, not that simple like first way.

VoCore2 wifi LED will flash quickly (0.07s/0.1s), means you have entry reset mode, then disconnect I2C_SD pin from GND, the flash speed will slow down(1s/1s), that means we are erasing the NOR flash. Around 3 minutes, it stops flashing, the reset is done.

Here is the patch(modify board.c only), you can download full patch from https://github.com/Vonger/uboot/blob/master/uboot-20190808.patch

How it works?

I2C_SD pin has a pull-up resistor, so we can use it as a ‘button’.

  1. once boot up, uboot will set I2C_SD into GPIO input mode and check its value. If it is 1, means we should boot normally, button is not pressed; if it is 0, means ‘button’ is pressed, we should go to reset mode.
  2. in reset mode, we flash the wifi led quickly to notify user we are ready to reset. Once user disconnect I2C_SD to GND (release the button), we are ready to erase the flash.
  3. We need to keep firmware just reset user data, and user data is in rootfs_data partition. So in order to find the partition position, we have to use a tricky, because rootfs_data is jffs2 disk format, we just need to find its magic code at every 0x10000 bytes. Once we find its start position, we can easily use SPI command to erase the flash rootfs_data.
  4. finally, start linux. It will do rest. 🙂

VoCore2: Support USB 4G LTE

I get a cheap 4G modem recently. Very interesting, my BOM cost of such thing will be over 150CNY(consider mass production 10K), but the provider of the 4G modem sell it only 100CNY and provide 6GB free data usage…

The modem is based on MDM9600 from Qualcomm which is well known since 2012.

PS: now I know the low cost secret 🙂 all recycle chips…kind of environmentalist?

 

Let me explain how to make it work with VoCore2.

Prepare Firmware

First need to add kmod-usb-serial to firmware, old version of vocore2 firmware do not have it inside, you need to recompile your firmware and put the driver inside…it can not be install from opkg update. Or use later than 20190802 version firmware, I have embed it into firmware.

It is in make menuconfig -> Kernel modules -> USB Support -> (* or M)kmod-usb-serial

After this, we can upload the firmware to vocore2 and use opkg install other necessary packages(or you can directly compile them from source)

opkg update
opkg install usb-modeswitch usbutils

Install these packages should be enough, but in order to make it easier, we can also install luci-proto-3g, so we can setup in luci web interface.

Once we plugin the USB 4G modem to vocore2 usb port, new device will show when you call lsusb:

Bus 001 Device 003: ID 05c6:92fe Qualcomm, Inc

This is not the real modem, just a virtual usb disk, we need to use usbmode to switch it into modem mode.

openwrt provided usb-modeswitch can do this, but it do not have my 4G modem USB VID/PID which is 05c6:92fe.

I have to patch /etc/usbmode.json in vocore2. add config to its line 453, right after 05c6:9024

"05c6:92fe": {                                                  
                        "*": {                                                  
                                "t_vendor": 1478,                               
                                "t_product": [ 36901 ],                         
                                "mode": "StandardEject",                        
                                "msg": [  ]                                     
                        }
             },       

PS: just eject the disk then the mode changes…simple.

and then call “usbmode -s”, the USB disk now switch to real LTE modem.

now call lsusb, you will find a new device:

Bus 001 Device 003: ID 05c6:9201 Qualcomm, Inc. Gobi Wireless Modem (QDL mode)

and in /dev/ folder, you will find ttyUSB0, ttyUSB1, ttyUSB2, ttyUSB3.

note: use command comgt -d /dev/ttyUSBx to check which ttyUSB is usable, mine is ttyUSB1

setup usbserial driver to this device:

usbserial is load at startup.

echo "usbserial vendor=0x05c6 product=0x9201" > /etc/modules.d/usb-serial

Or call insmod with parameters.

Now after reboot, it is ready to use.

 

Setup Network

For simple, just use luci, in Network -> Interfaces, click on “Add Interface”

Then “Submit”

note: APN and dial number might be different for different service providers.

Finally, update the firewall:

Then click “Save and Apply”, you can access to internet by 4G now 🙂

 

Or we can do it in a HARD way, do it in console.

add config to /etc/config/network.

config interface 'lte'
   option proto '3g'
   option device '/dev/ttyUSB1'
   option service 'umts'
   option apn '3gnet'
   option dialnumber '*99#'
   option ipv6 'auto'

add config to /etc/config/firewall

config zone
	option name 'wan'
	list network 'wan'
	list network 'wan6'
	list network 'wwan'
	list network 'lte'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'
	option input 'ACCEPT'

manually run to start ppp diag…(I am lazy, did not test this, might not work) or just simply call /etc/init.d/network restart

/usr/sbin/pppd nodetach ipparam lte ifname 3g-lte lcp-echo-interval 1 lcp-echo-failure 5 lcp-echo-adaptiv

after that you can find it in your ifconfig.

3g-lte Link encap:Point-to-Point Protocol
 inet addr:10.14.231.24 P-t-P:10.64.64.64 Mask:255.255.255.255
 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
 RX packets:408 errors:0 dropped:0 overruns:0 frame:0
 TX packets:474 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:3
 RX bytes:148233 (144.7 KiB) TX bytes:79615 (77.7 KiB)

And now you can access internet once connect to VoCore2 hotspot.

 

PS: I find a bug, after reboot, pppd service will start but after around 10 seconds, it disappears. Look like some network process killed it.

Have to change the /etc/config/network, ttyUSB1 change to ttyUSB2(or USB2 to USB1) and restart network after boot up ready.