Try : Insurtech, Application Development









Dev Ops(2)

Enterprise Solution(12)




Augmented Reality(7)

Customer Journey(7)


User Experience(19)

AI in Insurance(17)


Product Innovation(26)


Artificial Intelligence(76)



Cognitive Computing(6)

Computer Vision(5)

Data Science(11)


Intelligent Automation(19)

Machine Learning(41)

Natural Language Processing(5)

How to interface an I2S microphone with Beaglebone Black(BBB)

Parag Sharma
10 minutes, 23 seconds read

 I have been writing a large variety of computer programs since a long time, but there was this question, the answer to which was elusive for a long time.

  • How are they converted to binary data, and how is that interpreted by my computer?
  • How do we create devices, and how do they work?

My fascination started with a smart wall clock ( that I thought was a very cool gadget to have at home. I wanted to build something like that on my own, but didn’t had know how. So I started on a journey to learn embedded systems and their functioning.

I moved from Arduino to Raspberry Pi, and then to RedBear Duo, learning new things at every step. And then finally came BeagleBone Black. I had always wondered how Linux kernel works, is it something that I can compile on my own, and execute? I have been trying to solve this problem for so long and I want to thank Pavel Botev for helping me out on this.

BeagleBone Black (BBB) comes with a TI processor AM3358. So in order to build Linux kernel for this board, you will need TI SDK that can be downloaded at

You will need to download and install the binary (Linux Processor SDK for AM335x) from the link above. Help on installation is available here —

There are two distinct steps in the installation of SDK. First setting the execute permission on the SDK bin file, and second to execute it.

$ chmod +x ./ti-processor-sdk-linux-[platformName]-evm-xx.xx.xx.xx-Linux-x86-Install.bin
$ ./ti-processor-sdk-linux-[platformName]-evm-xx.xx.xx.xx-Linux-x86-Install.bin

Once the TI Processor SDK is installed, you will find the following file structure in the install location.


This SDK contains both the Linux kernel, and the Root File System, and other cross compile binaries (compiler) to compile the kernel. Assuming ti-processor-sdk-home is the SDK install location, you will find the kernel files at

<ti-processor-sdk-home>/board-support/linux-4.9.69+gitAUTOINC+xxxx (The exact version may vary depending on the version of the processor SDK)

and the RFS at


You can copy these to separate folders so you always have the original SDK copy. In case anything goes wrong, and you want to restart from beginning, you have the kernel, and RFS that you can copy again from the Processor SDK.

Lets assume you copied the kernel files to location ~/linux-4.9.69, and changed your current directory to where you copied the kernel.

$ cd ~/linux-4.9.69

Before you compile the kernel, we must prepare the kernel by telling what is the board that we want to compile the kernel for? In other words you define the configuration by selecting appropriate defconfig file. For BeagleBone Black, we need to use “tisdk_am335x-evm_defconfig”. All config files are present in arch/arm/configs folder.

Command for setting this configuration is

$ make ARCH=arm CROSS_COMPILE=<ti-processor-sdk-home>/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf- tisdk_am335x-evm_defconfig

Please note the space between “arm-linux-gnueabihf-” and “tisdk_am335x-evm_defconfig” in the above command.

You may want to configure your linux distribution further by informing the compiler what all files/modules should be included for compilation. “menuconfig” is the target for this configuration, and the full command to run menuconfig is below.

But before you run menuconfig target, there is one more step. We need to tell menuconfig what all options should be shown in menuconfig, and how. Though most of the settings are good by default, we need to do one change in the kernel

$ vi ti-processor-sdk-home/board-support/linux-4.9.69+gitAUTOINC+xxxx/sound/soc/codecs/Kconfig

Find line

config SND_SOC_PCM5102A

And replace it with

config SND_SOC_PCM5102A
       tristate "Texas Instruments PCM5102a Dummy Codec Driver"

The above line “Texas Instruments PCM5102a Dummy Codec Driver” helps you identify the codec in the menuconfig stage.

Finally run “menuconfig” target with the following command.

$ make ARCH=arm CROSS_COMPILE=<ti-processor-sdk-home>/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf- menuconfig

Please note again that menuconfig is the target name, and the value for CROSS_COMPILE flag ends with a hyphen as “arm-linux-gnueabihf-”. There should be space between “arm-linux-gnueabihf-” and “menuconfig”.

Running “menuconfig” target opens up a menu through which you can select which modules you would like to be compiled in-line, i.e. along with rest of kernel code, and which ones to be compiled, and included as modules. Mark module PCM5102a to be inline compiled along with other kernel files.

Now in order to compile the Linux Kernel, you have the kernel source files, and the cross compile binaries needed to compile the source. Compile the kernel using

$ cd ~/linux-4.9.69
$ make ARCH=arm CROSS_COMPILE=<ti-processor-sdk-home>/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf- uImage LOADADDR=0x80008000 -j4

The above command compiles the kernel and keeps the image at arch/arm/boot/uImage. You can copy this image and flash it to the board, or transfer it via tftp. I shall explain the process of using tftp later.

The device tree source files are present in linux-4.9.69/arch/arm/boot/dts folder in the kernel. The device tree is the code that tells the kernel what all hardware is available on the board, and how is it configured.

Before we compile the device tree, we need to know which device tree we will be using. As this experiment is about BBB, it is obvious that BeagleBone’s device tree should be used. It is present as linux-4.9.69/arch/arm/boot/dts/am335x-boneblack.dts.

But we want to interface an I2S mems microphone (SPH0645LM4H, with BBB, we will need to tell the device tree of its presence, and its configuration. We will include all microphone related configuration in a separate DTSI file (include file, which can be included in the parent device tree source).

$ vi am335x-boneblack-pcm5102a.dtsi

The content of this include file is as below

* Copyright(C) 2016 Texas Instruments Incorporated-
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
&am33xx_pinmux {
 mcasp1_pins: mcasp1_pins{
  pinctrl-single,pins = <
   /* sink must enable receivers */
   AM33XX_IOPAD(0x9a0, PIN_INPUT_PULLDOWN | MUX_MODE3) /* P9_42 mcasp1_aclkx - bit clock */
   AM33XX_IOPAD(0x9a4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* P9_27 mcasp1_fsx - frame sync */
   AM33XX_IOPAD(0x9a8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* P9_41 mcasp1_axr0 - i2s input */
&mcasp1 {
 #sound-dai-cells = <0>;
 pinctrl-names = "default";
 pinctrl-0 = <&mcasp1_pins>;
 status = "okay";
 op-mode = <0>; /* MCASP_IIS_MODE */
 tdm-slots = <2>;
 num-serializer = <4>;
 serial-dir = < /* 1 TX 2 RX 0 unused */
  2 1 0 0
 rx-num-evt = <32>;
 tx-num-evt = <32>;
/ {
 pcm5102a: pcm5102a {
  #sound-dai-cells = <0>;
  compatible = "ti,pcm5102a";
  status = "okay";
clk_mcasp1_fixed: clk_mcasp1_fixed {
  #clock-cells = <0>;
  compatible = "fixed-clock";
  clock-frequency = <24576000>;
clk_mcasp1: clk_mcasp1 {
  #clock-cells = <0>;
  compatible = "gpio-gate-clock";
  clocks = <&clk_mcasp1_fixed>;
  enable-gpios = <&gpio1 27 0>; /* BeagleBone Black Clk enable on GPIO1_27 */
sound1:sound@1 {
  compatible = "simple-audio-card";
  simple-audio-card,name = "PCM5102a";
  simple-audio-card,format = "i2s";
  simple-audio-card,bitclock-master = <&sound1_master>;
  simple-audio-card,frame-master = <&sound1_master>;
sound1_master: simple-audio-card,cpu {
   sound-dai = <&mcasp1>;
   system-clock-direction = "out";
   system-clock-frequency = <24576000>;
   clocks = <&clk_mcasp1>;
   sound-dai = <&pcm5102a>;
   #sound-dai-cells = <0>;

Now we need to include this “am335x-boneblack-pcm5102a.dtsi” file in “am335x-boneblack.dts”. Just add this line at the end of “am335x-boneblack.dts”.

#include "am335x-boneblack-pcm5102a.dtsi"

The device tree can be compiled using

$ cd ~/linux-4.9.69 
$ make ARCH=arm CROSS_COMPILE=<ti-processor-sdk-home>/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf- dtbs

The above command will result in a device tree binary within arch/arm/boot/dts/ folder. The file is named am335x-boneblack.dtb

Lets now talk about how the MEMS microphone should be wired up. We can focus only on the BeagleBone column of the image below.


Booting the BBB

Now that all configuration is setup, we should march ahead with booting of your BBB. But wait, what you have is a kernel image (uImage) and a device tree binary (am335x-boneblack.dtb). But how do we send these to our BBB?

Instead of flashing the kernel, device tree, and the RFS to an SD card, and then putting the SD card to BBB, we will makes these available to BBB directly from the host computer via TFTP (for uImage, & DTB) and NFS (for RFS).


We will use TFTP to provide the kernel image, and DTB to the BBB. Go ahead and install TFTP on your host computer.

sudo apt-get install tftpd-hpa

Now let us configure TFTP and tell it the location of the files we need to transfer to the BBB. TFTP configuration files is present as/etc/default/tftpd-hpa. Example configuration is below

# /etc/default/tftpd-hpa
TFTP_OPTIONS="--secure --create"

The above configuration makes “/home/parag/linux-4.9.69/arch/arm/boot” as TFTP_DIRECTORY, which is the default directory where tftp looks for files that it can transfer. TFTP is not known to work very well with nested directories, so we must ensure that both files (uImage, and DTB) are available in this directory.

As uImage is created in above directory itself, so its not a problem, and TFTP can easily transfer it. However DTB is formed within boot/dts. We can create a symbolic link in the boot itself, and make it point to DTB file present in dts directory to make it work.

ln -s dts/am335x-boneblack.dtb am335x-boneblack.dtb

Sharing RFS (Root File System) over NFS (Network File System)

RFS or the Root File System contains binaries that you typically see in any linux distribution. RFS is made available by TI SDK as indicated early in this article. You can just copy those files from SDK, and keep it at a desired location from where you can share them over network via NFS.

NFS server can be installed on ubuntu host computer with the following commands

sudo apt-get update
sudo apt-get install nfs-kernel-server

Once NFS is installed, you can proceed with its configuration. Edit /etc/exports

sudo vim /etc/exports

You can configure the above file with the following setting

/home/parag/bbone/rootfs        *(rw,sync,no_root_squash,no_subtree_check)

Note, I have kept my RFS files in /home/parag/bbone/rootfs. You change this setting depending upon where you have copied the RFS files to.

Finally, booting the BBB!!

After all this hard work, its time to see the magic. Connect BBB with LAN cable, and connect it to the same network as your host computer.

Power up the BBB. Assuming you have minicom or any other serial monitor set up, you should be able to see the uboot logs. Immediately press space key so the bootloader (uboot) does not boot the kernel available in BBB, but stops for further commands. Type commands as below to help BBB connect to the network.

>setenv autoload no
>setenv serverip 
>setenv gatewayip

I have used as IP of my host computer, and as the gateway. You will need to choose these according to your setup. Finally dhcp command will help BBB to be allocated an IP address from your router.

If everything goes on file, you will see output from BBB uboot that an IP has been assigned. Next command as follows

>tftpboot 0x80F80000 am335x-boneblack.dtb && tftpboot 0x80007FC0 uImage

The above command instructs u-boot to download the device tree image from the serverip instructed earlier, and copy the same to address 0x80F80000 in RAM. Kernel uImage is also downloaded from the host serverip and copied to 0x80007FC0.

Boot, finally!!

The last two commands to start the boot process are as below

>setenv bootargs console=ttyO0,115200n8 noinitrd rw ip=dhcp root=/dev/nfs nfsroot= nfsrootdebug earlyprintk
>bootm 0x80007FC0 - 0x80F80000

The first command above sets up the bootargs. Change the setting as per your environment. The last command starts the boot process.

Soon you should see the kernel boot to complete, and a login prompt to appear. Login using root as user. No password should be needed.

Unexpected Signal on P9_41 :(

Now you will find (on your oscilloscope) that the moment you boot the kernel, you start getting a signal (square wave) on the data pin (P9–41). Ideally there should be no signal on the data pin till you start recording using the “arecord” command.

Here is the link to get the zoom version for this image below.

You would notice there is pinmux settings for clkout2 (mode 3) for Pin P9_41A which is the data pin. We need to disable this setting so that data pin receives only the data we record from microphone, and not from any other source.

The above observation is because of a configuration in the am335x-bone-common.dtsi (a file included in am335x-boneblack.dts).

pinctrl-names = "default"
pinctrl-0 = <&clkout2_pins>

It is this line `pinctrl-0 = <&clkout2_pins>` that causes the signals on data pin. We need to comment this out like below.

pinctrl-names = "default"
/*pinctrl-0 = <&clkout2_pins>*/

After this above change, we need to build again the device tree, and reboot the kernel. The data pin should not have any signal now till we start recording with the command.

$ arecord -Dhw:1,0 -f S32_LE -t wav -c 1 -d 60 -vvv /tmp/audio.wav

The above command shall start recording mono sound (single channel) at /tmp/audio.wav. The above command’s -D flag (-Dhw:1,0) assumes your PCM5102a sound card is listed at index 1. This index can be confirmed by listing down all cards and seeing the output of the command below

$ arecord -l

If you found this article helpful, let me know in the comment section below.


Knowledge thats worth delivered in your inbox

A website’s page load time plays an important role in customer acquisition. Google states that if your website takes more than 3 seconds to load, over half of the visitors will leave it. Eventually, it leads to conversion and profits. Although there are online tools available to check your website loading time and performance (Lighthouse, for instance), it’s important to understand what affects your website’s page load time. You can then optimize your web page accordingly.

8 Factors that affect the page load time

#1 Web hosting

Today, no one would like to wait for a website to spin and load at its speed. Websites that load quickly perform more in user engagement, conversion rates, and user experience. Hence, it is very important to have a high-availability web hosting plans.

#2 Size of files

The page speed always depends on the size of the assets loaded on the browser. It is, therefore, good to have an optimum number of assets with the least possible file size. This will require lesser bandwidth.

#3 Number of HTTP requests

Greater the number of HTTP requests from a browser to server/server to server, the higher will be the bandwidth consumption. Therefore, keep the number of HTTP requests to the minimum possible.

#4 Absence of CDN

Using CDN will boost the performance of the web site. The absence of it will affect the load time. CDN is a content delivery/distribution network. It is a network of proxy servers and their data centres distributed across the globe to increase the performance and availability of services to the end-users.

#5 Mediocre coding

Bad coding will always affect the page performance and SEO ranking of the website. It is good to follow best practices starting from the initial stage of development.

#6 The number of redirections

The number of redirections impacts the DNS lookup time.

#7 Lack of Keep-Alive

If you’re using HTTP/1.0 protocol and have not configured Keep-Alive, then there’s a higher possibility that the browser to server connection will break. It will not load the page properly. 

#8 Hotlinking

Sourcing page content from other sites might affect the load time and performance of your website.

You might also like to read about 11 proven techniques to optimize website performance.

Strategies and checklist for website optimization

You can implement either bottom-up or top-down strategy for website optimization (discussed later). However, website optimization is an iterative process and you can repeat the following loop after completing a cycle.

How to optimize the website - Infographic
  1. Ideas: Prepare a checklist of all the possible strategies for the target website to optimize.
  2. Prioritize: Prioritize the prepared checklist strategies and act on them.
  3. Test: Test the applied strategies for enhanced performance.
  4. Analyze: Analyze the impact and performance of the website and check if any further strategies are required.
  5. Optimize: For further enhancement, perform the cycle again until you achieve the best.

#1 Bottom-up strategy

This strategy starts from planning to production (Proactive). It defines a set of rules and actions before/while starting the actual development.

Bottom up strategy for website optimization

The above infographic represents the lifecycle of Bottom-Up strategy in web page optimization.

#2 Top-down strategy 

It is a reactive method, which analyses the existing process to find the issue/lag, then reworks on behavioural grounds to accomplish the target. It is a reverse engineering process to identify the performance-issue gap and methods to fix them.

You can identify the resources which are affecting in maximum page load by considering the following-

  • Resource size
  • Asset positioning
  • Render blockers
  • Uncompressed contents
  • Bad requests

Once you’ve identified the sources, lay down the process of optimizing the content and keep iterating to achieve the desired results. 

Basic checklist for both bottom-up and top-down strategies 

  1. Layout performance principles
    1. Page load time
    2. Responsiveness
    3. Minimizing the number of requests
    4. Use Cache headers
    5. Minify CSS and JS contents
    6. Use CSS sprites
    7. Encourage Lazy loading on contents wherever possible
    8. Avoid iframes and redirects
  2. Executive performance principles
    1. During application design
    2. During application development

Consider the following aspects during the design and development phase.

#1 Application design optimizations

  1. Simple & lightweight: Include only key functionalities on load to keep it lightweight.
  2. Client side components: Adopt client side validation to catch errors.
  3. On demand data loading: Use on-demand data instead of pre-loaded data. (E.g. use paginations, pop-up contents on click instead of on load)
  4. Asynchronous calls: Adopt implementation of AJAX calls from the presentation tier and the business tier.

#2 Application development optimizations

  1. Include JS files at the bottom of the page (to avoid render blocking of page).
  2. Combine multiple CSS files and optimize unwanted rules as per page requirements.
  3. Avoid using external scripts at the beginning of the page.
  4. Combine smaller images/icons to sprite & have optimi.
  5. Use CSS rules/files in the head section of the document.
  6. Reduce the number of requests to server.
  7. Implement server/browser caching on possible sections.
  8. Implement Mobile-specific sections to avoid overloading on small screen devices.

Below are few improvisation observations which are affected by optimizing the Webpage and it’s assets.

UI performance optimization and the performance gains - Infographic

We’re technology tinkerers, experimentalists, and experts in customer experience consulting. Get in touch with us at to know more about our ventures in website design and experience consulting. 


Knowledge thats worth delivered in your inbox

In a country that ranks second in the world for video consumption, cheap data is often attributed as the primary driver behind it. Although data is cheapest in India (Rs. 18.5/GB in 2018, Rs. 3.4/GB in 2019), regional content curated and consumed by natives contributed a great deal to the adoption of digital in rural India. Digital content consumption is expected to double, with over a billion of the population having a smartphone by the next decade. Let’s see what will change in the coming decade? But before, a quick insight into the existing Indian digital landscape.

India’s Digital Demography

Users: 94% of the urban population in India has an internet subscription; which falls to a considerable low among the rural populace (only 24%), according to TRAI.

There are four categories of internet users – Digital sophisticates (3%): these are tech-savvy, wealthy, and urban and prefer global and original content; Digital enthusiasts (36%): these are mainly smartphone & TV streaming users with preference for Hindi and regional content; Digital mainstream (59%): these are predominantly smartphone users and seek free content available online or bundled TV packages; Fringe users (2%): these are irregular users belonging to remote areas where internet connectivity is poor. (India’s Digital Future, KPMG, 2019)


Preferences: Nearly 30% of google search in India is voice-driven (Business Standard, 2019), indicating voice assistance will further progress linguistic democratization.

In India, YouTube accounts for nearly 265 million unique, active users. 95% of these users watch videos in their regional languages (Economic Times, 2018).

Google and Facebook account for nearly 80% of the digital advertisement in India (KPMG India analysis). In 2018, Google reported INR 93 billion in revenues from its operations in India, with 67% accruing from its digital ads platform. Also, video ads contribute to most of ad-spent (53%).

In 2018, there were 340 million smartphone users in India, which is projected to reach 829 million by 2022, according to the CISCO VNI report.

New Trends in Digital Content Consumption

Today, video streaming services have more subscribers (613 million) than traditional cable connection (556 million), according to VentureBeat news.

The media consumption in India has grown at a CAGR 9% during 2012-18 (IBEF, 2019), which is almost nine times that of the US. Print media and television remains the largest platform for advertisement, however the future might witness a shift.

The Indian FMCG sector spends the most on digital advertising. However, considering its overall budget, it’s only 16%. Interestingly, the BFSI sector spends nearly 38% of its marketing budget on digital advertising. (Dentsu Aegis Digital Report, 2019) This indicates that industries have started to realize and invest in digital platforms.

Regional content: According to KPMG in India analysis, consumers spend 35-43% of their time on regional videos on digital platforms. Digital content and media platforms like Zee5, Hotstar, Voot, and Amazon Prime Video are keen on producing original and region-based content. According to Financial Express, the cost to develop regional content is 30-40% lower than that of Hindi and has a larger viewership. 

Original content: The increased digital content consumption also demands originality. Today, content generation is not limited to the media and entertainment industry. For instance, in September 2019, Zomato launched a video streaming service on its app. The primary goal remains the same- customer engagement. Addressing the fact that food is not the only thing people consume these days, businesses are penetrating the minds of youth through quality and original content. 

Hotstar reports 80% of its viewership from dramas and movies and plans to invest INR 120 crores in creating original content.

The Future of Content in India and APAC

The next significant disruption in content consumption will come from 5G technology. Because digital content needs internet and India’s still dangling between 2G and lower cap of the 4G network. Setting up a 5G network will require a $500 billion investment in the next 5-7 years. The government is expecting the initial deployment of the 5G network by 2020 and roll-out by 2022.

5G technology will be able to handle more traffic at a higher speed, satisfying the demand for high data and the growing number of mobile users. HD content will become a thing of the past and consumers will be interacting with augmented reality in their everyday life. It will not only enhance augmented reality and virtual reality experiences but will also support IoT, autonomous vehicles, and automation to name a few. However, India isn’t quite ready for 5G technology yet. The following graph illustrates the countries which are about to enter the 5G era.


An overview of digital behavior in Japan, Korea, and Singapore which are among the top 10 countries to deploy 5G.

 JapanRepublic of KoreaSingapore
Internet penetration93%99.5%84.0%
Mobile penetration89.9%95.8%147.3%
Preferred device to go onlineSmartphone (59.7%)Smartphone (94.3%)
Online activityEmail (80.2%), weather report (65.8%), transport (63.4%)Communication (95.2%), information search (94.0%)

Source: SourceSource: India’s Digital Future, KPMG

5G will also make technologies like Augmented Reality, Virtual Reality, cloud-based gaming, IoT and OTT services commercially available.

Apart from this, AI (Artificial Intelligence) will continue to retain customer engagement through predictive analytics, machine learning, and natural language processing capabilities.

For example, Hotstar uses machine learning algorithms for personalized movie recommendations. It predicts user preferences by calculating total watch time per user per month. The company is leveraging AI technology for translations, audio to text conversions, video compression, object detection, and scene classification.

Also read – Your Shopping Cart just got a whole lot Smarter, this festive season.

We’re an AI-first products and solutions firm with extensive experience in insurance and consumer internet domains. Feel free to reach us out at for an intelligent digital solution to your business requirements.


Knowledge thats worth delivered in your inbox

Loading More Posts ...
Go Top

May i help you?

Our Website is
Best Experienced on
Chrome & Safari

safari icon