Introduction: Programming Using the Arduino IDE on Your ChipKIT Dp32 Board
This guide shows how to set up the Arduino IDE so that it can be used to program the chipKIT dp32 microcontroller.
Step 1: Download and Installing the Arduino IDE
This step is for those who haven't installed the Arduino IDE. Feel free to skip to the next step if you have.
2. Click on the squared links listed inside the blue box to the right. Windows users have the option to download an installer (top link), while Mac and Linux users (may) have to move the drivers around.
4. Click on the IDE icon, and the window pictured (with a red "4" at the bottom left) should appear.
Step 2: Installing the ChipKIT Core
With the IDE still opened from the previous step, there's still no way to select a chipKIT board! With that said, follow the steps depicted here, or copy paste the following link to the address bar:
For convenience, here's a paste of the guide, along with additional pictures! Once again, all pictures have their corresponding step number at the bottome left hand corner.
1. From within the Arduino IDE, go to File->Preferences dialog box.
2. Look at the text entry field called "Additional Boards Manager URLs:". If that text entry field is blank, then you can just copy/paste the following URL into that text field https://github.com/chipKIT32/chipKIT-core/raw/master/package_chipkit_index.json Then click OK to close the Preferences dialog box.
2.1 If that field is not blank, then click the little box icon to the right of the text field, and copy/paste the URL https://github.com/chipKIT32/chipKIT-core/raw/master/package_chipkit_index.json onto the next line of the text entry field. Arduino lets you have as many different cores as you want loaded into the IDE as long as each URL is on a separate line. Click OK to close the Additional Boards Manager URLs dialog box and then click OK again to close the Preferences dialog box.
3. Now select the Tools->Board->Board Manager menu from the Arduino IDE, and it will open up the Boards Manager window.
4. Click the search bar and type "chipKIT". Click once on any of the text in the chipKIT section, and you will see a button appear that says "Install". It will take some time to download all of the chipKIT components and install them, but when it's done, you can click the Close button to close the Board Manager window.
5. Select Tools->Board and scroll down until "chipKIT DP32" is shown like in the picture. Click on it.
Step 3: Using MPLAB X to Restore the ChipKIT DP32 Bootloader
With the IDE setup, you still need to restore the bootloader in order for the DP32 to work with Arduino. Here, this will be done using the MPLAB X, given how it was for YorkU's EECS 2021 course (in other words, already installed for me). Luckily, there's already a guide that does just that! Of course, the UI would've changed a bit, so here's with more recent pictures:
1. Grab the bootloader here and extract the .Hex file into some folder, or copy paste the following link to the address bar: https://reference.digilentinc.com/_media/chipkit_dp32:chipkit_bootloader_dp32.zip
1.1. In the case that link does not work, the bootloader can be found here under "Design Resources". Or once again copy this link: https://reference.digilentinc.com/chipkit_dp32:chipkit_dp32
2. Plug in the chipKIT dp32 along with the programmer. This must be done before opening MPLAB X.
3. Open MPLAB X, and go to File ->HEX/ELF...(Prebuilt) File
4. Input the settings as shown.
A. Prebuilt Filename - This should be the hex file extracted from step 1.
B Family/Device - This should be "32-bit MCUs (PIC32)". Do not select other options or the chip for "Device" won't appear. Scroll down for the device and click the option shown, or paste in: PIC32MX250F128B
C Hardware Tool - This is where you select the programmer for the chip. The name may be different based on what you use, but it should be listed at the very bottom under "Other Tools". This will not appear if step 2 was skipped. Try closing and reopening the IDE if it does not detect it.
Click "Next" at the bottom.
5. Do not touch any of the other settings. Make sure "Set as main project" is ticked however. Click "Finish"
6. The "Output window, if displayed, should say:
Loading code from /chipkit_bootloader_dp32/chipKIT_Bootloader_DP32.hex...
Where is the place where the hex file is located. A green triangle should also be available at the top bar. Click on it. If it does not appear green as depicted, be sure the correct programmer is selected.
7. If all is well, the output window at the bottom will show:
As shown in the picture. The green LED will also blink.
Step 4: Setting Up the Arduino and Running Some Code
Finally, after the chip is setup along with the Arduino IDE, there's still one final step of configuration to do. Without closing MPLAB X, open (or switch back to) Arduino.
1. Make sure under Tools->Board the "chipKIT DP32" is still selected. If so, under Tools ->Port make sure a port is selected. This varies on the computer, and may show more than 1 option. Trail and error is needed, sadly.
2. There's 1 simple way to find out. Under "File->Examples", select any example. Here, we will use "Blink" since it's more observable.
3. Click on the arrow under "Edit". Hovering over it should display the words "Upload" to the right.
4. If everything was setup correctly, it should show the output window similar to the picture; the output window at the bottom should have text similar to:
Program flash: ........######### done
Verify flash: ........######## done
Program rate: 34285 bytes per second
If using the "Blink" example, one of the middle green LEDs will flicker on and off every second.
5. If it says "No target found.", do the following:
5.1 If there was only 1 port option from Arduino, reprogram back the bootloader using MPLAB X.
5.2 If there were multiple ports, try a different one, and systematically test each until one of them works.
Now with everything setup, feel free to try more of the other example code and modify them to your heart's content.