This guide will show you how to run well-known Arduino code on your DP32 Chipkit.
Pretty interesting stuff, I promise!
Step 1: Load Your MPLABX and Hardware Tools!
I can tell you're excited. And let me tell you, I am too! But before we get ahead of ourselves, let us download our IDE for compiling and programming the chipkit the way we want to.
You can start by going here: http://www.microchip.com/mplab/mplab-x-ide
Under "Downloads", select your flavour of your Operating System and make sure you download and install it.
Note, that you need to make sure the USB Cable is a proper one. Also avoid USB Squids, since they're likely to damage your board and keep you from accomplishing the good things in life.
I recommend restarting your computer after you fully install MP LAB X.
Now then, moving on!
Step 2: Connect Your DP32 Board and Programmer
The picture shows how you should have your Board and Programmer connected. Make sure this is done, prior to opening a new project on MPLAB X.
Step 3: Preparing Your DP32 for Arduino Code
First thing's first.
We need to prepare your board to be able to run Arduino code. So, here we go.
First, go here and download the Bootloader needed for your board:
Then, we go here and download the Arduino IDE (Careful with the OS Flavour):
Then, after we have both loaded. We need to select the right board. I've taken the following extract from: ChipKIT
" From within the Arduino IDE, go to File->Preferences dialog box. 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/mas... Then click OK to close the Preferences dialog box.
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/mas... 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. "
After you have modified your Arduino, making sure you have the right Port and Board selected, we ready to work with MP LAB X.
Step 4: Upload the Bootloader to Your DP32
Provided you have downloaded the Bootloader for your DP32 from their site, we are now ready to upload it to the DP32 with the help of MPLAB X.
First, open a New Project and select the "Prebuilt" option.
Step 5: Selecting the Right Properties
On the next window, make sure you select the right device and debugger. For the Prebuilt Filename, make sure you browse to the bootloader .hex file you downloaded and select it.
Step 6: Uploading the .hex Bootloader
After you've done all that, select the project and click the button on top with the arrow pointing downwards into the chip. This uploads our Bootloader to the Chipkit.
This takes a while so wait for operation to finish. Give it a minute or two and you should be good.
Step 7: Finally Running Your Arduino Code <3
We now, can load up some simple code on your Arduino IDE (which you are supposed to have modified according to your board).
On your Arduino IDE, head to File -> Examples -> 01.Basics -> ____
The blank spot is for you to choose! I selected Blink because I like to play safe. But you can practically run any sketch/code you want by selecting one from the list and uploading it to your DP32 to run it.
Make sure you verify your code, by pressing the 'tick' logo on the top left of the window.
The 'arrow' button uploads the code to your board. Do give a few seconds to finish. I know you're excited...
Step 8: Congratulations!
And there you have it!
You've finally reached your goal! If you're having trouble detecting the board or other similar issues, I recommend the following:
1. Restart your computer.
2. Detach the board and press the buttons on it to drain some internal energy and reconnect it after a while.
3. Use another cable or a completely different workstation.
4. Make sure your version of MPLAB X is up to date.
And you should be good! Thank you so much for your time!
Follow me on Twitter: https://twitter.com/MashrufKabir (I hardly post anything..)