Tag Archives: embedded device

Blinking lights MSP430 FG461x

Photo of two experimenter boards for the MSP43...

Image via Wikipedia

I have been working on MSP430 for sometime now. It is an TI (Texas Instruments ) chip. Very fun to play with. We are using a MSP430FG461x series experimental board. This little experimental board has all the bells and whistles one may need to create any application from a home automation controller to a simple step-motor driver. TI provides very good documentation for this grown up toy.

Our first lab homework for this baby was :

By using the MSP430 FG4618 Microcontroller, write a program that controls the LED #1, #2,#4.When we perpetually push the two buttons at the right bottom corner of the board, all ofthe LEDs turn on.When we push perpetually one of the buttons, only the LED #4 blinks, the others turn off.When we push no buttons, the LED #1 and #2 blinks complementarily and the LED#4 turnsoff.

My biggest problem with this exercise was to find what led was connected to what port. However in the end I figured it all out.

Below you will find the program :

 

 

#include <msp430xG46x.h>

void initPortPins(void);

void main(void)
{ 
	 WDTCTL=WDTPW + WDTHOLD;
	 initPortPins(); 
	 while(1) {				  
	 	if (P1IN == (0x00))
	 	{
			P2OUT |= 0x06;
			P5OUT |= 0x02;
		}
		else if (P1IN == 0x03)
		{
			P2OUT &= 0x00;
			P5OUT &= 0x00;
			P2OUT |= 0x02;               					   
			__delay_cycles (40000);
			P2OUT &= 0x00;
			P2OUT |= 0x04;
			__delay_cycles (40000);
		}                                                                  
		else 
		{
			P2OUT &= 0x00;
			P5OUT &= 0x00;
			__delay_cycles (40000);
			P5OUT |= 0x02;
			__delay_cycles (40000);
		}
	 }
};

void initPortPins(void)
{
  P1DIR = 0x00;	// Set P2.2,1 as outputs
  P5DIR = 0x02; // Set P5.1 as output
  P2DIR = 0x06; // Set P2.1 to 1
};

Installing Ångström Linux on BeagleBoard

We have been able to install Ångström Linux to our beagle board. Ran into couple problems. The first one was we trusted BeagleBoard Beginners wiki just too much!!

You see we learned that we should NOT set any environment variables while using demo u-boot image which was downloaded from here. In fact what we did is we created our own Ångström image (from Ångström site) and simply installed that to our Linux partition of our SDHC card. And it worked beautifully. Though I must say first boot is a drag, very very slow.

Continue reading

The BeagleBoard Has Arrived!!

The long awaited Beagle board has arrived.


Even tough the team’s enthusiasm was up the roof we were not able to try it out. More on this later. I would also like to inform all people who is following this blog religiously that our project is now hosted on SourceForge.net at http://sourceforge.net/projects/theblackbox/ . And I have also set up a CVS so those who want to follow the code will be able to follow it from the net.

The CVS code is as follows

cvs -d:pserver:anonymous@theblackbox.cvs.sourceforge.net:/cvsroot/theblackbox login

cvs -z3 -d:pserver:anonymous@theblackbox.cvs.sourceforge.net:/cvsroot/theblackbox co -P modulename

I am sorry to say due to some weird problem you can not view the CVS modules from Sourceforge. You will need to use some kind of client. I am currently using Eclipse as my development IDE hence all my CVS materials comes from that. I have heard that TortoiseCVS is quite neat in its own way (for Windows) but I’d rather use Eclipse your choice.

Continue reading

Knowing when to fold ( i.e. SSH is better than Telnet )

You have probably seen my  previous post on connecting to Telnet through PHP although it was a novel idea I have just learned that (from a Novell site. No pun intended.) Telnet is very insecure!! To make things clearer Telnet usually creates connections as below;

Telnet-Client-server-unencrypted

Up here you can see a hacker can sniff the client-server connection and actually steal the user name and password sent by client. This really won’t do since if someone can spoof/hack/attack our embedded system which we will be adding to home appliances things may go awry. i.e. you will start seeing automated vacuum cleaners attacking your cat. ( Statistics show that H4X0Rz hate cats. )

Hence we can clearly see we need another way for the server and client to talk to each other. After some short Googling I am thinking of using SSH which is native to Linux/Unix based systems. Where the connection will be as below ;

SSH-client-server-encryptedAs you can see the SSH encryption creates a safer environment for the client and the server plus any DNS attacks and eavesdropping is clearly impossible. (if not probable.)

Henceforth a new PHP and Python (this time I will write the server+client in Python) shall be written. Please expect updates.

Connecting to PHP using telnet and sending data to the same port using Java

Hi there! Have been busy busy busy. What I needed was a way to the following;
Very Simple LayoutAbove you are looking at a very simple layout. ( Almost childishly simple ) The embedded device has Linux installed with a supposedly very light JVM ( Java Virtual Machine ) So if I am to send data to and from the server and display it to the user I have to do some scripting both in Java and in PHP. Let us first take a look at our universal Java-Socket program which basically opens and listens to a certain port (socket );

Continue reading