Archive

Posts Tagged ‘tutorial’

Power Consumption of Amlogic S812 and Rockchip RK3288 TV Boxes

February 17th, 2015 6 comments

The recent post comparing the power consumption of ODROID-C1 vs Raspberry Pi boards, as made me want to give another try at power consumption measurements. Regular reader already know I made a power measurement board and cables capable of hading different connectors (micro USB, mini USB, power barrels,  etc..), but eventually it failed to deliver enough current to the boards for any meaning testing. But since I now have a better power supply, and multi-meter, it was worth another try, especially since I could draw some pretty charts.

I decided to test the three most popular Chinese SoCs for mini PCs namely Amlogic S812 (4x Cortex A9), Rockchip RK3288 (4x Cortex A17), and Allwinner A80 (4x Cortex A15 + 4x Cortex A7) using respectively Eny M8S, Open Hour Chameleon, and A80 OptimusBoard. If you are paying attention, you must have noticed Allwinner A80 is not part of the title, that because the board got stuck in the animation logo drawing 1.1 to 1.3 A forever, so I don’t have any results to share for that platforms. Neverthess I still have some interesting charts for the two other platforms, but before sharing the results, let’s go through my setup and some of the issues I encountered.

Power Measurement Testbed

That’s what my setup looks like.

Testbed to Measure Current (Click to Enlarge)

Testbed to Measure Current (Click to Enlarge)

From left to right:

  1. 5V/8A – 12V5A Switch mode power supply (SMPS)
  2. DIY power measurement board and multimeter test leads
  3. Device under test, in this case Open Hour Chameleon
  4. UNI-T UT61E digital multi-meter
  5. Windows XP netbook with UT61E Interface Software and a USB to RS-232 dongle

Initially, I wanted to use Sigrok in Ubuntu 14.04, as it’s more convenient for me simply because I use Ubuntu on my main computer, but unfortunately there are some compatibility issues with my USB to RS232 dongle leading to the error message:

sr: es51922: Invalid function byte

I bought another different looking one on Ebay, but unfortunately it came with the exact same PID and VID, leading to the same issues, and it did not even work with the multimeter in Windows… So I had to fall back to using Windows.

The first time I had the exact same problem as with my $7 multimeter with the device rebooting as soon as 400 mA was reached. The critical issue when measuring current is the impedance of the equipment of the multimeter itself, and any board or cable used for testing. Since the multimeter is in series, even adding 1 Ohm would lead to a voltage drop of 1V at 1 ampere (ohm’s law U=RxI). The multimeter itself will make the voltage drop a bit, as I understand it measures the current using a low impedance resistor, but first I checked my cables.

  • Test lead pair #1 – ~0.15 to 0.30 Ohm but measurement fluctuates a lot even to pretty high values (That’s the pair included with UNI-T UT61E DMM)
  • Test lead pair #2 – ~0.13 to 0.15 Ohm
  • Crocodile clip cables – 0.90 Ohm

At first, I thought it would be a good idea to connect the test leads to the measurement board via crocodile clip in order to get a good connection. But I  measure the impedance of two such cables in series to be 1.80 Ohm, and shorting the measurement board with two of these, could not boot the board at all due to voltage drop (1.8 * 0.4 = 0.72V).

So I got rid of those, connecting the test leads (pair #2) directly to the measurement board, and it went better, but I noticed the screen would turn off from time to time. I also decided to calibrate my SMPS to 5V (it was 5.25), and the symptoms became more frequent, so I measured the voltage right after UNI-T multimeter with my older multimeter, and noticed voltage drops of up to 0.5V at times due to the impedance introduced by the DMM and cables, which led to reboots. So I turned the voltage adjustment screw on the power supply to output 5.4V, which should be safe enough, and everything worked much better, at least with the Amlogic S812 device.

The test procedure goes as follows:

  • Power the board, and wait for boot to complete
  • Run Antutu benchmark
  • Connect an external hard drive via a USB port
  • Run XBMC/Kodi/SPMC and play a 4K H.264 videos (Chimei video).
  • Go to standby

I gather the data with the windows software, and load the results into LibreOffice Calc to generate the power consumption charts with sample numbers on the X axis, and the values in Amperes on the Y-Axis. 2 samples are taken every second, so a 900 sample test duration is 450 seconds (7 minutes 30 seconds).

Eny M8S (Amlogic S812) Power Measurement

Eny M8S Power Consumption Chart (Click to Enlarge)

Eny M8S Power Consumption Chart (Click to Enlarge)
Vertical Axis: Amps; Horizontal Axis: Sample number (every 0.5 second)

The fully test went very smooth on the Amlogic platform, as I never had the screen turn off during testing. The part of Antutu that consumes the most is the 3D GPU benchmark at around 1.4A. We can see a jump of 0.5A when inserting the hard drive. XBMC consumes some power even in the UI, because it’s always refreshing the display, so the power consumption is somewhat similar to the 2D GPU benchmark in Antutu. Playing a 4K video consumes a little over 1A, and it’s normally not to demanding as it’s mostly handled by hardware. Standby mode power consumption is pretty high at about 500 mA with the hard drive connected, and still powered on in this mode.

Open Hour Chameleon (Rockchip RK3288) Power Measurement

Open Hour Chameleon Power Consumption Chart (Click to Enlarge)

Open Hour Chameleon Power Consumption Chart (Click to Enlarge)
Vertical Axis: Amps; Horizontal Axis: Sample number (every 0.5 second)

I had a few more problems with Open Hour Chameleon, as the HDMI signal would turn off from time to time including during multi-threaded floating point benchmark, 3D GPU benchmark, and playing a 4K video. At the end of the video playback, I completely lost video output, and even after removing the hard drive I could not access the UI, so I just press the power button on the remote and it went into standby. The value on the chart above is about 350 mA, but had I waited a few more seconds before stopping measurements it would have dropped to 100 mA.

3D GPU is not the most power hungry task on Rockchip RK3288, as the crown goes to multi-threaded floating-point benchmark consuming close to 2A. I did not play the 4K video from the hard drive, because the screen would go black so often, so instead  I played it from the network (SAMBA share), which should explain why the power consumption of this part is lower on RK3288 than on S812. Mali-T764 GPU power consumption in RK3288 also seems a bit lower compared to the one of Mali-450MP6 GPU found in Amlogic S812.

The “cut-off” current (where I lose video output) on RK3288 seemed to be around 1.3A, while I had no problem even at 1.4A on M8S, which must be because boards are different tolerances with regards to the minimum input voltage.

Since I did not play the video from the hard drive, the test are not really identical for both platforms, but for reference the average amperage on Open Hour Chameleon was 880 mA, while M8S averaged 811 mA.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

How To Install Ubuntu 15.04 on MeLE PCG03 Intel Mini PC

February 13th, 2015 23 comments

I’ve already spent some time to test MeLE PCG03 Bay Trail-T mini PC in Windows 8.1, including a detailed video and audio review in Kodi 14.1. Since I don’t have anything else to do with Windows on the machine, I’ve decided to install Ubuntu instead, completely wiping out Windows 8.1. Since you pay around $30 for the Windows license, MeLE PCG03 is not the ideal platform computer for this little exercise due to the extra cost, but it should also work with other Intel Atom Z3735F based computer that may not come with a license.

Lubuntu 15.04 on MeLE PCG03 (Click for Original Size)

Lubuntu 15.04 on MeLE PCG03 (Click for Original Size)

At first I planed to go with Ubuntu 14.10 Mate ISO image, and it boots fine, but was curious to try from “scratch” with another ISO, so I went with Ubuntu 15.04 Alpha 2 (64-bit) image. I just went to the first link Google Search provided me and did not pay attention enough, and ended-up install Lubuntu instead, but you should be able to use any Linux AMD64 ISO with the instructions below.

The first step is to create a bootable USB flash drive.

So after downloading vivid-desktop-amd64.iso with BitTorrent, I started a Windows 7 virtual machine (but I could have done it directly in MeLE PCG03 instead), downloaded and install Rufus (Rufus 1.4.22), and create a bootable USB flash drive with the following options:

  • GPT partition scheme for UEFI computer
  • FAT32 with 32KB cluster (Other insructions recommend 64KB, but it was not available in the drop list).
  • LIVECD label (maybe not important) and vivid-desktop-amd64.iso image

Rufus_Ubuntu_Bay_TrailMake sure Rufus has selected the right Device, and click on “Start”.

Once this is done, you’ll need to download bootia32.efi, and copy it in /EFI/BOOT folder in the USB flash drive.

Now connect the USB flash to your MeLE PCG03 or other Intel Bay Trail-T device, power the device, press F7 to get to the UEFI menu, and select your USB flash drive in order to boot into Ubuntu 15.04.

If all you want to do is try Ubuntu (or the other Linux 64-bit ISO image you’ve selected), you are done.

But let’s install it instead. MeLE provided with instructions to re-install Windows on PCG03, but when I asked for the firmware files, they kept quiet…, so you may want to backup your Windows installation first.

There are three partitions:

sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 29.1 GiB, 31268536320 bytes, 61071360 sectors
 Units: sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disklabel type: gpt
 Disk identifier: 8665F60E-4024-4C68-9E4E-57DCF3C2278F

Device          Start      End  Sectors  Size Type
 /dev/mmcblk0p1   2048   616447   614400  300M Microsoft basic data
 /dev/mmcblk0p2 616448   821247   204800  100M EFI System
 /dev/mmcblk0p3 821248 61069311 60248064 28.7G Microsoft basic data

Which I backed up as follows:

sudo apt-get install pv
sudo dd if=/dev/mmcblk0p1 | pv | dd of=WIN_P1.img bs=16M
sudo dd if=/dev/mmcblk0p2 | pv | dd of=WIN_P2.img bs=16M
sudo dd if=/dev/mmcblk0p3 | pv | dd of=WIN_P3.img bs=16M

But it might be a better idea to just get a single file:

sudo dd if=/dev/mmcblk0 | pv | dd of=WIN_MELEPCG03.img bs=16M

That way in case you want to re-flash Windows, start Linux from the USB flash drive, and re-install it with:

sudo dd if=WIN_MELEPCG03.img | pv | sudo dd of=/dev/mmcblk0 bs=16M

So you won’t need to potentially have to re-partition the eMMC flash with gparted, as would be the case for a separate backup file for each partition.

I’ve then re-partitioned the eMMC flash to format p3 as ext-4 and add a fourth partition for a 2GB swap, which may not be ideal on flash based device due to wear and tear:

sudo gparted /dev/mmcblk0

MeLE_PCG03_Ubuntu_PartitionsNow click on Install Lubuntu 15.04, and follow the instructions until they ask about the installation type (erase everything, install side-by-side..), where you need to select “Something Else”, and set:

  1. /dev/mmcblk0p3 to ext4 mount to /
  2. /dev/mmcblk0p4 to swap
  3. I’ve also changed “Device for boot loader installation” to /dev/mmcblk0p2, but it might not be necessary to change that part.
Click to Enlarge

Click to Enlarge

Carry on with the installation. Once it’s complete, you’ll still need to boot from USB one more time in order to install the 32-bit version of grub. Reboot, press F7, select your USB drive, and once you are in Grub (showing Ubuntu, Advanced options for Ubuntu, Windows Boot Manager, System setup), press ‘c’ to enter the grub terminal, and type the following commands in order to load the kernel and initramfs, and boot from the internal flash:

linux (hd1,gpt3)/boot/vmlinuz-3.18.0-13-generic root=/dev/mmcblk0p3
initrd (hd1,gpt3)/boot/initrd-3.18.0-13-generic
boot

The exact command will depend on your device and chosen linux distribution, but since grub support auto-completion it’s quite easy. For type “linux (hd”, and press tab to select the right drive and partition, then “/boot/vm”, and press tab again to select the right kernel, and so on.

Login into Ubuntu with the username / password you selected during installation, make sure you’ve connected an Ethernet cable,. and install 32-bit grub with efi support:

sudo apt-get install grub-efi-ia32 grub-efi-ia32-bin
sudo cp /boot/efi/EFI/ubuntu/grubia32.efi /boot/efi/EFI/ubuntu/grubx64.efi
sudo update-grub2

And now you’re done… Depending on your platform, you may also need to check your BIOS settings to make sure Secure Boot is disabled, and in my case at the beginning I had either a black screen (Ubuntu) or just the two lines (Advanced options for Ubuntu):

Loading Linux 3.18.0.13-generic....
Loading initial ramdisk...

So I went to the BIOS in Advanced->Security Configuration, and disabled Intel TXE, which seems to have made the trick.

Intel_TXE_BIOSBoot time takes about 12 seconds from the time I press enter in grub to the login screen.

I haven’t tested it much for now, except from some web browsing, and playing YouTube in Firefox (very slow), but before doing my deeply into testing, I’d like to find out a way to enable audio on the platform, at least via the 3.5mm headphone jack, as HDMI audio may be more complicated. A workaround tried by other people is to use a USB sound card. Here’s the full boot log where you’ll see that the audio chipset (ALC5640) is detected, but the driver (byt-rt5640) fails to initialize it.

I adapted instructions from the three sources below:

  1. Linuxium triple boot method (Android, Windows, Linux) on MeegoPad T01.
  2. Ubuntu on Bay Trail tablets.
  3. Installing Ubuntu on Asus T100’s internal flash
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Install Ubuntu 14.10 on MeegoPad T01 with a Live ISO Image

January 19th, 2015 5 comments

MeegoPad T01 has recently been shown to boot Ubuntu and Android, but no installation disk had been provided so far. But thanks to deadhp1, there’s now a “beta” Ubuntu 14.10 image with MATE desktop environment available for download in order to try or install Ubuntu on MeegoPad T01, and other Intel Atom Bay Trail-T devices.

Ubuntu MATE 14.10 Live ISO (Click to Enlarge)

Ubuntu MATE 14.10 Live ISO (Click to Enlarge)

Before you decide to try or install the image, be aware that audio and Bluetooth are not working for now, but everything else should work, including hardware video decoding in Kodi. If your device is not using a Realtek rtl8723bs module, Wi-Fi won’t work, and you may need to use a USB Ethernet dongle to get IP connectivity. The instructions will keep your Windows 8.1 installation too, albeit I suppose you could also wipe out the Windows 8.1 partition completely and run Ubuntu only on the device. If the instructions are not followed carefully, you may brick your mini PC / HDMI Stick.

So if you’d still like to go ahead, you can download ubuntu_mate_1410_baytrail_hybrid_efi_test_17.iso, and burn the image to a USB flash drive using Rufus or  Unetbootin. Then insert the USB flash drive into your Bay Trail mini PC, turn it on, and press the F7 key to select boot. Your system should now be running Ubuntu from the USB flash drive (Username and password are both baytrail). So far, the procedure should be 100% safe.

If you want to install the image to the internal storage, and keep Windows too. You’ll first need to modify the partitions with Gparted first, then click on Applications->System Tools->Systemback to install Ubuntu. You can follow the instructions in the video made by deadhp1 to re-partition your system, and install Ubuntu MATE 14.10 to the eMMC flash. One very important point is:do NOT format your EFI partition (on meegopad-t01 /dev/mmcblk0p1), or you will lose your ability to boot if you do. Make sure to uncheck the format box.”

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Downloading Files on Baidu, or via HTTP, Bittorrent or Metalink in Linux with BaiduExporter, Aria2 and YAAW

January 14th, 2015 4 comments

Most firmware files distributed by the manufacturers are uploaded to Baidu, but I’ve found the service not to be always reliable, especially for larger files. In Windows, people are recommended to use Baidu software (BaiduYunGuanjia), but there’s not such tool in Linux, so instead I investigate for command lines tools to download files from Baidu, and this lead me to two interesting tools called Aria2, a “lightweight multi-protocol & multi-source command-line download utility. It supports HTTP/HTTPS, FTP, BitTorrent and Metalink”, and YAAW “Yet Another Aria2 Web Frontend” with allow to start and monitor download locally or remotely.

But let’s start with the first tool I found: pan-baidu-download, a Python script to download files from Baidu.

To install it:

git clone https://github.com/banbanchs/pan-baidu-download.git
cd pan-baidu-download

We also need to install some dependencies (assuming python 2.7.x is already installed):

sudo apt-get install python-pip aria2

and then you can start downloading files as follows:

./python bddown_cli.py download http://pan.baidu.com/s/somerandomcharacters

But after posting a bug about password-protected download, which was fixed in 2 minutes by the developers, I was informed the script does not support directories, and was recommended to use BaiduExporter add-on for Chrome or Firefox instead.

Everything is in Chinese, and after installing the add-on I was not clear how to use it but I figured it out eventually.

First you need to run aria2c:

aria2c --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all

01/14 11:01:42 [NOTICE] IPv4 RPC: listening on TCP port 6800

01/14 11:01:42 [NOTICE] IPv6 RPC: listening on TCP port 6800

The command line above is insecure if you plan to run it on a remote server, as anybody could access it, and start download on your server.  But for testing, and local download this will do. If you stop aria2c, the downloads won’t restart with this command, but there are options that support this, but again, I have not looked into details for this quick test.

Now go to the Baidu download link, select the files and/or folders you want to download, and provided you’ll already installed Baidu Exporter add-on, a new menu will be shown, and all you have to do is click on ARIA2 RPC to start the download in aria2. The last options with two Chinese ideogram is the option, where you can change the IP of the aria2 server (localhost:6800) by default as well as other settings.

BaiduExporter_Firefox

Baidu Download with BaiduExporter in Firefox (Click to Enlarge)

You can now close the Baidu window in your web browser. and should see the download as started in the terminal:

aria2c --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all
01/14 11:01:42 [NOTICE] IPv4 RPC: listening on TCP port 6800
01/14 11:01:42 [NOTICE] IPv6 RPC: listening on TCP port 6800
 *** Download Progress Summary as of Wed Jan 14 11:07:30 2015 ***
 ===============================================================================
 [#af540e 0B/0B CN:1 DL:0B]
 FILE: /media/hdd/edev/sandbox/yaaw/binux-yaaw-ab09f92/update1201-android/update.zip

This is all good, but in practise you’d probably want start aria2c when your computer boots and would not be able to monitor progress, especially if you use a remote server, and this is where YAAW comes into play.

To install it, check out the code from Github or download and extract the tar file. Now go to the directoty where you extract the file. and open index.html with your web browser. You can monitor download, or even add HTTP or Bittorrent Downloads. AFAIK, you can’t add Baidu links to YAAW directly, but you can monitor the downloads added via Baidu Exporter

Baidu and Bittorrent Downloads in YAAW

Baidu and Bittorrent Downloads in YAAW

The aria2c IP address and port can be changed in the settings directly from the main page. Some useful tips for YAAW:

  • All your settings on web is temporary. Settings will be lost after aria2 restarted.
  • Tasks (including those that are not finished) will be lost after aria2 is restarted. Use --save-session=SOME/WHERE and reload with --continue=true --input-file=SOME/WHERE to continue.
  • Use $HOME/.aria2/aria2.conf to save your options.

I haven’t gone into details, but Aria2 and YAAW could be used with a NAS, a cheap board with a USB harddrive, or even USB Wireless flash drive such a Zsun SD111 (which is now hackable even without serial debug board, as the default root password has just been cracked) to make a downloader to handle large downloads instead of leaving your PC on at night, or 24/7.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

How to Upgrade Firmware in HiSilicon Hi3798M TV Boxes

January 13th, 2015 5 comments
HiSilicon based Android TV boxes are not that popular, at least outside of China, but I’ve got one with BFS 4KH featuring HiSilicon Hi3798M processor, and since we could not fix AC3 audio decoding after a factory reset in the firmware I have, the company provided me with a new firmware, and I’ll document the procedure I followed below.
  1. Download the firmware, the file should be update.zip. For BFS 4KH, I could get it @ http://pan.baidu.com/s/1kTrCcMr (password: xpef). It includes YouTube and Google Play, but not the Rainbow launcher, nor XBMC, but these can be side-loaded.
  2. Now copy update.zip on the root of a USB flash drive formatted with FAT32, and at least 1GB free storage.
  3. Connect the USB flash to the USB 2.0 port of the device, as the USB 3.0 port can’t be used for firmware upgrade.
  4. In the current firmware, go to Settings->System->Local Update, and select the drive letter for the USB drive (e.g. D), and you should be prompted with a window asking you want to go ahead with the upgrade.
    hisilicon_firmware_upgrade
  5. The box will then reboot, show the usual Android upgrade animation, and reboot automatically in the new firmware.
  6. Done

Overall the procedure is very similar what is done on Amlogic devices.

Now the test firmware I received did not include XBMC, nor the necessary codec. So I installed XBMC for HiSilicon (password: amaw) and MXPlayerCodec (works with BFS 4KH only), and I could run XBMC, and downmixed audio worked with AC3, and some other Dolby and DTS codec.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Easily Create an Android Bootable SD Card for Allwinner A80 Devices with PhoenixCard Tool

January 6th, 2015 1 comment

We’ve already seen how it was possible to boot Linux or Android on Rockchip RK3288 devices from an SD card, which involved getting the stock firmware and running some scripts in Linux. Today, Freaktab member no_spam_for_me found out how to create a bootable SD card for Tronsmart Draco AW80 Meta, and other Allwinner A80 devices using PhoenixCard 3.09 tools for Windows (The latest version should be available @ http://dl.cubieboard.org/model/cc-a80/Tools/Flash-firmware-tools/). There may also be a way to use LiveSuit tools for Linux, but this have not been tested.

PhoenixCard_3.09_SD_Card

Once you have installed the tools, start it, and  load the firmware by clicking on “Img File” button (Here Draco AW80 Finless 1.1 firmware was used). Then press DiskCheck to scan for storage devices, and select your SD card in the drop-down menu “disk” (not sure why it’s blank in the screenshot above), select “Startup !” write mode, and click on the “Burn” button.

Once it’s done, just insert the SD card into your Allwinner A80 device, power it your device and it should boot from SD card. The first boot is quite slow, allegedly because the system converts the FAT32 file system to EXT-3, but subsequent boots are relatively fast (one minute or so) depending on the SD card.

Draco_AW80_Meta_32_GB_SD_CardThe screenshot above have been taken in Draco AW80 Meta (with 16GB eMMC) booted from a 32GB SD card.  So booting from SD card is nice to get more storage, and trying out firmware before flashing a new one as it does not affect your current installation. Just make sure you use a fast SD card (Class 10 or greater) or the system may feel very slow.

This method should also work for other Allwinner processors (A31, A20, etc…). It looks like it might only work for Android firmware, and not Linux based distributions like Ubuntu/Lubuntu (TBC).

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

How to Take Screenshots and Record Videos in Android mini PCs without Root Access

January 6th, 2015 No comments

I’ve started to test BFS 4KH Android TB box featuring HiSilicon HI3798M processor. I’m also the first things I normally do is to check for built-in screenshot support, and if not, I simply install a screenshot app like Screenshot Ultimate. This normally works pretty well, but the firmware is not rooted, and the usual root method for HiSilicon devices does not work, as it fails at the adb root stage with the message: “aabd cannot run as root in production builds”. So I was out of luck, and people who sent the sample for review do not seem to check / answer their email in a timely manner. ScreenShot Ultimate provides “No Capture Method Help“, but I found the instructions long, and it required me to install download and install something extra. So instead I check if I could do something with adb instead.

adb can connect via USB or Wi-Fi, and for most device you’ll have a USB OTG port to connect it to your computer. If developers options are not enabled in Android Settings, go to “About Device”, and click on the build number of 7 times. You should now be able to go to “Developers Options”, and enable USB debugging, something I had to do even though I had to use Wi-Fi since my box does not come with a USB OTG port.

You’ll also need to install adb. In Linux, at least Ubuntu / Debian, it’s easy to install, and I already had this:

sudo apt-get install android-tools-adb

For other OS, you may need to install the Android SDK.

If you are using USB, the setup is done. If you need to use Wi-Fi instead, you’ll need to find your Ethernet or Wi-Fi IP address. After enabling USB debugging, port 5555 should be open:

sudo nmap -sS 192.168.0.107

Starting Nmap 6.40 ( http://nmap.org ) at 2015-01-06 12:19 ICT
Nmap scan report for 192.168.0.107
Host is up (0.045s latency).
Not shown: 988 closed ports
PORT      STATE SERVICE
139/tcp   open  netbios-ssn
445/tcp   open  microsoft-ds
5555/tcp  open  freeciv
7100/tcp  open  font-service
7777/tcp  open  cbt
8888/tcp  open  sun-answerbook
10000/tcp open  snet-sensor-mgmt
49152/tcp open  unknown
49153/tcp open  unknown
49154/tcp open  unknown
49155/tcp open  unknown
50006/tcp open  unknown
MAC Address: 00:11:22:36:45:C9 (Cimsys)

Nmap done: 1 IP address (1 host up) scanned in 19.21 seconds

and try to connection with adb.

adb connect ip_adress

The rest of the instructions are the same whether you connect via USB or Wi-Fi, For a screenshot, I followed the instructions here to capture an image in a single command:

adb shell screencap -p | sed 's/\r$//' > screen.png

The sed part is to get rid of the end of line character sent via adb. The image can be found in your PC as screen.png. In my case, the image capture and transfer over Wi-Fi is a little slow, as it usually take around 5 seconds. But at least it works, and it’s even more convenient than using a Screenshot app, at least for my use case.

Scrrenshot Taken with adb (Click for Original Size)

Scrrenshot Taken with adb (Click for Original Size)

While I was at it, I also checked about screen recording, and found some instructions on CNET which should work for Android 4.4 and greater.. Basically, you just have to run:

adb shell screenrecord /sdcard/video.mp4

I have not tried to use the redirection as with screencap command line, because I believe it would have been too slow. So once you are done with recording, press Ctrl+C, get back the video to your PC and optionally delete it on the device to reclaim storage space.

adb pull /sdcard/video.mp4
adb shell rm /sdcard/video.mp4

That’s the result I got.

No too bad. At first, I thought “Hey, it might be possible to record online video that way!”, but a closer inspection of the file property quickly changed my mind.

adb_video_property

It recorded at 12 frames per second (maybe a limitation of the hardware), and more importantly there’s no audio, so even if you could record a video at a decent framerate, you’d still have to record audio separately, and mix video and audio at a latter stage, not the most convenient way….

More options for screenrecord command can be found on Android Developers’ ADB page, or by running:

adb shell screenrecord --help
Usage: screenrecord [options] <filename>

Records the device's display to a .mp4 file.

Options:
--size WIDTHxHEIGHT
    Set the video size, e.g. "1280x720".  Default is the device's main
    display resolution (if supported), 1280x720 if not.  For best results,
    use a size supported by the AVC encoder.
--bit-rate RATE
    Set the video bit rate, in megabits per second.  Default 4Mbps.
--time-limit TIME
    Set the maximum recording time, in seconds.  Default / maximum is 180.
--rotate
    Rotate the output 90 degrees.
--verbose
    Display interesting information on stdout.
--help
    Show this message.

Recording continues until Ctrl-C is hit or the time limit is reached.
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

CubieTruck Metal Case Kit Getting Started Guide and Review

December 21st, 2014 4 comments

I’ve received CubieTruck Metal Case kit just over a month ago, but just like for Ubuntu on ODROID-XU3 Lite, the board could not get HDMI EDID info from my Panasonic TV, which led to a crash at boot time. CubieTech has now fixed the issue, so I’ve finally been able to complete the review with Cubieez (Cubie Easy) distribution, pre-installed on the board, and based on Debian 7.6. You can get the full hardware specs on my previous post, but the kits is comprised of four parts: CubieTruck development based on Allwinner A20 dual core processor, a rugged metallic enclosure, a 128GB SSD, and a 5,300 mAh battery acting as a UPS. I’ll start by showing how to setup the board, test SATA and Gigabit Ethernet performance,  check if the battery acts as expected, try to use the board as a desktop replacement with LibreOffice, Chromium, and so on, and run Phoronix Benchmark. I’ll also explain how to mvoe the rootfs from NAND flash to SSD to extract more performance from the kit.

Getting Started with CubieTruck Board

Even though the board is pre-loaded with Cubieez 2.1, it’s still good to know how to flash the image by yourself, and do the initial setup.

There are some tutorials for CuebiTruck, but the one dedicated to Cubieez is completely empty at the time of writing.

But the important part is to know that the firmware can be found @ http://dl.cubieboard.org/model/cubietruck/Image/Cubieez/ with images for HDMI or VGA output, and NAND flash or SD card boot.

So this is what I had to do to reflash Cubieez (Cubieez 2.2 has been released since then, probably with a fix with my HDMI issue):

wget http://dl.cubieboard.org/model/cubietruck/Image/Cubieez/cubieez-hdmi-v2.1/cubieez-ct-nand-hdmi-v2.1.img.7z
7z x cubieez-ct-nand-hdmi-v2.1.img.7z

You’ll need LiveSuit (Linux or Mac), or PhoenixSuit (Windows) to flash the firmware, which you can download here. I’ve already explained how to install LiveSuit to flash firmware on A80 OptimusBoard, and the procedure is the same for all Allwinner devices. Once the installation is complete simply run:

~/Bin/LiveSuit/LiveSuit.sh

And load the uncompressed image (cubieez-ct-nand-hdmi-v2.1.img) as shown below:

LiveSuit_CubieTruck

Now connect a micro USB to USB cable between your computer, and CubieTruck OTG port, press the FEL button on the right side, power on the kit, and flash should complete automatically.

Then you can just reboot the board, and it should boot into LXDE, unfortunately for me, it did not work that way, and all I could see was the boot log on my HDMI TV.  So I asked some help on CubieBoard Google group, and got some help one or two days later pointing me in the right direction. However, it may have been better to ask on Cubieforums.com, these forums are more active than on Google group.

Nevertheless, the issue was a segfault reported in /var/log/Xorg.0.log:

[    47.423] (II) FBTURBO(0): using /dev/fb0
[    47.423] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
[    47.423] (**) FBTURBO(0): Depth 24, (–) framebuffer bpp 32
[    47.423] (==) FBTURBO(0): RGB weight 888
[    47.423] (==) FBTURBO(0): Default visual is TrueColor
[    47.423] (==) FBTURBO(0): Using gamma correction (1.0, 1.0, 1.0)
[    47.424] (II) FBTURBO(0): hardware:  (video memory: 16200kB)
[    47.424] (**) FBTURBO(0): Option “fbdev” “/dev/fb0″
[    47.424] (**) FBTURBO(0): Option “SwapbuffersWait” “true”
[    47.427] (II) FBTURBO(0): processor: ARM Cortex-A7
[    47.429] (EE) FBTURBO(0): Unknown EDID version 0
[    47.429]
[    47.430] Backtrace:
[    47.430]
[    47.431] Segmentation fault at address 0x8
[    47.432]
Fatal server error:
[    47.432] Caught signal 11 (Segmentation fault). Server aborting
[    47.432]

The bold line showed that my TV did not return EDID information, and fbturbo did not check for this case. So CubieTech sent me an updated fbturbo_drv.so, which I copied to  /usr/lib/xorg/modules/drivers/, and I was finally able to access the login prompt in LXDE. I believe this fix must be included in Cubieez 2.2 image.

You can login with cubie / cubieboard, or root / cubieboard. I normally prefer running the system as a user, and run sudo when needed, so I logged in with cubie user.

Cubieez

Cubieez LXDE Desktop (Click for Original Size)

Cubieez features LXDE running on top of Debian 7.6 with Linux 3.4.79, and the default resolution is set to 1080p50, but you can click on Monitor Settings to change the resolution as needed.

The README recommends to run cubie-config in LXTerminal the first time, so let’s do that.

Cubie_configExpand Filesystem is only used for SD card images. Internationalisation Options lets you change the locale, timezone, and keyboard layout, and you can change the hostname, and enable/disable SSH in Advanced Options. Once you;’re done, select Finish, and you may have to reboot.

You’ll probably want to install some packages with apt-get or the Software Center, but the repositories are set to Spanish mirror, and changing the mirrors to one in your country may speed up download a lot. Changing from Spain to Thailand, increased the download speed with apt-get by 10 times in my case.

You can find the list of mirrors @ https://www.debian.org/mirror/list, once you have found the right mirror for your country, edit the source list:

sudo vi /etc/apt/sources.list

And replace

deb http://ftp.es.debian.org/debian stable main contrib non-free
deb http://ftp.debian.org/debian/ wheezy-updates main contrib non-free

by your country’s mirror. For example:

deb http://ftp.th.debian.org/debian stable main contrib non-free
deb http://ftp.th.debian.org/debian/ wheezy-updates main contrib non-free

Finally refresh the system with:

sudo apt-get update

You may want to install your favorite programs, for example:

sudo apt-get install libreoffice gimp nautilus

I found some XMBC binaries for an earlier version of Cubieez, that you need to extract to the root of the system. You have to install some dependencies, then run XBMC as shown below:

sudo apt-get install libssh-4 libmicrohttpd10 libtinyxml2.6.2 libyajl2 liblzo2-2 libpython2.7 libpcrecpp0 libhal1 libhal-storage1
/allwinner/xbmc-pvr-binhf/lib/xbmc/xbmc.bin

But unfortunately XBMC will crash, so this version is not suitable for Cubieez 2.1/2.2.

Finally, the SSD included in the kit is not partitioned nor formatted, so it’s also something you’ll want to do, but I’ll explain that in the next section.

SSD SATA Performance and Gigabit Ethernet

CubieTruck is certainly not one of the fastest ARM Linux system currently available, but its SATA interface and Gigabit Ethernet port could make it one of the best platform for storing and moving data around.

First let’s prepare the SSD for testing. Most people will make a single partition, but since the SSD may be use for Android SATA testing as well in the future, I’ve create two partitions, one formatted with NTFS and the other with EXT-4. To create the partitions, start a Terminal windows in CubieTruck, and type:

sudo fdisk /dev/sda

Now create primary partition(s) with by selecting ‘n’,  and type the start and end of the partition. If you want a single partition, that’s easy as fdisk will select the start and end for you, and you can just press enter to confirm the choice. Finally press ‘w’ to write the partition table and exit.

Format your partitions are needed, and in my case:

sudo mkfs.ntfs /dev/sda1
sudo mkfs.ext4 /dev/sda2

The SSD is now ready. Let’s mount the partitions:

sudo mkdir -p /mnt/sda1
sudo mkdir -p /mnt/sda2
sudo mount -t ntfs /dev/sda1 /mnt/sda1
sudo mount -t ext4 /dev/sda2 /mnt/sda2

In Linux, I’m normally using Bonnie / Bonnie++ to benchmark storage device:

sudo apt-get install bonnie++

By default, bonnie will write a file with double the size of your RAM to perform its testing, which is a way to reduce the influence of the cache, and provide more accurate results.

bonnie++ -d /mnt/sda1
Version  1.96       ------Sequential Output------ --Sequential Input- --Random-
Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
cubietruck       4G     3  13  8726  12  8640  14   424  99 50567  28 787.3  56
Latency              2352ms    1824ms    1807ms   21041us   17141us    2591ms
Version  1.96       ------Sequential Create------ --------Random Create--------
cubietruck          -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
16  1321  15  3549  19  1788  13  1344  16  3756  19  1769  14
Latency              5620us   10305us   49666us    8780us    8080us    5673us
1.96,1.96,cubietruck,1,1418961485,4G,,3,13,8726,12,8640,14,424,99,50567,28,787.3,56,16,,,,,1321,15,3549,19,1788,13,1344,16,3756,19,1769,14,2352ms,1824ms,1807ms,21041us,17141us,2591ms,5620us,10305us,49666us,8780us,8080us,5673us

bonnie++ -d /mnt/sda2
Version 1.96 ------Sequential Output------ --Sequential Input- --Random-
Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
cubietruck 4G 85 99 36310 30 23916 26 464 98 179457 89 1199 115
Latency 164ms 1974ms 214ms 39690us 15721us 104ms
Version 1.96 ------Sequential Create------ --------Random Create--------
cubietruck -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
16 5738 56 +++++ +++ 10671 82 8671 84 +++++ +++ 10397 83
Latency 891us 2857us 3987us 4931us 125us 5187us
1.96,1.96,cubietruck,1,1418828957,4G,,85,99,36310,30,23916,26,464,98,179457,89,1199,115,16,,,,,5738,56,+++++,+++,10671,82,8671,84,+++++,+++,10397,83,164ms,1974ms,214ms,39690us,15721us,104ms,891us,2857us,3987us,4931us,125us,5187us

Since bonnie output is not always easy to read, I’ve run the last line with bon_csv2html to have prettier results in HTML, also including the results for the NAND flash (bonnie++ -d /) as comparison.

Cubietruck_SSD_NAND_BonnieYou can check the full Bonnie++ results including sequential and random create results.

Sequential Output is write speed, and Sequential Input is write speed. Most of the time, Block speed is the important metric here. So first we see a large difference in performance between NTFS and EXT4 read and write speed on the SSD with respectively 8.7 MB/s and 50.5 MB/s for NTFS versus 36.31 MB.s, and 179.45 MB/s for EXT-4. That means CubieTruck can read data at 180MB/s from the SSD, or about 6 times faster than the typical performance of a USB 2.0 drive, and faster than the USB 3.0 drive connected to my Ubuntu computer (AMD FX8350) which achieves 115 MB/s read speed in the same test on its EXT-4 partition. As a side note, the maximum performance I’ve ever got from another ARM device via USB 3.0 was about 48 MB/s with ODROID-XU3 Lite, but this was in Android, and an NTFS partition, and with another tool (A1SD).

The NAND flash used in CubieTruck is also much slower than the SSD, writing at 6.4 MB/s and reading at 19.46 MB/s, and that’s why if you purchase this kit, you should probably move the rootfs to the SSD.

I’ve also tested raw Ethernet performance with the command line: iperf -t 60 -c 192.168.0.104 -d. Unfortunately Cubieboard Gigabit Ethernet performance (full duplex) is not that good, albeit still faster then Fast Ethernet.

CubieTruck_Gigabit_Ethernet_iPerf

Throughput in Mbps

Battery Life, Monitoring and UPS Function

This kit comes with a 5,300 mAh battery that’s mainly used as a UPS. So I’ve tried to disconnect the power while in used, and the system runs as expected. Once the battery is depleted, and the system off, as soon as the power comes back the system will boot again, so that part is also good in most cases, but not all…

I always wanted to check the battery life, to see how long the board could run on batteries. In my Ubuntu computer, I can run “last” to check the last power on./off event, bit with this firmware, it won’t work, complaining that /var/log/wtmp is missing. So instead I installed uptimed:

sudo apt-get install uptimed

Once I left the battery discharge over night, and after 3 hours, I assumed it was fully charged, and in idle mode, the battery lasted two hours. I had only connected the HDMI cable, an Ethernet cable, and connected to the board with SSH.

We can check the record uptimes with uprecords:

uprecords
     #               Uptime | System                                     Boot up
----------------------------+---------------------------------------------------
     1     0 days, 03:20:26 | Linux 3.4.79              Fri Dec 19 09:59:28 2014
     2     0 days, 02:00:40 | Linux 3.4.79              Fri Dec 19 13:20:32 2014
->   3     0 days, 00:08:11 | Linux 3.4.79              Fri Dec 19 15:31:12 2014

However, afterwards I had a doubt whether I had a full charge or not, so let it run all day, and tested it again, and this time, the battery lasted for over four hours and 20 minutes, meaning the first time, the battery was not fully charged, and it might take many hours to charge the battery:

uprecords
     #               Uptime | System                                     Boot up
----------------------------+---------------------------------------------------
     1     0 days, 07:43:48 | Linux 3.4.79              Fri Dec 19 14:31:12 2014
     2     0 days, 04:26:36 | Linux 3.4.79              Sat Dec 20 11:51:35 2014
     3     0 days, 04:12:17 | Linux 3.4.79              Sat Dec 20 16:20:07 2014

LXDE desktop will not run the system run on batteries (or I missed that), but you can monitor the battery status, health, voltage and more with sysfs:

cat /sys/class/power_supply/battery/health
Good
cat /sys/class/power_supply/battery/status
Discharging
cat /sys/class/power_supply/battery/voltage_now
3729000

So that means your program, or a script, could detect when the battery is charging or discharging, check the health status and/or voltage, and decide to run in lower power mode, and cleanly turn off the system when the voltage drops too low.

More options can be found on power_supply_class.txt kernel documentation.

Installing Debian rootfs to the SSD

Have we’ve seen above the read speed of the SSD is about 9 times faster than the NAND flash, and the write speed nearly 6 times faster, so you should really move the rootfs to the SSD, unless you have specific reasons not to do so. Another advantage will be the increased space for programs.

Let’s check the rootfs usage n the NAND flash first:

cubie@cubietruck:~$ df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 6.9G 2.8G 3.9G 42% /
/dev/root 6.9G 2.8G 3.9G 42% /

So we have a 6.9GB rootfs out of the 8GB flash, with 3.9GB free after I installed a few programs.

The rootfs is located in /dev/nandb partition, and you’ll want to move it to /dev/sda1 (in my case /dev/sda2, but I’ll use sda1 in this section, as it’s what most people will do). I’ll assume here that you have already partitioned and formatted the SSD as specified in the SSD SATA performance section.

First we have to copy the rootfs in the NAND flash to the SSD partition:
sudo mkdir -p /mnt/nandb
sudo mount -t ext4 /dev/nandb /mnt/nandb
sudo mount -t ext4 /dev/sda1 /mnt/sda1
cd /mnt/nandb
sudo cp -a . /mnt/sda1

Then we have to tell the system the root filesystem is located in the SSD, by changing uEnv.txt located in nanda partition of the flash:

sudo mkdir -p /mnt/nanda
sudo mount /dev/nanda /mnt/nanda
cd /mnt/nanda

sudo vi /mnt/nanda/uEnv.txt

Where you’ll need to change:

nand_root=/dev/nandb

by

nand_root=/dev/sda1

Now unmount the partitions, sync, and reboot

umount /mnt/sda1
umount /mnt/nand*
sync
reboot

After login, you can check that the rootfs is now on the SSD with close a 120GB partition (in my case 60G since I have two partitions):

cubie@cubietruck:~$ df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 59G 2.9G 53G 6% /
/dev/root 59G 2.9G 53G 6% /

Using CubieTruck Metal Kit as a Desktop PC

Just like I did with ODROID-XU3 Lite and Ugoos UM3, I’ve tried to use this Linux computer as a desktop computer, and shot a video with:

  1. Boot time from SSD: 42 seconds. Note that the LED on the front panel take about 10 seconds to lit up.
  2. Checking UPS function by disconnecting the power
  3. cubie-config utility for setup
  4. List of installed applications
  5. LibreOffice (Writer)
  6. Chromium – Multi-tabs, YouTube (embedded / full screen; VP9 / H.264/AVC1), and Candy Crush Saga (Flash game) in Facebook
  7. Video Playback with GNOME Player
  8. Power off

CubieTruck (Cubieboard 3) can be used as a desktop computer for Office tasks, but web browsing may become an issue with high CPU usage in Chromium, and watching YouTube video amounts to torture. Video playback (software decode) appears to be relatively OK up to 720P using GNOME player, but 1080p/H.264 video are not watchable. There are now VPU driver for Allwinner A10/A20, but these do not seem to be in use in this image, same for Mali drivers for 2D/3D GPU acceleration.

Phoronix Benchmarks

I’ve also run some of Phoronix Test Suite benchmarks:

sudo apt-get install php5-cli php5-gd php5-gd libpcre3-dev
wget http://phoronix-test-suite.com/releases/repo/pts.debian/files/phoronix-test-suite_5.4.0_all.deb
sudo dpkg -i phoronix-test-suite_5.4.0_all.deb

After configuring batch test, I’ve run MP3 encode, 7-zip compression, and Apache server tests:

phoronix-test-suite batch-benchmark pts/encode-mp3 pts/compress-7zip pts/apache

Contraty to ODROID-XU3 Lite, where compress-7zip failed because of a lack of memory, all three tests could complete successfully. I find Openbenchmarking website very confusing to use, and I did not find a way to compare to old results. So I included CubieTruck NAND, CubieTruck SSD, and ODROID-XU3 Lite in the picture below.

Cubietruck (NAND / SSD) vs ODROID-XU3 Lite (Click to Enlarge)

Cubietruck (NAND / SSD) vs ODROID-XU3 Lite (Click to Enlarge)

You can also click on the pages on OpenBenchmarking for Cubietruck (NAND), CubieTruck (SSD), and ODROID-XU3 Lite (eMMC) for full details.

I was not expecting the SSD to make much difference with the MP3 encoding, and 7-zip compression benchmarks, but I though it would yield a significant increase in performance for the Apache test. I was wrong, as the Apache test only improved from 771.6 requests per second to 785.20 rps, so it must mean this benchmark is not a I/O bound test. As should be expected ODROID-XU3 Lite is much faster for both MP3 encoding (45 seconds vs 165 seconds), and Apache (2382 rps vs 785 rps).

CubieTruck Metal Case kit includes CubieTruck board, a 120GB SSD, a 5,300 mAh battery, a rugged metallic enclosure, a 5V/2.5A power, and relevant cables. It can be purchased for $169 on Seeedstudio, or 149 Euros exc. VAT on EmbeddedComputer.nl.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter