XBMC for utilite (CEC support included)

Utilite device

I have already alluded to utilite devices several times (at least here, here and here).

The utilite pro is definitively the best i.MX6 device I currently own for several reasons :

  • It is based on the powerful i.MX6Q with 2Gib of RAM
  • The bootloader is in a dedicated SPI NOR flash (so it is always available)
  • It includes a SanDisk SSD U100 drive which is just a sdcard killer
  • It provides 2 Gbps Ethernet interfaces (one of it being the standard imx6 ENET interface and the other a PCIe intel I211 controller).
  • It comes well packaged in a nice aluminum case (with power button) and accessories (wifi antenna + power supply + S/PDIF coax and uUSB to RS232 cables)
  • It also has an backed RTC (it may appear as a detail but is just another little asset for this product)

(it is worth mentioning that this product is based upon the embedded board cm-fx6 which is properly documented, especially schematics are available)

Some people would argue that it is expensive. Obviously it may seem to be the case when compared to a GK802 stick. But when you have a detailed look at the features, it is simply aligned with the price of comparable devices I guess…

XBMC for utilite

When I released my HardFloat XBMC image, I said I will also release an image for utilite.
So here it is ! This image is special : Not only does it provide my most recent XBMC build for iMX6, but it also features CEC as I mentioned in my previous post
You can download the image from this link – md5sum is cf4523d1e32ebd35faa5264abe3523fb.
Warning : I updated the image on the 30th of September 20:10 GMT because the included XBMC had an issue. Please check carefully your md5sum and download the image again if it is not the good one…

It is a sdcard image : That way you can try it without interfering with your SSD install (of course you will not benefit from the SSD that way but it is a safe and easy way to give a first try at my image)
To get it up and running :

  • Flash the sdcard and insert it in your device
  • Plug the serial line, configure it @115200n8 and power on your device
  • Stop the bootloader by pressing ESC
  • Issue the following commands :
setenv sdargs 'setenv bootargs console=ttymxc3,115200 root=/dev/mmcblk0p2 rootwait video=mxcfb0:dev=hdmi,1920x1080@60,if=RGB24 consoleblank=0' 
setenv start_sd 'mw.l 0x20E0034 0x593A046 ; mmc dev 2 ; fatload mmc 2 0x10800000 uImage-cm-fx6 ; run sdargs ; bootm'
  • Then you can boot by issuing the command :
run start_sd

Please note that you will only have to issue the command :

run start_sd

to boot from the sdcard instead of the SSD during the next reboots …

Apart from this, you can refer to my previous post to get more info regarding this image…



According to wikipedia definition : “Consumer Electronics Control (CEC) is an HDMI feature designed to allow the user to command and control up-to 15 CEC-enabled devices, that are connected through HDMI by using only one of their remote controls (for example by controlling a television set, set-top box, and DVD player using only the remote control of the TV). CEC also allows for individual CEC-enabled devices to command and control each other without user intervention.
It is a one-wire bidirectional serial bus that is based on the CENELEC standard AV.link protocol to perform remote control functions.”
Since the Eden release XBMC has support for CEC thanks to libCEC. Besides the freescale i.MX6 SOC is able to handle this bus by itself : There is no need to buy an additional USB device such as this one.
Unfortunately, so far, nobody publicly added i.MX6 CEC support in libCEC. It was a shame and I decided to address this issue.


While developing this missing part, I had to tackle 3 tasks :

  • Finding a hardware platform to develop and test this feature
  • Adding support in libCEC
  • Solving issues with the CEC driver itself

The first item may seem trivial but it is not. Indeed, many iMX6 products/boards do not properly wire the CEC signal.
Here are the info I gathered :

  • Wandboard was reported by a user to have CEC signal unconnected in this comment which refers to wandboard forums
    Edit (october, 12): After lots of comments, I confirm that no wandboard version is properly wired to use CEC (At this time at least). But if you have a wandboard quad and are able to use a soldering iron, then have a look at this thread
  • GK802 is no longer of interest to me : It is a device with no engineering support nor official technical data. It is not properly cooled. It has a very attractive price but, as a developer, I lost enough time with it. CEC signal may be connected or not, I don’t care as I know I will have no resource to understand what happens if it does not work…
  • I also know that nitrogen6x (I don’t own that board by myself) from boundary devices does not expose the CEC signal (thanks to this comment)
  • My utilite pro would have been a perfect device to test CEC. Unfortunately, my device comes from an early batch which was not properly wired (while currently produced devices are all good).

So, at the end, finding the right device for this development was not so easy. Fortunately compulab was kind enough to send me a new utilite from their new batch (and a properly wired CEC signal). I am about to publish a XBMC image with CEC support for utilite as a way to thank them for their support.

Then adding support for a new adapter in libCEC was not so hard : The code is well structured and there is obviously a provision to add new devices.
At some stage, I found that support for existing devices was a little cumbersome but I finally understood that the real culprit was not libCEC but the interface with underlying hardware and that I was able to have a simpler implementation as long as the driver allows for it. Note that, for now, I have not added support to handle several logical addresses at the same time (The hardware allows for it but there is not yet support in the driver for this)

And so we come to the third item : The CEC kernel driver. Freescale provides this driver but I was a little surprised of the current state of this driver (in the their BSP V4.0.0 or V4.1.0). It is supposed to be a simple character device (which is just fine) but I found quite a few shortcomings.

  • First they don’t care about being compliant with the well known POSIX interface :
    The read syscall will immediately return if no data is available even if the device is not opened with the O_NONBLOCK flag.
    This same read syscall will return a false value (ie not the effective number of bytes seen by userspace)
    The write syscall will return 0 if successful while it should return the number of written bytes
    The poll syscall will never state that the device is writable
  • Then they do not properly release the IRQ when the kernel module is unloaded (because of this, you will not be able to reload the module a second time)
  • At last, they use locking in a sometime hazardous way and even copy/paste comments from “vpu” in this driver…

As a conclusion, this driver has not been very carefully developed and is misleading when you try to use it at first time.
But I don’t blame freescale for this : At least they release this driver and, that way, they allow to enhance it. All the more as they also provide an excellent reference manual which describes very well the hardware interface.
So I had to solve the afforded mentioned items in order to use it smoothly from libCEC.

Final thoughts

At the end, I rebuilt XBMC with CEC support and was able to give it a try faced to my panasonic PZ81 TV.
And… it works just fine !
I am able to browse XBMC GUI with my TV remote.
I have already published my changes for libCEC here and will try to mainline them.
Changes for the kernel driver should be released next week.
[Edit : A first (still wip) patch is now public]
Last but not least, all this work is useful only if a product can take advantage of it. So here is a XBMC image which provides XBMC with CEC support targeted at utilite here.

Edit 2014/03/13 : I have moved iMX6 libcec to xbmc-imx6. Enhancement and bug tracking can occur here starting from now…
Edit 2014/04/28 : Other important fixes and port to 3.10 kernel are here

utilite benchmarks

In a previous post, I said I will publish some additional benchmarks regarding utilite product. Unfortunately I had no opportunity to run and publish these benchmarks so far.
That’s why, I am pleased to share with you the comparative benchmarks between Rpi and utilite which have just been updated by Peter on is website.
Beyond these numbers, I would also like to underline that utilite is the only iMX6 product I am aware of which has a real gbps Ethernet controller.
Indeed other iMX6 products only have a Ethernet port connected to the internal ENET interface which is subject to 470 Mbps limitation (total for Tx and Rx) due to internal bus throughput. For details, see the ERR004512 erratum in the i.MX6Dual/6Quad errata document IMX6DQCE. Utilite pro has a second gpbs ethernet interface which is connected to PCIe and which is not subject to this limitation (of course the other port is concerned by the limitation)…

Odds are high I will speak about this device soon as installing an alternative image on SSD may interest some people while the first units are shipped…

ARMHF XBMC image – Part 2


As announced in a previous quick post, I have just released a new image for wandboard quad.

What’s in it

This image packages my latest version of XBMC for iMX6. It is built using ARMHF ABI.
This XBMC is derived from a gotham dev branch (which is 4 month old. A sync to catch latest main devs will happen soon).
It exhibits the following features :

  • Hw decoding is available for most codecs which are handled by the iMX6 VPU (noticeable exceptions are RV and AVS standard but they are not so common so it is not a major drawback).
  • codecs which are not directly handled by VPU are available through sw decoding
  • Network shares such as uPNP, SMB, NFS are available
  • RTMP protocol is available
  • Support for bluray has been built in (but tests are required)
  • All sound interfaces are available (HDMI, SPDIF and sgtl5000) and passthrough should work (not yet tested on my side)

How to install

  • Download the compressed (xz) SDcard image – md5sum is 70c39feda421fc4130909127219e27b8.
  • Extract it by using the xz utility :
xz -dv wand.bin.xz
  • Burn it on a sdcard (At least 2GiB) by using
dd if=wand_v0.0.2.bin of=/dev/sdx bs=4M

With /dev/sdx being the sdcard device (for instance /dev/sdd)

How to use

On startup, XBMC is automatically launched, just have fun…
Be aware that :

  • login is root and password is empty
  • You have a shell on the serial line interface
  • A ssh/scp server is up and running


This image is still beta and work in progress.
If you experience instabilities, crashes or bugs, please report them to me without being too rude 😉
Known bugs are tracked here
Please when you report a bug :

  • Try to be as precise as possible regarding the context.
  • When it occurs, try to download the 2 files :
    • /tmp/temp/xbmc.log
    • /var/log/messages
  • Try to reproduce it

For now, report these bugs on this blog or in XBMC thread. I will create tickets in trac by myself as I have disabled the ability to create tickets for anonymous because of spams.

If you need to send files, I will give you a direct link to upload on my server by mail.
In case I ask you to create a core dump dump here is the way to do it :

  • Stop XBMC
  • login on the board and issue the commands :
echo "/tmp/core.%e.%p" > /proc/sys/kernel/core_pattern
ulimit -c unlimited
/imx6/xbmc/lib/xbmc/xbmc.bin &

Then if XBMC crashes, a file core.* will be created in /tmp folder


A package manager (smart) is installed and will enable future updates.

First additional package is NTP client which is not already installed in the image. So, if you want a NTP client please issue the following commands on your board :

smart update
smart install ntp ntp-utils

What next ?

Of course stability is a must have and I will do my best to improve it by investigating and hopefully by solving reported bugs.
Then, regarding new features, my current priorities for the days to come are :

  • Sync with main gotham dev branch
  • Add support for liveTV
  • Add support for LIRC
  • Port libCEC on iMX6 to provide support in XBMC (not possible for wandboard as CEC pin is not connected, thanks to hste for pointing this. I will check if other products have connected this pin or not…)

I will also provide images ready to use for other devices than wandboard quad. I mostly think about utilite and maybe GK802 (with special care given the overheating issue) because I own these other products.
(If you want support for another iMX6 board or device and are ready to send to me a free sample then you can contact me.)


A new image for Wandboard Quad has just been uploaded [here](https://stephan-rafin.net/owncloud/public.php?service=files&t=9dac4041e962c9e96e21a048c86e71cb)
Early adopters can give it a try.
I will update this post to explain what is new in it.
I will also publish all my specific yocto recipes.
For other targets, do not worry : an image for wandboard dual will be released very soon and a tutorial to install on utilite published…

EDIT : The following