New domain and blog

New domain and blog
Please head over to my new domain to view my blog and current projects

Wednesday, 12 December 2012

Raspberry Pi meets TI LaunchPad MSP430

A few weeks ago I got a TI LaunchPad. With the help of a few tutorials I managed to get the basic input, output and UART working. As most of the examples that I could find are for CCS, I decided to go that route instead of IAR.

My next step was to get my LaunchPad working with my Raspberry Pi via the USB port. After a bit of playing around and installing a few programs, I managed to get it to work. Below is how I got a program  written, compiled and programmed onto the LaunchPad from the Raspberry Pi.

First you have to install a few programs with apt-get.
$sudo apt-get install binutils-msp430
$sudo apt-get install gcc-msp430

$sudo apt-get install msp430mcu

$sudo apt-get install mspdebug

$sudo apt-get install msp430-libc
You might have to run
$sudo apt-get update
before installing the modules.

Next run mspdebug to make sure that there are no errors. If there are no errors type exit to close the debugger.
$sudo mspdebug rf2500
Now that you have everything installed, we need to create the program. I use nano text editor to write my program.
$sudo nano button_ISR.c

This program uses the two LED's and one push button on the LaunchPad. When the button is pressed, an interrupt is generated and then the LED's are toggled.

Close nano saving the changes.

The program then needs to be compiled.
$sudo msp430-gcc -mmcu=msp430g2553 -g -o BUTTON_ISR button_ISR.c
The program should compile without any errors and now you are able to run the debugger.
$sudo mspdebug rf2500
Now program the device
prog BUTTON_ISR
and run the program
run
CTRL+c will stop the program running and exit will close the debugger.

In the next post I will show you how to communicate between the TI LaunchPad and Raspberry Pi via hardware UART and the USB connection.

Greg

Monday, 10 December 2012

Raspberry Pi: Edimax EW-7811UN WiFi Dongle

I recently bought myself an Edimax Wifi dongle to use with my Raspberry Pi. My router is hidden away so I got tired of running a network cable to my Raspberry Pi. The Edimax WiFi dongle was ideal as it is really inexpensive and very small.

It took a while for me to get it set up correctly but eventually I got there. To set up the WiFi connection, you either need a ethernet cable plugged into your Raspberry Pi or you need to connect via the serial port. I connected via the serial port with a FTDI USB to UART converter as this made it much easier to know when the network was connected. 

First of all plug the dongle into one of the USB ports and then reboot.I have not tested this in a USB hub but I am sure it will work the same. To make sure that the dongle has been started, run 
ifconfig
and make sure that wlan0 can be seen.


The next step is to see if your Raspberry Pi can see your wireless network. Run the following command and look for your network.
sudo iwlist wlan0 scan

Under 'Cell 01' I can see my network. Take not of your ESSID and you will also need your network password.

Once you have established that your Raspberry Pi can see your wireless network, you will need to edit the network interfaces file.
sudo nano /etc/network/interfaces
You will need to add the following:
  auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid 'your ESSID'
wpa-psk 'your password'
Your interfaces file should now look like this. Note that I have set a static IP address so if you still use DHCP then you will not need the static IP address settings like I have.


Restart your network connection by running
sudo /etc/init.d.networking restart
and then run
ifconfig
and you should notice an IP address assigned to wlan0.

Now reboot your Raspberry Pi to make sure that everything is working in order.
sudo reboot
If your connection is up and running after the reboot, then you are all set to go wireless.

Greg