Thursday, September 30, 2010

Of Droids and Muin

For a while I have had it in the back of my mind to pick up on a couple of old projects that are kicking around the workshop. One of them was a project based on the Droids MUIN board with XBee modules. The original project which was going to be around rocket telemetry is now not likely to happen, but I decided to have a go at getting the PIC development environment set up for the Muin board. The MUIN (PN.990.005) is based on a 28 pin PIC 18F2520 with 10-Bit A/D, 32k Flash, two 8-Bit ports and a 6-Bit port.

Oh, and to keep things interesting I want to use Mac OSX and an ICD2 over USB.

So, on to the first challenge, finding a development environment. Sadly Microchip don't as yet appear to provide an environment for operating systems other than W*ndows. A quick search on google came up with a likely contender in piklab. Piklab is free and GPL and appears to have many of the features of MPLab, and it supports ICD2 among others.  Installation was greatly eased by using Macports.

sudo port install piklab

And piklab needs a toolchain. I chose GNU PIC Utils (gputils).

sudo port install gputils

This should get you a running piklab installation. You'll need to select the gputils toolchain.

Next up, getting the ICD2 working. This really depends on the version of the ICD2 firmware. Mine was woefully out of date but you might find yours is fine.

Updating the ICD2 firmware.  There's a couple of options here.

  1. Use a W*ndows machine, install MPLab and update from there.
  2. Install and Run MPLab under Wine, then use piklab to update.

I chose 2 as I have no W*ndows machines in the house.  Off to Macports again.

sudo port install wine

Then download and run the MPLab installer:

wine setup.exe

To install the new firmware just point the piklab firmware directory (Programmer->Settings->Programmer Selection->Specific) to:

/path_to_mplab/MPLAB IDE/ICD2

Then connect (Programmer->Connect) and piklab will update your firmware.
It should now be possible to create a new project and a stub .asm file which should compile and program.

In the next enthralling instalment I'm going to see if I can get some servo code running.
Meanwhile here are some links to some very useful software.