Archive for 2012

We have been using Simplicity tool for EFM32 and evaluating on how to make good use of this tool. In that quest we found several tricks and mods around this tool. So we would like to share these useful tips for the benefit of the EFM32 users.

In our last post we came to know about the process of configuring the core clock for EFM32. Basically how to make the Coretx-M3 clock from the External Crystal source HFXO.
Next we would take a detailed look at the Energy modes in the EFM32 microcontroller. Again we are going to use the Keil MDK with GCC and the STK3700 kit.
In the EFM32 Microcontroller the Energy Management Unit(EMU) takes care of the setting the power, reset and clock-gating. Additionally it also takes care of Brownout detection for resetting the MCU if the voltage falls below a specified threshold to prevent spurious code execution. However we would focus more on the Energy modes that govern the operation of the Microcontroller core as well as its peripherals and clocks. This might be a bit confusing that CMU is responsible for clock then why EMU. Yes, the CMU is for conguration of the clocks, clock-gating and dividers, but the oscillator control also has additional parameters that are decided by the EMU. We would cone to clarity on this soon.

We have been doing quite a bit of development on low power Cortex-M3 microcontrollers. There were many nice lessons in low power design that we learned on our way. We would like to share this as a series of articles to helpful for making energy efficient designs.

We are really impressed by the low power features of EFM32 and wish to share a step by step guide in order to finally make a complete system that is more power efficient without compromising on the performance.
 One of the key components of a Microcontroller based system is the clock. This would ultimately decide the amount of switching that would take place inside the microcontroller. Finally the performance through put of the Cortex-M3 is again dependent on the clock, although not completely.
Thus the first and most important thing in a low power design would be to design the clocks properly and make sure that unused logic on the microcontroller is "clock-gated" when not in use. The term "clock-gating" means that we would prevent the clock from entering a particular peripheral or bus or even the CPU core when its not being used. The reduction in the spurious clock to unused peripherals would result in significant reduction in power consumption due to reduced switching losses.

Energy Micro Design contest is on, hurry because last date of submission is October,31st 2012. Although entries would be allowed in the second phase but you would surely not like to miss a free EFM32GG-STK3700, if your entry is selected.
 This is the Phase 1 of the contest and in this phase only design ideas need to be entered. Based on the merit of the idea toward "Low Power design using EFM32" the entry would be judged. Then 40 contestants would be chosen to compete in the next round.

Best of Luck to all Aspirants.
We were trying to get our new STM32 board working and in the pursuit of that we cane to know some interesting insights that are worth sharing.
This particular board contains the STM32F103VE series chip from ST Microelectronics. This chip is a Cortex-M3 with 72MHz clocking and quite impressive peripheral line up. We did not select this board, rather it was borrowed from one of our close friends. We wanted to evaluate the low power and speed features of this nice Cortex-M3 device.

For a long time we wondered how does inductive coupling works. It not until recently that we had a revelations:
Φ = v / ω 
Where,
 v – AC Voltage applied to the Coil 
   [volt = Joules/Coulomb = kg.m²/(Ampere . second³)]
 ω – Angular Frequency [radians/second]
 Φ - Magnetic Flux(Instantaneous) 
   [Weber = Joule . Second / Coulomb = Joule / Ampere = 
   kg.m²/(Ampere . second²)]

This is a very important relationship that shows how magnetic coupling really behaves. Taking it from this result we have the following conclusions:
  1. As the Angular Frequency decreases (ω = 2.π.freq) Flux increases
  2. As AC voltage applied increases then Flux increases
Hence this principle can be used for a wide variety of applications such as:
  • RF-ID Antenna
  • Inductive Charging
  • NFC
Well we will now tell you how we came to this equation finally. Thanks to Mr. Francois Pichon for explaining us in such intricate details of this phenomenon.

We were busy developing the next version of the Kicad-tools utility when we came across this interesting piece of C Language tangle.
Essentially we wanted to have something like this.
Here the 'a' is1 Byte data and the 'dta' is a bit field made up in an Union.
typedef struct{
    BYTE a;
    union{
        struct{
            BYTE b0:1;
            BYTE b1:1;
            BYTE b2:1;
            BYTE b3:1;
            BYTE b4:1;
            BYTE b5:1;
            BYTE b6:1;
            BYTE b7:1;
        }bits;
        BYTE dta;
    }combi;
}ctyp;

This is the code snippet of the data structure.
We need to assign this data structure some constant values to hold the configuration bits.

Another Launchpad in the making, you can get yours free.
Register in the website to get a Free Stellaris ARM Corext - M4F Launchpad. Hurry as only 25 would be available for this draw. This board would be available by 25th September 2012.
The initial costing would be $4.30 like the earlier MSP430 Launchpad.

We have made Stellaris ARM Cortex-M4F Launchpad wish List:
  • Same form factor as MSP430 Launchpad
  • Free Code Composer Studio like C2000
  • JTAG header for external target debugging
Here is an updated video:
video platformvideo managementvideo solutionsvideo player  
Just when we thought that DSP means "costly " stuff and out of hobbyist turf, what TI did was break ice on that. Texas Instruments C2000 Launchpad is a break though for hobbyist seeking to implement DSP processing. Now with this Piccolo chip-set family all real time control and closed loop PID would become breeze.
This kit contains a Galvanically isolated JTAG XDS100 which can be used to debug the on board TMS320F28027 of Piccolo Family.

The chip TMS320F28027 is a 60MHz DSP from the grand TMS320 family. The programs written for this chip are upgradable to any member of this TMS320. This means that if you need better ram or MAC units .etc. you have an upgrade path. Also in the F2802x family this chip has the highest features, possibly cost optimization the lower parts can also be used. TI is also providing samples of F28027 which means you can make custom boards for your projects.
We too plan to have some more reviews on this kit once ours arrives.

Here some useful links related to this innovative kit:
UPDATE: (14-Sept-2013)
This board is now available in Bharat(India) at Embedded Market website for INR2415/-
We found two very essential tools for PCB design and fabrication. These tools help to design various PCB features easily.

[1] Saturn PCB Design Toolkit
Saturn PCB Design INC provides this tool free of cost, thanks to them for this good tool for all PCB designers.This software allow to design the following features with great Ease:
  • Via - The through hole interconnect can be modeled for parasitic using this tool. You can also find out the Current Rating, Resonant Frequency and Power Dissipation
  • Trace Width Calculations
  • Transmission Line and Signal property calculations
  • Differential Pair Line design
  • Pad Stack Calculations
  • Crosstalk Calculation
  • Current carrying capacity for critical power traces
  • Embedded Resistances on PCB
  • Thermal Calculator for heat dissipation design
  • Planar Inductor design
  • And Many more very use full tools.
.In fact this tool is updated to IPC-2152 Standard for the PCB design as per industry standards.
Thanks to DP for publishing about this tool

[2] Footprint Expert from PCB Libraries
 This tool is quint-essential if you design complex footprints for the PCB. In general may IC vendors provide the PCB footprint dimensions. However if you want to design as per standard to be Maximized, Normalized or Small footprint dimensions it is not possible. This tool is IPC-7351A compilant and provides a wide verity of footprint design tools.
This also has an inbuilt library that helps you to find commonly used  once the calculator has found your desired dimensions of the PCB footprint the same can be replicated onto a library editor. This tool not only provides the way of calculating footprint but it also has Silkscreen, Solder-mask and Paste generation. Additionally the software automatically updates itself over the net to give the updated libraries of the components.

Many of us are wary of the world that is watching onto us what we are doing. May it be the big brother, google, hackers or even bystanders. We all need some sort of privacy while communicating. Why not use the war proven widely used AES encryption standard. You may say we need to get some tools since no one can sit around to write an AES encryption algo. Also you might say its weak for AES-256.

Well Open source and make our lives easier.
Gnu PG is a high security implementation of PGP which uses AES-2048 public key based algorithm.
Well that can take an attacker a long time to decipher.

This is a proven piece of software, however windows support is not directly available.
So initially WinPT was written and then the open sourced to GnuPT.

This piece of software is easy to install, create the private keys and import others public key.
The only thing to be shared between the users is each other public keys.
Here is the direct link to download: http://downloads.gnupt.de/gnupt.zip
Here are few video links that show how to install and proceed with key creation and sending data.
Installation: http://www.youtube.com/watch?v=bWfsalTgMCk
How to Do Encryption: http://www.youtube.com/watch?v=QpUx-qWPOug
How to work with the Thunderbird client for Email Encryption: 
http://www.youtube.com/watch?v=cB2Baqb9ZqI

We have tried out a few experiments on implementing Software Serial communication in MSP430G series microcontrollers. Trying to make the easiest of the code we implemented a blocking serial sender on MSP430. This can be used even in the smallest of the MSP430 and easily send out information that can be logged into a PC serial terminal.

For use with low frequency of the controller we need some thing that could use less number of cycles but still be fast enough with widest error tolerance in terms of baud rate. We found that 9600 BAUD was the best to use since +/-5% tolerance is good enough. In the MSP430G series microcontrollers the default frequency setting 1s about 1MHz even with or without 32.768MHz crystal as confirmed from datasheet. So we took this as the base.
Here is the Math workout:

MCU Clock Frequency = 1MHz
Serial BAUD rate = 9600BAUD = 9600Hz

Bit Time (@ 9600) = 104.16667 uS(Micro Seconds)
Now for the CPU to generate 9600 BAUD using the Toggle of Pins = 1MHz*104.1667uS

Then Count for NOPs for Bit Time = 104 Counts (Approx)
We know that Start Bit is Half Bit time , So Start Bit Time = 54 Counts

Here is a program that uses P1.1 of the MSP430 Launchpad board:


#include <msp430g2231.h>

#define SER_PORT P1OUT
#define SER_BIT     BIT1
#define SER(X) ((X)?(SER_PORT|=SER_BIT):(SER_PORT&=~SER_BIT))
void simpleTx(unsigned char data)
{
    unsigned int i;
    unsigned char buf = data;
    SER(0);                                    //Start Bit
    __delay_cycles(54);
    for(i=0;i<8;i++)
    {
          SER((buf&1));
           __delay_cycles(108);
           buf>>=1;
    }
    SER(1);                                    //Stop Bit
    __delay_cycles(108);
}
void main(void)
{
  BCSCTL1 |= DIVA_1;                        // ACLK/2
  WDTCTL = WDT_ADLY_1000;                   // WDT 1s/2 interval timer
  IE1 |= WDTIE;                             // Enable WDT interrupt
  P1DIR = 0xFF;                             // All P1.x outputs
  P1OUT = 0;                                // All P1.x reset
  P2DIR = 0xFF;                             // All P2.x outputs
  P2OUT = 0;                                // All P2.x reset

  while(1)
  {
    int i;
    P1OUT |= 0x01;                          // Set P1.0 LED on
    __delay_cycles(5000);                   // Delay
    P1OUT &= ~0x01;                         // Reset P1.0 LED off
    //SERIAL TX
    simpleTx('S');
    simpleTx('r');
    simpleTx('i');
    _BIS_SR(LPM3_bits + GIE);               // Enter LPM3
  }
}

#pragma vector=WDT_VECTOR
__interrupt void watchdog_timer (void)
{
    _BIC_SR_IRQ(LPM3_bits);                 // Clear LPM3 bits from 0(SR)
}

This program would print the string 'Sri' on the terminal every 2 Seconds and also Pulse an LED on P1.0.
Although this program uses the software delay loops and are power hungry but are easy to use tools for debugging some code bugs if needed. Considering the size of the code need its only a few lines. And it gives the default 9600BAUD serial so basic binary coded messages can still be sent at various parts of the program where time critically is low.

We though this might be a handy tool that can easily be used in any micro to perform debugging even if you dont have an exclusive UART available. We would be trying to extend it beyond this and try to see if we can further reduce the cycles and make it faster, may be some thing like 1-Wire Debugging that Freescale controllers come built in with. Let us know your suggestions and ideas on how we can make this better,
There has always been a need for charting the data logged from the embedded devices. This involves the process of Storing the data first with the embedded device and then fetching it onto a PC. Next tabulate the data in form of a spreadsheet and finally chart it into a graph pattern.
serialchart utility showing Graph Data

Serial port is a more than obvious choice for this type of data transfer.
We found a easy way through this, using serial port charting utilities.
serialchart utility GUI
 There have been a few project that provide this functionality using a GUI that can decode the format of data sent out from the embedded hardware.
Here are the two that have been most successful:
Serialchart is compatible on windows and has already been used for Arduino IMU Project.
Arduino IMU Project
There is a basic configuration needed for serialchart utility to work. We tested this out in one of our  MSP430 Launchpad projects and sent out the data in the CSV format. Here is the config script that we used:

[_setup_]
port=COM11  
baudrate=9600

width=1000
height=201
background_color = white

grid_h_origin = 100
grid_h_step = 10
grid_h_color = #EEE
grid_h_origin_color = #CCC

grid_v_origin = 0
grid_v_step = 10
grid_v_color = #EEE
grid_v_origin_color = transparent

[_default_]
min=-1
max=1

[Field1]
color=red

[Field2]
color=blue

The results of the graphing were same as the normal process but much easier to catch flaws.
We are still in process of evaluating the Kst tool. This is much powerful with lots of features. Another advantage it that this too is available both for linux as well as windows.
Once we are tthrough with evaluating this tool, we would post a complete update to complete this article.

We came across a set of videos by Andy Davis which explain in detail builds of armature RF circuits. And how one can easily begin with making simple RF Circuits to finally end up being a pro.
We would like to Andy Davis for sharing with us such good insights.
Here are the Video Links:
1. Basic FM Radio Transmitter and its design gotchas: http://www.youtube.com/watch?v=gkU48QAcAW0
2. Improved FM Radio Transmitter: http://www.youtube.com/watch?v=QGcFAJHqXzs
3. High Quality FM Radio Transmitter: http://www.youtube.com/watch?v=8Vkeco8zS5g

There are some special videos targeted to make RF Circuit building Easier:
1. How to make a Tool for Cut Slots and make RF boards:  http://www.youtube.com/watch?v=uFLdDTT5-wk
2. Improved tool using a broken Drill: http://www.youtube.com/watch?v=RKdsXU5iIF0


We had been using the DIY Pcb making technique since a long time. However we had not been able to go beyond 25mil - 25mil -25mil (.635mm-.635mm-.635mm)spacing. After a bit of searching and optimization we found the process best suited to our requirements.
We need .5mm pitch to workout. That was the primary criteria to make the PCB viable. So we found an old article called 'Make DIY PCB Professionally'. This immediately caught our attention and we tried to improve upon. After all, hacker spaces like ours needs this help all the time. We were able save a lot of cost on the PCB prototypes as well as time with this update.
Here is the video of this article:
We found that the process step that was causing errors was the cleaning of the residue from the scratched copper clad board. We tried to use Acetone instead of IsoPropanol and it worked with magic to say.
We would update this post with more info once this PCB is complete. Also we have prepared a PCB to test the process capability of the DIY Pcb process. This PCB would help to calibrate the process of making the DIY Pcb better.
Update  30th March 2014:  
This guide is not longer valid as a better alternative is available and the current CVS MSPGCC does not compile as per the below technique any more

You might be aware of our transition to linux, we pledge to provide support and tutorial to help more people to migrate to Linux. The first thing that scares away many electronics enthusiast is the non-availability of tools. However, that's only a myth created by novices. In this article we would like to summarize our resent adventure with 'compiling the compiler' on our favourite microcontroller MSP430 from Texas Instruments(r). Although the process is detailed in the MSP430GCC wiki still we thought it would be worthwhile to demonstrate it step by step, explaining the ways to get it dome faster.

[1] Preparation
First of all we need to prepare the linux machine for the compilation. We used  Ubuntu 11.04 Linux based machine. Here are the packages that you need to install:
  • GCC System
    • gcc-4.x (>=4.4.6) :- we used the one available from the Ubuntu software distribution
    • make (>=3.81-8.1)
    • gcc-4.x-base (>=4.6)
    • g++ (>=4.6) :- if needed to support the C++ compiler (recommended)
  • Auto Make bindings
    • sed (>=4.2.1-9)
    • bison (>=1:2.4.1)
    • automake (>=1.11.1)
    • gawk (>=3.1.8)
    • mawk (>=3.1.8)
  • For Debugger(mspdebug)
    • libusb-1.0.0
    • libusb-1.0.0-dev
  • Lib dependency
    • libreadline6-dev
  • Generic
    • bzip2
To install these packages we can use 'apt get' or software center or synaptic package manager. For Ubuntu the software repository already offers all the above packages.

[2] Downloads
Now we need to get the per-requisites for the compiler packages and the msp-gcc patches. These need to be downloaded into a specific directory say '~/Downloads/MSP430' where '~' means home directory of the user. We would also specify if you prefer to have the LTS release files or just have whatever is updated one.
Once you all these files then you are ready to go on with the next step.
Note: If you go for the '.bz2' files they are smaller than '.gz' files.

[3] Arranging the Files
We need to make sure the files have been extracted and placed in the correct locations to begin the compilation.
We assume that you have kept all these files at a common location
.e.g. 'msp430-build' We would first look at the Latest version compile. The LTS version can also be compiled in the similar manner. So here is the 'msp430-build' directory:
binutils-2.22.tar.gz                 msp430-gdb-7.2a-20111205.patch
gcc-4.7.0.tar.gz                     msp430-libc-20120425.tar.bz2
gdb-7.2a.tar.gz                      msp430mcu-20120425.tar.bz2
msp430-binutils-2.22-20120407.patch  mspdebug-0.19.tar.gz
msp430-gcc-4.7.0-20120425.patch
Now you need to extract all the files:
tar -xvf binutils-2.22.tar.gz
tar -xvf gcc-4.7.0.tar.gz
tar -xvf gdb-7.2a.tar.gz
tar -xvjf msp430-libc-20120425.tar.bz2
tar -xvjf msp430mcu-20120425.tar.bz2
tar -xvf mspdebug-0.19.tar.gz
After this lets create the Build Directory structure since you would need it for running the custom builds:
mkdir binutils-2.22-msp430
mkdir gcc-4.7.0-msp430
mkdir gdb-7.2-msp430

[4] Apply the PATCH and Special Settings
In order to build the compiler toolchain we need to add the PATCH supplied.
cd binutils-2.22
patch -p1<../msp430-binutils-2.22-20120407.patch
cd ..
cd gdb-7.2
patch -p1<../msp430-gdb-7.2a-20111205.patch
cd ..
Before we Apply the Patch to GCC we need to make sure that the dependencies are taken care of.
cd gcc-4.7.0
./contrib/download_prerequisites
cd ..
This will download the dependencies that are needed by the GCC.
Now after the downloading is complete, PATCH the file(Assuming you are in.
cd gcc-4.7.0
patch -p1<../msp430-gcc-4.7.0-20120425.patch
cd ..
Now we need to setup the Install location so that the build works accordingly:
mkdir -p ~/local/msp430
export PREFIX="$HOME/local/msp430/"
We would like to install into '<HOME DIR>/local/msp430'

[5] Build the Toolchain And Install  
(Long Step so be ready to spend some time)
cd binutils-2.22-msp430
../binutils-2.22/configure --prefix=$PREFIX --target=msp430 --program-prefix="msp430-"
make
make install
cd ..
cd gcc-4.7.0-msp430
../gcc-4.7.0/configure --prefix=$PREFIX --target=msp430 --enable-languages=c,c++ --program-prefix="msp430-"
make
make install
cd ..
cd gdb-7.2-msp430
../gdb-7.2/configure --prefix=$PREFIX --target=msp430 --program-prefix="msp430-"
make
make install
cd ..
Now the Toolchain is ready to do the basics.
First We need to Install the MCU files:
cd msp430mcu-20120425
export MSP430MCU_ROOT=`pwd`
./scripts/install.sh $PREFIX
cd ..
Now we need to compile and install the libc module(You will also come to know if the mspgcc installation really worked or not here).
export PATH=$PATH:$PREFIX
cd msp430-libc-20120425/src
make PREFIX=$HOME/local/msp430 install
cd ../..

[6] Building the mspdebug
cd mspdebug-0.19
make
make install
Now  mspdebug is ready

Finally you need to insert the PATH variable so that the msp430gcc install works all times.
cd
echo 'PATH=$PATH:$HOME/local/msp430/bin' >> .bashrc

Let us know your tryst with 'compiling the compiler' for MSP430 or if you are having any troubles with the compilation.
 
We are also trying to develop a script that can automatically download the required packages and then do the compile for you. This make it like the 'setup' wizards from the windows times.
We published out long time used and proven Circular Queue software. The is specifically targeted to be used in microcontroller with memory constrains. The Internal logic of the circular queue features some of the most needed features to make decoding of messages possible. In order to provide the multi-entry and thread safe functionality there is inherent go-no-go logic built into the queue data-structure.

This library can also be used with RTOS by providing the 'CRITICAL' section attributes where ever needed.
An PC based example is also provided to help understand the operation of the circular queue.
We would be publishing the UART example for this library soon.
We took up an unusual challenge today - Installing Windows after Installing Linux.
As you might know we recently migrated to Linux, we needed some of our older software to run. Unfortunately they work only on Windows, so we had a problem at hands.
Here is what we had the initial setup:
  • Laptop with Ubuntu 11.10 Installed
  • Partition 1: /boot - for storing the GRUB loader (256MB max size)
  • Partition 2: Extended Partition
    • Partition 3: / - For root partition (20GB more than enough)
    • Partition 4: SWAP -Linux Swap partition (2GB safe bet)
    • Partition 5: /backup - to store Image backups of Partition 1 & 3 using clonezilla (20GB )
    • Partition 6: /home - to store the user files and profiles (220GB )
  • All on a 500GB Standard Seagate Laptop SATA drive
Now we had some empty space at the end of the drive , but probably not sufficient to install the complete windows package.
Here is what we planned to execute:
  • Shrink the Partition 6 to 100GB only ( This was more than sufficient to have even a kernel compile)
  • Then Shrink the Partition 2 ( Extended Partition ) such that there is 60GB space for the windows installation. Good enough to install two FPGA suits(ISE & Quartus)
  • Create a 60GB NTFS partition at the end of the drive for windows to recognize it.
  • Then install Windows XP onto this partition
  • Finally replace the MBR with GRUB2 installation 
  • Also add windows into the boot list
In order to do all the above we first made a USB bootable pendrive from Ubuntu Live CD. This would be our Saviour in case we loose in between. And it did prove to be really helpful.
  • We first made the Partition modifications using GParted using the Ubuntu  pendrive that we prepared earlier.
  • Next as usual installed the windows operating system.
  • After this we had a working Windows XP version, and the MBR had already been overwritten. 
So now we had the job of making an Image of the MBR before we run with our modifications.
First we boot again using the Ubuntu pendrive and then start a terminal to execute the following commands:
sudo -i
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
grub-install --root-directory=/mnt /dev/sda
chroot /mnt grub-update
After this was complete we were sure that the MBR has been replaced by a new copy of the GRUB2.

The last thing that we needed to do was to make the /dev/sda1 bootable for GRUB to boot. For that we used the GParted to set the boot flag on the drive.
Finally we had a dual booting system with Windows working even thought it was installed after Linux.
One word of caution that the Boot-repair technique suggested in Ubuntu Forums wont work if the geometry or order of the partitions is changed or not as per expected by Boot-repair tool.
Hope that this article would helpful. Let us know your feedback if you come across any problems.

For Further Reading:
http://ubuntuguide.net/how-to-restore-grub-2-after-reinstalling-windows-xpvistawin7/
http://www.dedoimedo.com/computers/grub-2.html

As we all know there are several embedded tools and applications that don't work well with Windows 7. We wanted to know if there was a possibility to make some Virtual Machine go to USB pendrive and then we don't need to install any thing on PC.
Initially the thought was that Virtual Machines are big things and they need hard integration with the Host OS to run.
We were proved wrong, Virtual Box can be made Portable.
Portable-Virtual-Box is a project that has made it possible to have portable version of the standard Virtual Box as well as the virtual machines them selves in the USB drives.
  • Supports both 32bit and 64bit Virtual Machines
  • Dynamically loads the needed drivers for the VM to run
  • Full Network Support
  • Supports Standard Serial Port
Presently the version available is Portable-VirtualBox_v4.1.14-Starter_v6.4.9-Win_all.exe.
Although this is slightly older than the present Virtual Box but thats not of hindrance since you have same updates enabled in the portable install. So after installing this you can upgrade your virtual box to the latest version.
The only impediment is installation of the Extensions Pack for USB features in Virtual Box. If you don't install this pack then USB EHCI 2.0 features are not enabled. So you wont be able to access the Pendrives or USB serial or debuggers from your VM.
We are looking out to have a solution for this.

Visit this website for more details: http://www.vbox.me/
We were trying to evaluate if there is any quick way to give some short cut commands in Linux shell. We wanted to have this without the need to create many script files and path jugglery.

Then we found the solution by adding command 'alias' in the local profile for the shell.

We know that the default shell configuration is located at ~/.bashrc
This file executes each time we enter the bash shell. So if you add the alias commands to this file then you can access them any time you use the shell.
It is generally  recommended to add the alias commands to the end of this file.

The syntax for the 'alias' is in the following way:

alias {shortname}='{actual command}'

Let us have a look at the use-case scenarios to shows how useful this can be:
  • Changing to a particular project directory which is long
    • eg: /home/username/Documents/githubrepos/Kicad-tools
    • This needs to be  typed all the time to reach that place
    • add the following:
alias proj='cd /home/username/Documents/githubrepos/Kicad-tools'
  • Error while typing 'cd..' instead of 'cd ..' to change to upper directory
    •  add the following:
alias cd..='cd ..'
  • Emulation of favorite dos commands
    • eg: dir, md, deltree
    • add the following:
alias dir='ls -alh'
alias md='mkdir'
alias deltree='rm -rf'
  • Shortcut commands for git operations 
    • eg: git add transformed to ga or gita
    • eg: gitk --all transformed to greal
    • add the following:
alias ga='git add'
alias greal='gitk --all &'
This list can go on of the single short commands that can be implemented in this manner.

There is a detailed tutorial available from NixCraft site.
There is something special about the usage of Static type in C programming. We were caught unaware of this and tried to fix the issue, that was the time when we really learned the usage of static in its true sense.

We came across a bug in the firmware for LATHI project. The bug surfaced in the display driver for the Nokia5100 LCD. The display buffer was a normal Auto class variable. In case when there was an emergency situation detected the display driver control is taken over by the corresponding Panic mode task. Due to the inability to use the UI task all the base functions of the GUI have been partially implemented for Panic mode. This means that the Driver context would be altered when it is in use by Panic mode.
While exit from the Panic mode into the normal schedule the display would get corrupted.  In order to avoid this every time on each exit from Panic mode, the display was being completely reinitialized in the code. Hence it was not possible to return to the same view that was before the Panic mode entry.

There were two solutions for us -
1. Rewrite the display driver & UI task to support context saving.
2. Save display state before processing the Panic Mode task.

Both solutions had their merits as well as demerits. We tried out both of them and still the result was the same. This was not good we were not even close to the solution.

Then while debugging we found that the display buffer was being accessed by one of the higher level driver functions.
Although the higher level function was in a separate file we were still able to make direct access using `extern`. This was the cause of the real problem.
We modified this high level function and made the display buffer as `static` solving the real problem.

Thus we would like to summaries when static class becomes imperative. So that you can avoid the problem that we diagnosed.

Here are a few points from Wikipedia:
  • In the C programming language, static is used with global variables and functions to set their scope to the containing file. 
  • In local variables, static is used to store the variable in the statically allocated memory instead of the automatically allocated memory. 
  • While the language does not dictate the implementation of either type of memory, statically allocated memory is typically reserved in data segment of the program at compile time, while the automatically allocated memory is normally implemented as a transient call stack.
 Now detailing the Usage scenarios for Static in C:
  1. Static for Global Variables:
    •  When the global variables need to accessible only in one file
    • Compiler would guarantee that the variable has been declared and not omitted during optimization
  2.  Static for Local Variables:
    • When the values of the variable needs to be retained for every function call. They need file scope and not be allocated in the stack like usual local variables.
    • Useful while saving context of who called the function before the present callee.
    • Also useful for unique ID generation and pointer arithmetic
  3. Static for Functions:
    • The use of static in functions make sure that the function only has the file scope
    • This function even if declared in the header file cant be accessed by other files unless the function is explicitly defined in that file.
    • Very helpful in implementing local Fix in software.
It is essential to note that the behavior of Static in languages such as C++ Java and C# does not comply to the above said use cases.

We have recently received the PCBs of our up coming project ADK Picoboard. Initially from few of the blogs that we follow, we got to know about the discrepancies in the PCB quality and 100% E-Test failures from Eastern PCB vendors. We were a bit worried. But from our past experience with Seeedstudio Fusion service we had never faced any issues on the boards.
So this time we decided to perform an inspection of the PCBs ourselves. Here are some snaps of the PCB.
TQFP package with probe marks
Regulators and Caps with probe marks

We can clearly see the Flying-probe marks even on the TQFP package as well as on the regulator side.
This clearly proves that Seeedstudio Fusion PCB service does perform 50% E-test as promised.

We are thankful to Seeed for keeping up their quality promise and commitment to helping Open Source Hardware.

Embracing Linux for Good

Saturday, April 14, 2012
Tag : ,
We have been struggling lately with Windows XP operating system. Unfortunately we were unable to switch to Linux since long. However we tried to use the virtual machine available for Ubuntu. Recently we procured a 1TB portable hard disk and were able to back up the windows entire system. Finally we installed the recent version of Ubuntu 11.10
Now we have completely transitioned to Linux and done with our support troubles with Microsoft and thence related.
This means we would be posting more tips and tricks for Linux including tutorials and Problem walk throughs.


We were avid fans of Gadgetfactory and now we have more reason to celebrate!!
ZPUino 1.0 Released
The release of ZPUino marks a step worthy of historical mention in soft-core processors. The existing hardware such as the Papilio One and SE3 boards are supported by this remarkably fast processor.

We have already tired this with the Papilio One 250k board and have been successful in executing Serial as well as GPIO control. All in Arduino Style.
The best part of this soft-core processor is that it has an Arduino IDE specially made.
All Functions are nearly the same as Arduino but since the core runs at 100MHz-96MHz you can expect much more number crunching capability.

Here is a Document that Details the ZPUino Processor[PDF]:
http://www.alvie.com/zpuino/downloads/zpuino-1.0.pdf

We have a step by step procedure for using the ZPUino running on Papilio One 250k on Windows:

1. Download the Following

2. Install the Papilio Loader and Flash the Papilio Board
3. Now unzip the ZPUino IDE to the desired folder. For linux users you might need to locate the ID and the tool chain separately. We tried it out on a windows PC as the Papilio loader is not readily available as linux executable form.
4. Open the IDE and write your desired program. Example:
void setup()
{
  Serial.begin(9600);
  pinMode(13,OUTPUT);
  Serial.print("Start");
}

void loop()
{
  digitalWrite(13,HIGH);
  delay(1000);
  digitalWrite(13,LOW);
  delay(1000);
  Serial.print("S");
}

5. Now configure your Arduino IDE to show the desired board (Tools->Board->->Papilio One 250k) and Serial Port to the correct one. Yes there might be a confusion on the Serial port side but you can try the two you see. For Linux also you would be able to see the /dev/ttyUSB0 and /dev/ttyUSB1 so you need to select the correct one. Or just to trial and error.
6. Hit 'Upload' button - Thats all

For more information following are the links to look for:

Papilio Hardware: http://papilio.cc/index.php?n=Papilio.Hardware

Release Posts:
http://zpuino.blogspot.in/2012/03/preparing-release-10.html
http://www.gadgetfactory.net/2012/04/zpuino-1-0-version-is-now-officially-released/

Papilio Loader: https://github.com/GadgetFactory/Papilio-Loader

Main Website:
http://www.alvie.com/zpuino/index.html
http://www.alvie.com/zpuino/download.html

We both thank and congratulate Alvie on this Release !!
We have been working towards improving the modgen to the best of usability and features.
Today we have made a major milestone release with lots of capabilities and features in store.
Default screen for modgen
The following is a brief of what feature enhancements that have been made in this release:

  • Package generation now supported for SIP,DIP,CONN and QUAD
  • Automatic Name and Description generation for SIP connectors (Berg headers)
  • Picture based description of parameters for each package
  • DIP type - can be used to make both SMD as well as through hole packages eg. PDIP,SOIC,SSOP,TSSOP,MSOP,SOT23-6
  • CONN type - can be used to make dual row header and SMD board to board connectors also
  • QUAD type can be used to make QFP,QFN and rectangular packages
  • In the QUAD mode the rectangular packages such as CSP,LLCP types generally found in accelerometers can now be generated.
  • Automatic GUI adjustments as per the Package have been enabled
  • Converter Feature to help Mil to mm and viz. conversion
  • Support for Locking type SIP header generation

At present the unit scope for the software is 'mil' reason being Kicad encodes and stores, the co-ordinate and size data in 10s of Mils and hence we re also following the same. The only dependency we found was that this software needs Python 2.7 or higher.

Github: https://github.com/AdharLabs/Kicad-tools/tree/master/modgen

Your suggestions are welcome. We are still trying out some more features that might make this tool even better.

Here is a wish list:

  • Integration of Libgen to help in adding the PCB Package association using Footprint wildcards in the library symbols that are generated.
  • Optional multi package support for single Schematics library symbol
  • Automatic Description and Keyword generation for all the Packages supported in modgen
  • IPC-7351 standard footprint generation
  • Packages for Mechanical Holes, Testpoints, Fiducials, SOT23-3, and other Passive packages


We have developed a GUI based module generator for Kicad PCBnew tool in Python using Tkinter.
UPDATE: New Features(24-03-2012)!!

This tool support generation of Berg Stick connector called the Single Inline Package(SIP). The units supported are Mil. We plan to include the support for MM units. This tool also supports the famous "Sparkfun Locking" Trick for the connectors. The files generated have an .emp extension so that they can be imported into the Module Editor easily.

The code is available in GitHub:
https://github.com/AdharLabs/Kicad-tools/tree/master/modgen

We are still in process of completing the tutorial for this tool although its more or less self explanatory.
There are several features that need to be included and here is a to do list:
- Add mm units support
- Add picture for each footprint type
- Add support for Dual Row Connector and DIP packages
- Add support for QFP packages

Let us know your suggestions.

OpenSource Furniture

Monday, March 12, 2012
SketchChair is an open source software to prepare Laser cut furniture designs.
The Ponoko service can be used to manufacture these designs. In fact any laser cutting service can be used. The furniture designed in this software uses the jigsaw fixing technique in which pieces of planar components are fitted orthogonally to make a strong but light weight fixture. Have a look at the collection already prepared furniture:
For more info checkout - http://diatom.cc/sketchchair

Ionizing radiations transformed into music.
These radiations are emitted by naturally occurring isotopes such as C-14 in Human Body. Whey these isotopes decay to attain stable nuclear configurations they emit Xrays, Alpa/Beta particles or even gama rays. The frequency of this type of ionizing radiation when scaled down to audible range can be transformed into music. The periodicity can be transformed into tones and you have an song being performed by a bunch of them.
Checkout the Radioactive Orchestra online by selecting your favorite isotopes you can make your own song.

From physics.org

libgen tool update

Thursday, February 23, 2012
We have updated the libgen tool now with the following features:

  • Automatic file name for .lib files using input XML file name
  • Generator for .dcm file using updated 'description' and 'keyword' attributes
  • Better checking for format errors in XML file

Next we are working on the Tk based GUI to generate the XML files instead of writing them.
This would make it worthwhile for any one to be able to make the component even without knowing the XML format supported.
Keep posting your suggestions and contribute to help us develop this tool better.
As we stated earlier that we have taken up the task of moving to Kicad, this is our first step. We have successfully created a tool called libgen for creating Eeschema Libary components.

This tool is based on Python and can generate one Component from a XML file.This tool in multiple ways emulates the Quick KICAD Library Component Builder online tool for generating the symbols.
However since its standalone it becomes easier to edit and customize. Another important feature is the XML based component generation. This makes it easy to customize the pins in text rather than selecting again and again. All the Pins can be Named using the XML file and there EType as per the Kicad norms can also be set.

Moving to Kicad

Friday, February 3, 2012
Tag : ,
We have taken the decision to move to Kicad for good reasons.
 We were using the Hobbyist version of Eagle and had the following limitations:
  • Multi-layer not possible
  • Board Size Limitations
Although our Eagle library was functional with every day components, still we struggled when we had to introduce new components. And most of the OSS hardware supporters were using Eagle, so we kept working with it. However recently the board size needed was much bigger and we could not fit the schematics in one page. We were circumventing this disadvantage using multiple boards but it was still a handicap. Thus we turned towards completely open source solution!

We had evaluated Kicad back in 2010 but were not satisfied. However as time passed Kicad became considerably better and much more stable. Then we started noticing many people are developing libraries for this tool. This is active and updated FAQ for this tool. This tool is Multi-platform which makes it even more advantageous. Although Eagle supported the same feature but you need to buy one more license if there are 2 PC using the tool.

Thus in all support for Kicad has grown and it made perfect sense for the future developments. It would be one time effort of porting and creating libraries. We would try to document the process so that more people can use this wonderful tool.

Here are a few links that help you to get resources on Kicad:
Download Link: http://kicad.sourceforge.net/wiki/Downloads
Home Page: http://kicad.sourceforge.net/wiki/Main_Page
Libraries : http://www.kicadlib.org/
Schematics Library Generator: http://kicad.rohrbacher.net/quicklib.php

We are presently working on making an easy to use Module & Library generator for Kicad using Python. We would be posting on that development soon.

हम 'इलेक्ट्रोनिक्स भारत के लिय ' यह प्रण लेते है की हम अपने देश के स्वाभीमान को सर्वोच स्थान देंगे |
हम सब अपने रचनात्मक कार्यो को इस लक्ष्य पर केन्द्रीत क़रेगे |

वन्दे मातरम |

Bus-Pirate broke down

Monday, January 23, 2012
Tag :
We were disabled recently as our trusty tool the Bus-Pirate just broke down.

Possibly it was wrong voltage levels that took it out. Now we cant get the Supply command 'W' working.
Most of development uses this nice little device. Now we have to order a new Bus-pirate to continue our projects. Mostly repair work for this one would take more time which we are always short of. Well we would post an update once we are back with a new one.
Atomic-scale electronics follow classical, not quantum, rules.
B. WEBBER

Atomic electrical components conduct just like conventional wires, giving a new lease of life to Moore's law. - Nature

Microchips could keep on getting smaller and more powerful for years to come. Research shows that wires just a few nanometres wide conduct electricity in the same way as the much larger components of existing devices, rather than being adversely affected by quantum mechanics.

As manufacturing technology improves and costs fall, the number of transistors that can be squeezed onto an integrated circuit roughly doubles every two years. This trend, known as Moore's law, was first observed in the 1960s by Gordon Moore, the co-founder of chip manufacturer Intel, based in Santa Clara, California. But transistors have now become so small that scientists have predicted that it may not be long before their performance is compromised by unpredictable quantum effects.

Resistivity, a measure of how much a material opposes the flow of electrical current, has previously been shown to increase exponentially as the width of a wire decreases below 10 nanometres, which would impede the performance of devices with atomic-scale components.

News via Adafruit blog.
Some More Updates at New post(22/11/2012)

We have all used breadboards, or those who plan to jump into the fascinating world of electronics need to know about them. This article focuses on introducing breadboards inside out, to help people use them and prototype their innovations faster. We would walk through Bread board concepts, connecting various chips & devices, efficient prototyping and documenting the designs.

[1] What is a Bread Board ?
Bread Board or more precisely Solder-less Bread Board is one of the essential tools for any one stating with electronics or microcontrollers. It is useful for both Pro's and beginners alike. Here are pictures of the different breadboards that one can find.
Older Variety widely available in Bharat(India)
Newer Variety slightly Costly in Bharat(India)
Smaller ones (Half Size) available from Adafruit
Oldest form of Bread boards (Not available now)
More recent Transparent Fancy bread board from Sparkfun
Apart from the above breadboards are also available in kit form. Which include optional Power supply Connections and other connectivity options.
With Power supply from Sparkfun


[2] General know how on Length Units used in Electronics.Going forward in this tutorial it is important to note that we would be using a particular unit a lot of times "mil" or also popularly known as "TH". It is 1000th of an Inch. Here is a conversion table that might come in Handy.
1 Inch =>  1000 mil  =>    2.54 cm =>    25.4 mm
1 mil  => 0.001 Inch => 0.00254 cm =>   0.025 mm
Also: 
1 mm => 0.1 cm => 39.37 mil=> 0.03937 Inch

It is important to know this conversion as most of the Printed Circuit Board unit are in "mil" and the data-sheet units are in "mm". There has always been a classical fight between the more accurate one. However most of the things in PCB arena are still in "mil" and using mm means using 4-6 decimal precision in the current boards.
Thus we prefer to use the "mil" unit more than mm. However we would try to provide a proper conversion available for the parts that have been measured. There is a handy converter available in the blog which can convert in any direction either "mil" to mm or vise-versa.

[3]Cool Bread Board tricksWe have collected a set of great bread board tricks that are a real time saver.

  

In this case, one end of each resistor is pushed into the solder less breadboard, while the other end of each resistor has a wire soldered to it. The other end of the wire connects to the appropriate LED segment.


Easy way to connect the common CR2032 Battery needed for RTC or even MSP430.

Simple 5V power supply for Bread board this above is an Instructable that you can build your self.
Commercial ones are also available from: Adafruit, Seeedstudio, Sparkfun

This is an easy way by soldering the terminals of the commonly used SMD resistors, capacitors or even transistors to the bregs they can be inserted easily into the breadboard.


An easy way to make a makeshift but reliable SD card holder for the bread board.For some additional tricks refer to 43oh Blog.

Use of Masking tape to mention helpful references. Also this would be helpful in removing the circuits when you don't need them on the bread board any longer.

You can make your own bread board using IC DIP sockets by joining them together in the same fashion as in bread boards.

This is quite handy specially when you are out and still want to do some prototyping. All you have to do is connect the USB of your Laptop or Card USB mp3 player charger and they you go.

These modules are some of the common things that you might use. So its a good idea to make some of them. They you dont need to rig up the same old circuit again and again.

The are the tricks that we use commonly. Thanks to this Instructable we have great ease in our prototyping efforts.

Bread Board Jumpers
The secret of all hackers success with breadboards. These are indispensable and high recommended to buy one set. Its a one time investment though not so costly, but its just eases rigging up circuits a lot. These are available commercially from: Seeedstudio
These jumpers are made using berg pins and some heat shrink sleeves on normal wires.

Update: 23,January,2012
Here are some more Tricks from Vitya

Using hot-glue some basic vero board and careful soldering we can have SMD IC right on the Bread Board

A nice LED strip that can save a lot of space and rig up time designed by Vitya. Visit his blog for more info.


Easy to use 8 button for bread board use. Can help to offload the de-bounding circuit from bread board to save space.

Definitely a useful and bold type of display while bread board. This offloads the circuit needed for decoding BCD to 7-Segment Display from the bread board.

Thanks to Vitya for the links.


"Well this is far from Complete So we would keep adding more and Help Us Fill in more details"

Welcome to Boseji's Blog

Popular Post

Blogger templates

Welcome

Creation by Electronics Hobbyists from Bharat(India) to encourage & help people. This blog hosts the numerous innovations, discoveries and projects we provide.
Our Research Wing Adhar Labs
Contact Form | Email Address
We Support Open Source Hardware Definition v1.0
Creative Commons License
All works on this blog are licensed under a
Creative Commons Attribution-ShareAlike 3.0 Unported License.
Based on a work at forbharat.wordpress.com and m8051.blogspot.com.

Permissions beyond the scope of this license may be available at http://forbharat.wordpress.com/permissions/.
Thank you for all your support.

© A.D.H.A.R Labs Research 2008-2013 . Powered by Blogger.

Follow by Email

Followers

Blog Archive

PCB Unit Converter

mils
mm

- Copyright © Electronics for Bharat -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -