Electronza
  • Homepage
  • Privacy
    • Privacy Policy
  • Contact
Electronza
  • Homepage
  • Privacy
    • Privacy Policy
  • Contact
Electronza
You are at:Home»Electronics projects»Arduino projects»Clicker2 for PIC32MX: now with direct Arduino IDE programming
clicker 2 for PIC32MX: now with Arduino IDE support
clicker 2 for PIC32MX: now with Arduino IDE support

Clicker2 for PIC32MX: now with direct Arduino IDE programming

5
By Electronza on October 7, 2016 Arduino projects, PIC32 projects

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:

Clicker2 for PIC32MX: Arduino IDE pinout
Clicker2 for PIC32MX: Arduino IDE pinout

A pdf version of the above figure, with a better resolution, can be downloaded here.

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.

Clicker2 for PIC32MX Battery voltage sensing circuit
Clicker2 for PIC32MX Battery voltage sensing circuit

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:

Alternate pin names for Clicker2 for PIC32 MX
Alternate pin names for Clicker2 for PIC32 MX

A higher resolution of this pin chart in pdf format is also available for download.

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);
}

Arduino chipKIT MIKROE-1717 PIC32MX460F512L pin chart
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email

Related Posts

SDS011 - HPMA115S0 - Arduino Due

A comparative test of two particle sensors

Honeywell HPMA115S0-XXX particle sensor

A new code library for HPMA115S0 particle sensor

4-20mA thermometer

Arduino: 4-20mA thermometer

5 Comments

  1. Jean-Luc Deladrière on October 7, 2016 6:30 pm

    I guess we need to add the .json url for the clicker2 in the Arduino board manager
    Where can we find it ?
    Thx

    Reply
    • Teodor on October 7, 2016 7:28 pm

      Hi Jean-Luc

      The .json url is URL into that text field https://github.com/chipKIT32/chipKIT-core/raw/master/package_chipkit_index.json.
      If the “Additional Boards Manager URLs:” 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 to be 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.

      Regards,
      Teodor

      Reply
  2. Jean-Luc Deladrière on October 8, 2016 6:35 am

    Hi Teodor
    It works fine !
    I found more convenient to use the onboard switch to enter bootloader mode : keeping the board off then on when the IDE asks “*** Enter programming mode now. ***”
    Thanks a lot for your PDF chart : It’s most necessary !

    Reply
  3. Matt Jenkins on October 31, 2016 11:48 pm

    The Clicker2 definitions in chipKIT-core have a huge number of handy macros defined in the form “PIN_xxx” where “xxx” is what is written on the board. Thus pin 34 can be referenced as PIN_RD0.

    For the “click” headers you have a slightly different format: PIN_Cy_xxx where y is 1 for the left and 2 for the right clicker header and, again, xxx is the name of the pin. So the analog pin on the left hand click socket is PIN_C1_AN

    The battery sense has three special defines: PIN_SENSEL, PIN_VSENSE and PIN_STAT for pins 89, 90 and 91 respectively (enable, sense, status).

    Makes it a bit easier to work out which pin is which, yes?

    Reply
    • Teodor on October 31, 2016 11:57 pm

      Hi Matt,

      It certainly does! And it’s so nice to be able to program the Clicker2 directly in Arduino IDE. Great job!

      Reply

Leave A Reply Cancel Reply

Latest posts
January 15, 2023

A pretty text box for Blogger posts

January 15, 2023

New blog section: beginners’ corner

January 15, 2023

Cleaning unused images from blogs hosted on Blogger

Categories
  • Beginners' corner
  • Electronics projects
    • ESP8266
    • Arduino projects
    • IoT
    • 8-bit PIC projects
    • Raspberry PI
    • PIC32 projects
    • Robots
  • Arduino libraries
  • Reviews
    • Tools & equipment
    • Development boards
    • IoT
    • Industrial Arduino
  • Blogger / Blogspot
  • Tutorials
  • Casual stuff
Popular posts
Arduino Uno 4-20mA communication using 4-20mA R click and 4-20mA T click boards from MikroElektronika: MIKROE-1296, MIKROE-1387, Uno Click Shield
August 17, 2016

4-20mA current loop Arduino tutorial Part I: hardware

ECG click on Arduino Uno
December 5, 2016

ECG click: Arduino IDE code examples

Arduino water timer
February 25, 2015

Gardena water timer controller using Arduino Uno

ESP8266 Thing Dev from Sparkfun
May 15, 2019

ESP8266 – running on battery power

Thunderstorm
February 10, 2015

AS3935 lightning detection using Arduino Uno

Copyright © 2023 Teodor Costachioiu

Type above and press Enter to search. Press Esc to cancel.