MPIDE (Multi-Platform Integrated Development Environment) is software that can be used to program chipKIT™ compatible boards. Programs written for MPIDE are called “sketches.” (We will often use the term code or computer code to refer to all or part of a sketch. Note that this “code” has nothing to do with a secret code even though some of it may initially appear mysterious!) You will run one of the example sketches provided in MPIDE in order to demonstrate how to use MPIDE with your chipKIT board. (Keep in mind that this page is a guide to downloading MPIDE for Apple Mac OS® X operating system; if you need to download MPIDE for Microsoft Windows®, see this page that provides directions for that operating system. To download MPIDE for Linux®, refer to the instructions available at here.)
To begin, make sure you have a USB-A-to-mini-B cable (see Fig. 1) which is used to connect your computer and your chipKIT board. You may use the Uno32 (shown in Fig. 2), uC32, Max32, or other chipKIT-compatible boards. You can find more information about Digilent's® line of chipKIT boards by following the link available at the right.
MPIDE is free software that is packaged as a “.zip” file. The most recent “stable” release that is considered best suited for wide use is available from the following URL:
Locate the appropriate button for your operating system (which we are assuming is Mac for the sake of discussion on this particular page) and click on that. This will cause a “.zip” file to download with a name such as:
After the file has downloaded, double-click on it. This should open a Finder window similar to the one shown in Fig. 3. To install MPIDE into your Applications folder, click and drag the MPIDE icon over to the Applications folder icon and release the mouse (depending on your preferences, the icon may be labeled Mpide.app or simply Mpide)
Connect your cable to your computer and your board. The driver (a piece of the software that facilitates communication between your computer and the attached hardware) will begin installing automatically. Once it has installed, small red and green lights should be illuminated on the board. (Technically, these are “light emitting diodes [LEDs].” In the reference manual for the Uno32 board, they are referred to as LED3, which is red, and LED4, which is green.)
Double-click on the Mpide icon to start MPIDE. Figure 4 shows the dialog box you will see after starting MPIDE. Click on Open.
Figure 5 shows an example of the type of window that should now appear. The central, white portion of the window is where you enter computer code, i.e., enter your sketch. As you will see later, the lower portion of the window provides information about various things such as the status of the download of your sketch to the chipKIT board. (The number at the lower left corner of the MPIDE window is the line number where the cursor is currently located.)
MPIDE provides a default name for the sketch which is of the form: sketch_dateletter where dateletter is the date (with a three-letter representation of the month and the numeric value for the day) followed by a letter. When you try to save your sketch, this is the name that will be associated with the saved file unless you specify that you want to name it something else. (As an aside, if you open additional new windows on the same day, and continue to use the default naming, the letter at the end of the file name changes. You can open 26 new windows this way. If you try for a 27th sketch, you're told it may be time to take a break! However, you should provide names for your sketches that are more descriptive than the default naming convention. By doing so, you can open any number of sketches in the same day!)
Because the purpose of this project is to introduce you to MPIDE rather than teach you to write your own sketch, we are going to use an example sketch that comes with MPIDE. As illustrated in Fig. 6, select the menu entry File>Examples>1.Basics>Blink. This will open a new window in which the sketch's code appears.
In the “header” portion of the window, the name of the file where the code is stored will appear. In this example, the file name is “Blink”. On the computer this is stored as Blink.pde. The extension “.pde” indicates that this file is a sketch. PDE stands for Processing Development Environment. Processing is a computer language often used in conjunction with the types of projects we will consider here. More recently, sketches often have an extension of .ino. This extension comes from the last three letters of Arduino™, the open-source hardware and software platform with which chipKIT and MPIDE are compatible. Figure 7 indicates how the sketch should appear.
Now you have a sketch, or a set of computer instructions, loaded into MPIDE. However, this information has not been transferred to the chipKIT board. Keep in mind that MPIDE runs on your computer. You use MPIDE to create the desired sketch and then MPIDE allows you to transfer information from this sketch to the chipKIT board (and as you will see later, allows you to transfer information from the chipKIT board back to your computer). You can, in fact, start MPIDE without a chipKIT board attached to your computer. You might want to do this if you are writing a sketch but are not yet ready to run it on a board.
You can use MPIDE with a wide variety of boards, but MPIDE needs to know the type of board to which it is “talking.” To specify the board, select the menu Tools>Board and choose your chipKIT board (as shown in Fig. 8 where the Uno32 is selected).
Next, as shown in Fig. 9, go to Tools>Serial Port to select the proper serial port. This will be something along the lines of “/dev/tty.usbserial-” followed by a collection of letters and digits. An easy way to determine which serial port is the correct one is to disconnect your chipKIT board. The correct option will disappear from the drop-down menu (but you will have leave the Tools>Serial Port and then return to it for it to refresh). Reconnect your board and select that serial port. Click on Tools>Serial Port again to see the updated options.
Now you are almost ready to run the sketch. Normally, before uploading the sketch, you would “verify” the sketch to identify any bugs or errors in the code. This can be accomplished in one of three ways. As indicated in Fig. 10(a), you can click the Verify button. Alternatively, you can click on the menu entry Sketch>Verify/Compile or you can type Cmd+R (hold down the command key and type the key R). You are welcome to verify this sketch, but since it is one of the provided example sketches, this isn't necessary. Figure 10(b) through 10(e) shows the other “buttons” available in MPIDE.
(a) Verify the sketch (Cmd+V)
(b) Upload the sketch (Cmd+U)
(c) Start a new sketch (Cmd+N)
(d) Open a preexisting sketch (Cmd+O)
(e) Save the sketch (Cmd+S)
Figure 10. Tool options in MPIDE.
The above are screenshots of MPIDE running on Apple Mac OS X.
Whether or not a sketch has been verified, you can “upload” it to a board. If there is a bug in the code that would have been caught by verifying the sketch, it will still be caught when you try to upload it. To upload the sketch, you can click on the Upload button, as indicated in Fig. 10(b). Alternatively, you can click on the menu entry File>Upload to I/O Board (I/O stands for input/output), or type Cmd+U.
Once the sketch starts to upload, two of the LEDs on the board will flicker momentarily (specifically, these are known as LED1 and LED2). This will be followed by a brief pause (approximately a few seconds). After the upload is complete, the sketch is run—no further action is required. The sketch will continue to run until the power is removed from the chipKIT board or a new sketch is uploaded.
Once this example sketch starts to run, another LED (LED4) should start to blink! It will blink with a two-second interval, being on for one second then off for one second. The way in which the code accomplishes this blinking is covered in the Blinking an Onboard LED project.