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 the Microsoft Windows® operating system; if you need to download MPIDE for Mac OS® X, 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 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 Windows 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:
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 folder (as mentioned in Step 1, it will be called mpide-0023-windows-20130715 or something similar). Within that, you will find a folder of the same name. Double-click on that and then you should see, as shown in Fig. 3, among various other things, the file mpide (you may instead see mpide.exe depending on how your preferences are set).
Double-click on mpide to start MPIDE. Figure 4 shows the window you will see after starting MPIDE (on Windows 7). Click on Run.
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, go to Tools>Serial Port to select the proper serial port (see Fig. 9). This is usually COM3 or higher. An easy way to determine which serial port is the correct one is to disconnect your chipKIT board. The correct option will have disappeared from the drop-down menu. Reconnect your board and select that serial port. It may take anywhere from a few seconds to a minute for the options to update. 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 Ctrl+R (hold down the control 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 (Ctrl+V)
(b) Upload the sketch (Ctrl+U)
(c) Start a new sketch (Ctrl+N)
(d) Open a preexisting sketch (Ctrl+O)
(e) Save the sketch (Ctrl+S)
Figure 10. Tool options in MPIDE.
The above are screenshots of MPIDE running on Microsoft Windows 7.
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 Ctrl+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.