The new PIC32MK family is divided into two groups (subfamilies?): The PIC32MK MC and the PIC32MK GP. Part numbers and other forms of product identification often seem hopelessly obscure but, in this case, the “MC” and “GP” labels are pleasantly straightforward: Microchip indicates that the MC subfamily is optimized for motor-control applications and that the GP subfamily is optimized for general-purpose applications. I’m not convinced that it’s actually possible to optimize something for general-purpose functionality, but that’s a detail. . . .
I certainly have nothing against general-purpose devices, but I like the idea of microcontrollers that are designed with a specific application in mind. Electronic products are expected to do more and at the same time be developed more quickly, and it helps when we can use a microcontroller that is already fine-tuned for the functionality that we are likely to need.
MCU or DSP?
One thing that caught my eye was the processor frequency: 120 MHz. Then I noticed support for DSP and floating-point math and, of course, this is a 32-bit device (as indicated by the name PIC32MK). To me, this is more confirmation that the line between microcontrollers and DSPs is becoming increasingly blurry.
Back when I first started working with embedded systems, I don’t think we would have used the word “microcontroller” to describe a 120 MHz, 32-bit, floating-point device, but now even the manufacturer is content to identify such a device as an “MCU.” Anyways, my point here is: don’t let the terminology distract you from the fact that these are high-performance processors—they might be perfectly adequate for demanding applications, and they might be overkill if you’re just looking for a basic microcontroller.
The PIC32MK devices include a DMA (direct memory access) controller. This is another feature that I associate more with DSPs than with microcontrollers, though I think that DMA is becoming more common among MCUs. In any event, I’m not complaining—DMA functionality is seriously helpful in certain applications. Diagram taken from the PIC32MK family datasheet.
Diagram courtesy of Microchip.
You can see here that we have the typical abundance of digital peripherals, analog modules, oscillator circuitry, and so forth. In my experience, it is very common for microcontrollers to have integrated ADCs, but DACs and op-amps are more rare. I appreciate that the MC subfamily offers not one but four on-chip op-amps. It is very common to need an op-amp or two (or four) in mixed-signal designs, and using on-chip devices is generally much more convenient.
Op-amps that are integrated into microcontrollers are perhaps not known for their outstanding performance, but my guess is that many applications could cope with whatever quality is offered by the on-chip amplifiers. One thing that you definitely need to watch out for is the stability requirements.
If you’ve read the Negative Feedback series (especially Part 8), you know that general-purpose op-amps must be “internally compensated” so that they are less likely to oscillate when incorporated into a typical feedback-based amplifier circuit. Often this compensation is such that the op-amp can be configured for unity gain and still maintain adequate phase margin. However, this is not always the case, and the op-amps in the PIC32MK family are not unity-gain stable under all conditions:
So remember that you cannot use these op-amps as unity-gain buffers—unless you explicitly configure them for unity-gain mode. This is a handy feature that allows you to implement a (stable) buffer using only one pin (the inverting input terminal) and no external components. You can read more about this on page 483 of the PIC32MK datasheet.
What exactly qualifies the PIC32MK MC devices as optimized for motor-control applications? The product page lists the following features as relevant to the chip’s motor-control functionality:
- PWM timers
- quadrature encoder interfaces
These are all fairly generic, except the last one. I don’t deny that ADCs and DACs and op-amps and what not could be useful in motor-control applications, but they’re also useful in many other types of projects. But I have never seen “quadrature encoder interface” listed on an MCU datasheet, so let’s take a closer look.
The quadrature encoder interface (QEI) is intended to work with encoders, i.e., devices used to obtain position feedback from mechanical devices. You can see the long list of features on page 501 of the datasheet. The following diagram gives you an idea of the signals generated by an encoder:
Diagram courtesy of Microchip.
The point here is that the encoder’s output signals are not particularly straightforward. The QEI module provides filtering and dedicated decoding logic that helps the microcontroller to correctly and conveniently interpret these signals.
If you have any experience with PIC32 devices, feel free to share your thoughts in the comments section.