SparkFun FTDI Basic with Raspberry Pi

Here’s how you can connect a FTDI Basic (USB to serial) breakout board to Raspberry Pi’s GPIO connector.


Here’s how cmdline.txt in the boot partition of my Raspberry Pi looks like

dwc_otg.fiq_fix_enable=1 sdhci-bcm2708.sync_after_dma=0 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 root=/dev/mmcblk0p2 rootwait

For the kernel log to appear on the serial port, console should be set to ttyAMA0.

To get a login prompt /etc/inittab should contain a line such as

ttyAMA0::respawn:/sbin/getty -L ttyAMA0 115200 vt100 # GENERIC_SERIAL
Posted in Linux, Raspberry Pi

What woes Samsung?

Samsung announced a rather lackluster quarter (compared to last year). What woes it? I am willing to hazard it is software. I was recently in the market for a cheap Android phone. Even though Samsung had an impressive lineup of hardware, none had Android 4.4 (KitKat) on it.

Low-end hardware requires Android KitKat due to improvements in how it supports low memory. The only phones that were touting Android 4.4 were from LG and Motorola. Motorola was still slightly costlier and Moto E hand’t arrived yet. Guess which I bought?

Posted in Android, Business

Custom embedded Linux system for Raspberry Pi with Buildroot

This post shows how easy it is to make a custom embedded Linux system for Raspberry Pi using Buildroot. I used an Ubuntu 13.04 VM for Parallels Desktop 9 to perform the build.

The Ubuntu VM required only two dependencies and I could go ahead with the build. These I installed by executing

sudo apt-get install git g++

I then obtained Buildroot source from its git repo by executing

git clone

I used git because the stable release buildroot-2014.05.tar.gz did not work for me. The procedure to perform the build and prepare an SD card is well documented in file board/raspberrypi/readme.txt.

I headed into the buildroot folder created by git and executed

cd buildroot
make raspberrypi_defconfig

That prepared the appropriate .config file required by buildroot. Since I wanted to generate a persistent root file system, I followed that by executing


The build takes a while to finish. Once done, I followed the steps in readme.txt mentioned above to prepare an SD card.

I was able to boot Raspberry Pi with the newly minted headless embedded Linux system, but I wasn't able to get interface eth0 to work. Every time I bring it up, the whole system just locks up. Colleagues have had better success with Bsquask.

Posted in ARM, Linux, Raspberry Pi

Packaging source code using Grunt

I have this very specific need to package source code of an Atmel Studio 6.2 project. For those not in the know, Atmel Studio 6.2 is based on Visual Studio Isolated Shell, and retains many of the features that make Visual Studio itself a neat IDE.

I had several choices for packaging the source code:

  1. Do it manually – that would have worked once or twice. Since I have to keep some files out of the source package, it would make repeated packaging an error-prone and time-consuming affair.
  2. Use msbuild – I didn’t find a convenient task native to msbuild for creating a zip file. Maybe I didn’t look hard enough.
  3. Use Apache Ant – I didn’t want to include a Java dependency into my build and decided to let Ant go.
  4. Use Grunt – I always seem to have Node.js installed, and find JSON for writing build instructions an interesting alternative to writing XML (verbose). Grunt is also quite portable. Grunt won.

The only files Grunt requires is a package.json file with the project configuration, and a Gruntfile.js with the build instructions.

You can create package.json by invoking npm init and providing some details about your project. Gruntfile.js can be hand-coded in any text editor. Here's my own script to get you started.

module.exports = function(grunt) {

  // Project configuration.

    pkg: grunt.file.readJSON('package.json'),

    compress: {
      main: {
        options: {
          archive: ''
        files: [
            expand: true,
            cwd: './',
            src: ['**', '!*/Debug/**', '!*/Release/**', '!node_modules/**', '!*.atsuo', '!**/file.h', '!']

  // Load tasks

  // Default task(s).
  grunt.registerTask('default', ['compress']);


To invoke Grunt, you need to have grunt and its plugins installed. Use npm to download and install a project-local copy of these packages, and include them in your package.json as dependencies. In my case

npm install grunt --save-dev
npm install grunt-contrib-compress --save-dev

That results in creation of of a node_modules folder in the root folder of the project. I don't add node_modules to version control. If you use git, add it to your .gitignore. Other developers can obtain dependencies listed in package.json by invoking npm install within the root folder.

You are now ready to invoke Grunt and execute the relevant tasks. In my case, invoking grunt results in creation of a file containing all the files under the project root folder, minus whatever files and folders I choose to leave out.

Posted in AVR, JavaScript

Lists and sorting in .NET

.NET Framework provides a SortedList<Key, Value> class that keeps objects sorted by Key while they are added. It requires Key to be unique, probably for performance reasons. The example below demonstrates the alternative List<T> class for sorting and searching, and the limitation of SortedList while trying to do the same thing. You’ll probably get better performance out of SortedList. List has a BinarySearch method that can improve search performance significantly.

using System;
using System.Collections.Generic;
using System.Linq;

namespace ListExample
    class Person
        public string name;
        public byte age;

        public Person(string name, byte age)
   = name;
            this.age = age;

    class CompareByAge : IComparer<Person>
        public int Compare(Person x, Person y)
            return x.age - y.age;

    class Program
        static void Main(string[] args)
            Person luisa = new Person("Luisa", 7);
            Person victoria = new Person("Victoria", 10);
            Person alice = new Person("Alice", 10);
            Person lara = new Person("Lara", 1);
            Person rafaela = new Person("Rafaela", 9);
            Person noname = new Person("Noname", 6);
            Person p;

            Console.WriteLine("Sorting with List:");
            List<Person> list = new List<Person>();

            // Sort using System.Collections.Generic.IComparer<T>
            list.Sort(new CompareByAge());

            // Sort using the System.Comparison<T> delegate
            //list.Sort(delegate(Person x, Person y) {
            //    return x.age - y.age;

            foreach (Person person in list)


            Console.WriteLine("Find with List:");
            //p = list[list.FindIndex(0, person => person.age >= noname.age)];
            //p = list.Find(person => person.age >= noname.age);
            int i = list.BinarySearch(noname, new CompareByAge());
            i = i < 0 ? ~i : i;
            if (i == list.Count)
                Console.WriteLine("No one that old here");
                p = list[i];


            Console.WriteLine("Sorting with SortedList:");
            SortedList<byte, Person> sortedList = new SortedList<byte, Person>();
            sortedList.Add(luisa.age, luisa);
            sortedList.Add(victoria.age, victoria);
            //sortedList.Add(alice.age, alice); // throws System.ArgumentException
            sortedList.Add(lara.age, lara);
            sortedList.Add(rafaela.age, rafaela);

            foreach (Person person in sortedList.Values)


            Console.WriteLine("Find with SortedList:");
                p = sortedList.First(keyValue => keyValue.Key >= noname.age).Value;
                Console.WriteLine("No one that old here");


Here's the output produced by that example.

Sorting with List:

Find with List:

Sorting with SortedList:

Find with SortedList:
Posted in .NET

Debug Logging in .NET

This post provides useful references for tackling debug logging in .NET. It does not delve deeply into any of them.

Most Java developers are familiar with and routinely use Log4J from Apache Foundation. In fact, Log4J used to be the single big cause of package incompatibility in the Java world. Several Java libraries have been ported over to the .NET world. Log4J is one of them, its .NET equivalent is Log4Net.

If your company makes using open source components exceedingly difficult, .NET has the built-in Debug and Trace classes in System.Diagnostics package. Use TraceSwitch to determine log level. Use TraceListener or any of its subclasses to determine where the log output should go.

Posted in .NET

Monthly news review

This post reviews news in the month that has passed.

Everything Google announced at Google I/O 2014 in one handy list

Google announced a lot in one long keynote at I/O. Android One, Android Auto, Android Wear, and Android TV, are probably the big announcements this year. Looks like Google is prefixing all mobile-oriented hardware with Android, web-oriented hardware with Chrome, and services with Google. Unless it is something coming out of Nest, who’ve just launched a developer program for the programmable home.

Aereo Lost. What Now?

TV broadcasters are celebrating while the tech industry is up in arms. Are customers the real losers? Why should we need airwaves to transmit TV in the era of mobile internet? Why hasn’t the TV business adopted on-demand programming more actively? It isn’t as if their business isn’t being slowly driven to the ground.

This is Microsoft’s first Android smartphone, the Nokia X2

Nokia could have hedged its bets with Android a long while back. So why now? It is a cheap but attractive Android Smartphone full of Microsoft software and services.

Amazon’s Fire phone launch: Hits, misses, and takeaways

From inexpensive tablets to a fairly expensive phone, Amazon as come a long way. Lack of Bluetooth 4.0 (especially Smart) is annoying. It does seem to sport universal LTE, like the Moto G 4G. Will the Fire Phone truly delight users?

Google Donates Mod_Spdy To The Apache Foundation

HTTP 2.0 is around the corner and changes one crucial aspect of HTTP 1.x. It will no longer be a text-based protocol. An important feature is that data will be multiplexed over a single connection a browser maintains with a server.

Docker hopes its container platform will ease the lives of developers

Will an open container help big companies and other providers overcome the dependency on and momentum of Amazon, Google, and Microsoft?

Turing Test breakthrough as super-computer becomes first to convince us it’s human

Not everybody is convinced though, but the implications are important nevertheless. How do you know an e-mail message wasn’t sent by a real person? Are we at the cusp of having to deal with endless amount of believable spam? Looking at the positive aspects, customer support, distance education, and other areas that depend on personal interaction, may benefit.

Skype Translator Will Change the World

Real-time voice translation is a hard problem. You have to translate speech to text. The text then needs to be translated to the target language. The translated text then needs to be converted to speech. Imagine doing all of that in real time. Imagine doing that wrong in a UN session discussing climate change.

Google’s secretive 3D-mapping project now has a tablet

Google is keen to map the indoors. I see huge potential for indoor mapping. Imagine your interior designer mapping your house so that she can show you exactly how your renovated indoors will look? A robot that can go about your house tidying it? Are we heading towards becoming Wall-E lazy?

Apple announces iOS 8 at WWDC 2014

Easily one of Apple’s best WWDC considering all the news. A new programming language called Swift, Mac OS X Yosemite, Metal, HomeKit, CloudKit, and extensions in iOS 8. For those eager to learn Swift, Apple has provided an iBook for it already. A good news for all Netflix viewers, Safari on Mac OS X Yosemite now allows streaming using HTML5, no Silverlight required.

Posted in Android, Business, iOS, Lifestyle, OS X, Product, Rant, Review

Get every new post delivered to your Inbox.

Join 60 other followers

%d bloggers like this: