Clicker2 for PIC32MX: now with direct Arduino IDE programming



Recently the v1.3.1 version of the chipKIT-core was released by the chipKIT team. As a novelty, this release adds direct support for the MikroElektronika bootloader in Arduino IDE, as well as better integration of the Clicker2 for PIC32MX board. Yes, that’s right! The Clicker2 for PIC32MX can now be programmed in Arduino IDE, just like any other Arduino board.

If you remember my older blog posts, I have managed to find a way to use the Clicker2 in Arduino IDE, but with a cumbersome solution, that needed the replacement of the bootloader and an extra USB-UART click. That old solution has now become obsolete. The new way is simpler, doesn’t require any other external components, and it works just right out of the box.

However, switching from the ubiquitous Arduino boards to MikroElektrokina hardware is not always easy. One important issue is how to address each pin from Arduino IDE. Well, here are some minor issues. I took my Clicker2 for PIC32MX and I have tried to find how the pins are numbered. Here’s what I came with:

The novelty here is the pin numbering, matching that of the Clicker2 board. You will notice that some pin numbers are missing — there’s nothing wrong with this, it’s only to keep the matching I mentioned above.

But I have found also some minor issues: some analog pins are incorrectly defined. For example, to read the state of the AN pins of the click sockets you will have to use the pin number, without the “A” — like analogRead(69); for example.

Another thing is reading the battery voltage. If you look on the Clicker2 schematic, you’ll find that you have to set BATT SENSE ENABLE pin low before reading the BATTERY VOLTAGE pin. I do recommend to set the BATT SENSE ENABLE back high after the reading, as this will prevent discharging of the battery through the sensing resistors.


As for programming in Arduino IDE, all you need is to connect the Clicker2 board using the USB port. When uploading the sketch, when the *** Enter programming mode now. *** message appears on the screen you have to press the reset button on the Clicker2 board, This brings up the bootloader and the sketch can be uploaded. This is the only difference as compared with Arduino Uno boards. I also mention here that Serial.print() works using the USB port.

Another thing is that now the MikroElektronika Buggy becomes fully compatible with the Arduino IDE. Of course, an in-depth post regarding the new ways to program the Buggy will follow soon
Alternate pin names

A quick update on this post [3 November 2016]: As pointed out by Matt Jenkins from Majenko Technologies, there’s an alternate set of pin definitions for the Clicker2 board, the format being “PIN_xxx”, where “xxx” is the pin name (written on the board). The click sockets also have their own pin definitions, of type “PIN_Cy_xxx”.

If you prefer this way of addressing the pins, here’s an updated pin map:


As an example on how to use these pin definitions, take a look on how to make the LED1 on the Clicker board blink:

void setup() {
  pinMode(PIN_LED1, OUTPUT);
}

void loop() {
  digitalWrite(PIN_LED1, HIGH);
  delay(1000);
  digitalWrite(PIN_LED1, LOW);
  delay(1000);}

Name

Air quality,2,Arduino code library,2,Arduino projects,23,Buggy,1,Casual stuff,1,ESP8266,2,MikroElektronika,3,PIC projects,7,Review,26,Robots,1,Tutorial,20,
ltr
item
Electronza: Clicker2 for PIC32MX: now with direct Arduino IDE programming
Clicker2 for PIC32MX: now with direct Arduino IDE programming
https://1.bp.blogspot.com/-o66fWlQEB-A/YNRMt_rwfxI/AAAAAAAACS0/fEvVK64-51sOzdKl_HxUJAhzb-a18rg-gCLcBGAsYHQ/w640-h306/clicker2-pic32mx-pinout-featured.jpg
https://1.bp.blogspot.com/-o66fWlQEB-A/YNRMt_rwfxI/AAAAAAAACS0/fEvVK64-51sOzdKl_HxUJAhzb-a18rg-gCLcBGAsYHQ/s72-w640-c-h306/clicker2-pic32mx-pinout-featured.jpg
Electronza
https://www.electronza.com/2016/10/clicker2-for-pic32mx-now-with-direct.html
https://www.electronza.com/
https://www.electronza.com/
https://www.electronza.com/2016/10/clicker2-for-pic32mx-now-with-direct.html
true
4275662725798500575
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content