I recently got a chipKIT Uno32 prototyping platform from Newark so I could take it for a spin. Newark is the US distribution arm of Farnell and they carry both the chipKIT Uno32 and the chipKIT Max32.
The chipKIT boards are manufactured by Diligent and claim compatibility with Arduino boards. The Uno32 is similar to the Arduino Uno, and the chipKIT Max32 is similar to the Arduino Mega, but they are both based on Microchip PIC32 microcontrollers. The Uno32 that I have has a PIC32MX320F128H microcontroller.
There are plenty of powerful features of the Uno32 that make it compelling, especially when comparing to the Arduino. There are 42 I/O pins, which is nice. The clock speed is 80MHz versus 16MHz on the Arduino. For most hobbyists this won’t matter much; I have not often found CPU speed to be a limiting factor in projects. There’s more Flash memory to store your programs: 128K versus Arduino 32K. Again, I have never felt limited by the size of a program. In fact, the largest Arduino program I’ve written is a full-featured implementation of Asteroids and this only took 28K of Flash memory for the program.
But when it comes to SRAM, the memory that you use in your programs to store data structures, buffers, stack, etc, the chipKIT Uno32 has 16K versus 2K on the Arduino. This is a vast improvement for me. I’ve done a lot of video work with the Arduino (e.g. the Video Experimenter shield, Hackvision game system, etc.) and the size of SRAM is a significant barrier to video frame storage.
There are also 2 UARTs used for serial communication, versus the 1 on Arduino. When using Arduino, if you want to communicate with two serial devices at once (for example, the Serial Monitor on your computer and a GPS module), you had to use a software implementation of serial communication for one of the devices. But with 2 UARTs, the chipKIT Uno32 allows 2 independent hardware implementations. I like that a lot. There’s also a realtime clock and calendar (RTCC) on the PIC32MX320F128H microcontroller with the option of connecting a 32.768KHz clock crystal. That could be useful for some projects.
Make sure you check out the Hackaday article where they did an in-depth review of these boards from a performance perspective.
But what I was really interested in understanding is Diligent’s claim that the chipKIT boards are “Arduino Compatible”. What does this mean in practical terms for the hobbyist?
Compatibility: The Good News
Well, you can program the Uno32 using the normal Arduino API, like digitalWrite, digitalRead, analogRead, etc. For most hobbyists, this will allow them to read sensors, light LEDs, control motors, and the like. Maybe you need lots of digital outputs — the Uno32 has 42 pins instead of 19 on the ordinary Arduino. The Uno32 is a lot cheaper than the Arduino Mega.
So, the normal Arduino API works, but what about direct access to ports in order to more efficiently control digital I/O? I often use direct manipulation of the AVR microcontroller ports instead of using digitalWrite and digitalRead calls. That is, I set a digital pin HIGH with something like PORTB |= 0x2 instead (for speed). Will this code work with the chipKIT boards? Yes! I was surprised, but apparently the chipKIT compiler makes the appropriate adjustments to the resulting compiled code to allow direct port manipulation using the AVR semantics.
Compatibility: The Bad News
Here are some things that I think are bad news with regard to Arduino compatibility.
- Outputs are 3.3V — This means that the output voltage of the digital pins isn’t high enough to be recognized as an input HIGH voltage by many 5V CMOS chips. For example, you can’t use the digital outputs on chipKIT boards to drive a 74HC595 shift register. The 3.3V output is not high enough to trigger the input pins on CMOS chips which generally require at least 3.5V. This problem can be address by adding more components to your circuits (e.g. a transistor to translate to a higher input voltage), but that defeats the purpose of convenient Arduino shields.
- Current limitations — On the Arduino, each digital pin can source/sink up to 40mA as an absolute maximum, but in practice you should limit to 20mA. However, the chipKIT boards have a maximum of +/-18mA per pin, and the reference manual states that this should be limited to +7/-12mA per pin. This is going to be a disappointment to people wanting to drive LEDs, 7-segment displays, etc. Furthermore, the maximum current that can be sourced/sunk across ALL I/O pins simultaneously is only 200mA. That’s not much current to spread across 42 pins! I tried to light a bright blue LED and was only able to draw a dim 8mA (with no current limiting resistor at all!) because the forward voltage of the LED is just barely over the 3.3V board output voltage. Again, this can be solved with external circuitry, but that’s not convenient.
- Code rewrites — If your Arduino code accesses AVR registers directly (for example to use timers) or involves AVR assembly, you are going to have to rewrite it. This means that using my Video Experimenter on the chipKIT board would b e a total rewrite of the gnarly AVR assembly.
- Incompatible pin assignments — If you use special microcontroller functions found on the AVR, you will not find them on the same pins on the chipKIT boards. For example, my Video Experimenter shield utilizes the analog comparator function to compare the voltage of a video signal with a reference voltage. The analog comparator pin is D6 on the Arduino, but is D11 on the chipKIT Uno32. This is another barrier to using Arduino shields on the chipKIT boards. The pins don’t have the same functions.
The chipKIT Uno32 is a nice board and will give many Arduino users a boost in speed and in the number of pins available. Users doing more sophisticated things that involve direct AVR register access, timers, and libraries written in AVR assembly won’t be able to simply switch to the chipKIT for their work without a lot of rewriting. Most disappointing to me is that many Arduino shields simply aren’t going to work on the chipKIT. And due to the 3.3V output, even projects using LEDs (the bread-and-butter of the Arduino world!) may have some challenges due to current limitations and the lower voltage available to light up all those blinky lights. Nonetheless, I welcome Microchip and Diligent’s efforts and hope to see some great chipKIT projects in the future!