This blog has permanently moved to

Contact Form | Email Address

© 2018 All rights reserved by Boseji

Thank you for all your support.

Monday, July 30, 2012

How to use GPG on Windows : GnuPT

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: 

Wednesday, July 25, 2012

Easy Serial Transmitter on MSP430G Series

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
void simpleTx(unsigned char data)
    unsigned int i;
    unsigned char buf = data;
    SER(0);                                    //Start Bit
    SER(1);                                    //Stop Bit
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

    int i;
    P1OUT |= 0x01;                          // Set P1.0 LED on
    __delay_cycles(5000);                   // Delay
    P1OUT &= ~0x01;                         // Reset P1.0 LED off
    _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,

Monday, July 23, 2012

Serial Port Graphing Utility

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:


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




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.

Friday, July 20, 2012

RF Tutorials - Video Source

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

Monday, July 16, 2012

Improving DIY pcb at Hacker space - Adharlabs

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.

Monday, July 9, 2012

Compiling MSP430 GCC in Linux - An Upto Date Tutorial

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
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
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 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 install
cd ..
cd gdb-7.2-msp430
../gdb-7.2/configure --prefix=$PREFIX --target=msp430 --program-prefix="msp430-"
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).
cd msp430-libc-20120425/src
make PREFIX=$HOME/local/msp430 install
cd ../..

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

Finally you need to insert the PATH variable so that the msp430gcc install works all times.
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.

Friday, July 6, 2012

Embedded Systems Circular Queue

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.