A new development board waits for my review: the Flip & Click for PIC32MZ, the second board in the Flip&Click series by MikroElektronika.
Almost two years have passed since the first ATSAM3X8E-based Flip&Click SAM3X board was released. That particular board was a redesigned Arduino Due, with four mikroBUS sockets on one side, and a typical Arduino Uno layout on the other side. It was the first board designed by MikroElektronika that was meant to be programmed in Arduino IDE.
Unfortunately, the I2C library in Arduino Due is seriously flawed, and some devices that need a stop condition to be sent on the I2C bus are not working with the Flip&Click. That is a software issue; it affects the original Arduino Due boards as well. Strangely though, none cares to fix this, and even now some I2C click boards are not working with the Flip&Click for SAM3X. Of course, one can switch to Python, and install the Zerynth virtual machine. All the I2C click boards work fine with python.
But what happens if we still want to use Arduino?
Today we have a nice alternative: the Flip&Click for PIC32MX keeps the same board layout as the previous Flip& Click for SAM3X, but it comes with a PIC32MZ2048EFH100-I/PF microcontroller, delivering 415 DMIPS /252 MHz. The program memory size is 2048 kb, while the RAM is 512kb. We also have 160kb of auxiliary FLASH memory. Same as the SAM3X board, this Flip&Click uses 3.3V logic, but with the addition of some 5V tolerant pins.
The board can be ordered in two flavors, with Arduino bootloader or with the MikroElektronika bootloader. My version is with the Arduino bootloader.
So, what do we get? Let’s start with the Arduino side first:
A bright red board, with the PIC32 microcontroller right in the center. Besides the built-in USB port of the PIC32MZ microcontroller, we also find one USB-UART bridge, connected to the UART5 port of the PIC32MZ. The same UART5 port is also used by pins TX0 and RX0 of the Arduino expansion connector.
As a side note, this UART5 port is also used by the Arduino bootloader. When programming the board, one must use the USB port located between C and D sockets.
On the Arduino expansion connector, the I2C bus follows the Arduino Uno R3 layout, with the I2C bus located after pin 13, and GND. Shields that rely on having the I2C bus on pins A4 and A5 will not work, or one must use software I2C (bit banging).
As compared with the SAM3X counterpart, one notices that the ICSP connector is missing. That connector is not only used for programming, but some Arduino shields are taking the SPI lines from it rather than using pins 10-13. One of those shields is the Arduino Ethernet shield. Again, the only thing to do is use software SPI.
The white side features four click™ sockets, which are just like mini-shields. I don’t know how many click boards are available today, there must be over 350 different boards, and new boards are added every day. I have the feeling that the Arduino side will be left unused, and I can implement many complex projects using just the four mikroBUS sockets.
One notices that each mikroBUS socket has its own UART port. The first two mikroBUS sockets A and B share the same I2C and SPI ports. The same happens with mikroBUS sockets C and D, which are sharing the same I2C and SPI data lines.
This opens up an interesting possibility: one can use two click boards with the same I2C address, by placing one click board in socket A and the second click board in socket C.
Programming of the Flip& Click for PIC32MZ board in Arduino IDE is just as easy as working with any third party board. The version 1.4.3 of the chipKIT library offers support for the Flip&Click for PIC32MZ. One has either to use the boards manager, or add the following URL https://raw.githubusercontent.com/chipKIT32/chipKIT-core/master/package_chipkit_index.json in the Preferences window. Then just select the Flip&Click board from the boards manager.
But what about pin definitions? Let’s take a look into https://github.com/chipKIT32/chipKIT-core/blob/master/pic32/variants/FlipNClick_MZ/Board_Defs.h.
LED1 – 13
LEDA – 22
LEDB – 23
LEDC – 24
LEDD – 25
PIN_BTN1 – 46
PIN_BTN2 – 47
PIN_INT0 – 2 // Arduino header
PIN_INT1 – 57 // Click C
PIN_INT2 – 69 // Click D
PIN_INT3 – 45 // Click B
PIN_INT4 – 33 // Click A
On the Arduino side
SS = 10; // for SPI master operation, shared with pin 10
MOSI = 11; // PIC32 SDO3
MISO = 12; // PIC32 SDI3
SCK = 13; // PIC32 SCK3
Click SPI definitions
Sockets A and B are using SPI2
SS_A = 28; // SPI2_SS1
MOSI_A = 31; // SPI2_MOSI
MISO_A = 30; // SPI2_MISO
SCK_A = 29; // SPI2_SCK
Sockets C and D are using SPI1
SS_C = 28; // SPI1_SS1
MOSI_C = 31; // SPI1_MOSI
MISO_C = 30; // SPI1_MISO
SCK_C = 29; // SPI1_SCK
The standard I2C port uses I2C (SCL5/SDA5), corresponding to pins 20/21 on the Arduino connector. Click sockets A and B are using I2C1 (pins 36, 37), while click sockets C and D are using I2C2.
A much nicer drawing is coming in the next few days, after I will check that everything works OK.