By Jin Xu, Asia Pacific Business Development Manager, MCU8 Division, Microchip Technology Inc.
The newest generation of 8-bit microcontrollers integrates what are known as “Core Independent Peripherals,” which bring a new level of design flexibility. From a simple digital timer to a complex AC/DC power supply, these configurable peripherals, along with integrated intelligent analog, offer balanced, customizable solutions to many design challenges. Additionally, they allow 8-bit microcontrollers to be used in areas where traditional 8-bit MCUs have fallen short.
Microcontrollers have come a long way since the introduction of the first Read Only Memory (ROM) MCU more than 40 years ago. 8-bit microcontrollers, in particular, have gone from a simple logic controller to a fully integrated smart IC with analog features. The classic view of an 8-bit microcontroller’s peripherals was one where each module was designed to perform a fixed function, and nothing more. The latest 8-bit generation was created to be different, from the ground up, which is a paradigm shift that requires a whole new end-product design approach. These new 8-bit microcontrollers have integrated a number of unique peripherals that can perform multiple functions and tasks, as needed. In addition, these peripherals can be configured and combined to create new functions that were impossible or difficult to do in other types of microcontrollers. Most of these new peripherals can operate independently, without any core supervision, thus reducing reliance on the CPU to perform the necessary tasks. Furthermore, many of these peripherals can be used in SLEEP mode for the most power-sensitive applications.
Using Core-Independent Peripherals
One of the most commonly used peripherals from this new crop is the Configurable Logic Cell (CLC). This is a very simple yet powerful module that offers standard logic functions—such as AND, OR, XOR, SR Latch, and J-K Flip Flop—which the user can configure to create logic gates for signal conditioning. The input and output signals of the CLC module can be connected to any of the I/Os, peripherals or registers, via internal connections. It can be used as a simple signal router, glue logic, or an intelligent state machine for wake-up control. The traditional microcontroller requires an external Programmable Logic Device (PLD) or additional coding to get the desired logic controls, and even that setup doesn’t provide all of the CLC’s flexibility.
The Numerically Controlled Oscillator (NCO) is another configurable module that can be used as a 20-bit timer or a PWM controller with high-resolution, variable-frequency control, as shown in Figure 1. This is not a traditional PWM/timer, where the performance and features are almost exactly the opposite of each other.
The NCO, with its higher resolution and linear frequency control, can help to simplify a complex control algorithm commonly used in many power supply applications, such as lighting ballast control with dimming functionality, by controlling the circuit current very accurately. Another use of the NCO is to drive the audio alert of a smoke alarm, as it provides he variable frequency control to easily change the pitch of an alarm tone. The finer control of the generated frequency also allows better tuning of the tone and pitch of the sound generated, without the need for any external analog components.
While this integrated peripheral can be used on its own, the magic really happens when multiple modules are combined together to create different functions. For example, Manchester encoding is commonly used in telecommunications and data-storage applications. The traditional Manchester algorithm can be very firmware intensive and requires CPU resources to manage the task. By using the NCO and CLC modules in tandem to create a Manchester decoder, this function operates entirely in hardware with zero CPU utilization. By the way, Manchester encoders can be designed with just one CLC module, without any firmware bit-banging.
Other peripherals, such as the Angular Timer (AT), the Signal Measurement Timer (SMT) and the Math Accelerator (MathAcc), are a bit more sophisticated when compared to the CLC or NCO modules. The AT can be used to measure any periodic signals—such as optical encoders, zero-cross detectors and Hall sensors—for motor-control and AC-power applications, regardless of the motor’s speed or the signal’s frequency. The AT module performs instantaneous time/angle domain transformation, all in hardware, and once again without any additional CPU overhead. Handling this task with a traditional microcontroller would typically require multiple timers to count and measure units of time, and then transform the values into the phase-angle domain through mathematical calculations (via firmware); or lookup tables stored in program memory, if the period is known. The traditional approach requires more firmware setup and CPU resources for the math, as well as the size constraint of the lookup table that could limit the number of values available, and thus lead to approximation and inaccuracy. The AT module can automatically generate interrupts and events, directly, based on the phase-angle value configured by the designer. Additionally, the AT has three Compare/Capture PWM (CCP) functions at the user’s disposal.
Comparing Traditional vs. Core-Independent Implementations
Another example of combining multiple peripherals to make the task easier is Capacitive Discharge Ignition (CDI) control, shown in Figure 2, which is often used in small internal-combustion engines.
The microcontroller has two primary tasks in a digitally controlled CDI system:
- Determine the advance firing angle of the spark plug, based on information from the various sensors
- Set the duty cycle of the PWM signals to deliver the firing pulses to the DC/DC converter for spark ignition
Without going through all the design details of an internal-combustion-engine control system, aPIC16F161x MCU-based CDI implementation, combining the AT, the CLC and a few other peripherals, such as the SMT and the MathACC, greatly improves the overall performance, as these peripherals effectively managed the RPM calculations and control the spark plug firing time of the engine, once again with very little CPU intervention. For a more in-depth analysis of this design, please refer to application noteAN1980in the references at the end of this article.
Figure 3 provides a comparison between the conventional and the core-independent-peripheral methods for designing a CDI system.
As demonstrated in Figure 3, the AT method greatly improves system performance by reducing the execution time and CPU usage by more than 50%, while reducing the code size by 40%.
There are a number of ways to generate a PWM signal, either through firmware or hardware; but when it comes to measuring and extracting information from an incoming PWM signal, the options become somewhat limited. The typical approach uses timers and CCPs, with a large number of CPU cycles to determine the pulse, period or duty-cycle values. It is possible to combine the CLC and NCO modules to accomplish these tasks, with some additional coding. However, the SMT peripheral mentioned in the previous example is a 24-bit counter/timer with advanced clock and gating logic, which allows for different acquisition modes. These modes include measuring and storing the period and duty-cycle values, automatically, with no core supervision or any additional calculations. The SMT is highly useful in any design that measures a PWM signal, such as motor control.
With the increased capabilities offered by these advanced peripherals, one of the concerns for designers is how to manage the limited I/O and the available MCU resources to maximize the performance of the device. Too many modules and not enough pins have been one of the shortcomings that limited the capabilities of traditional low pin count 8-bit microcontrollers. With recently added features, such as Pin Peripheral Select (PPS), designers can now route any digital signal to any I/O pin, on the fly, without using any external components. A traditional design that requires multiple UARTs might need a high pin count microcontroller with several UART modules to get the job done. With the new generation of 8-bit MCUs, this can be accomplished with any microcontroller that has a single UART and PPS or CLC to easily route the communication signals to multiple pins.
In summary, the newest generation of 8-bit microcontrollers is more capable and powerful than the traditional 8-bit MCU, and can often achieve higher performance than the software-centric approach of 32-bit MCUs, by executing many functions with integrated core-independent hardware. Additionally, Core-Independent Peripherals provide more flexibility for designers, by giving them the ability to configure and combine several peripherals, creating multiple application functions without sacrificing CPU performance or power consumption. These new hardware peripherals remove the traditional dependency on the core, and add determinism to the overall system design.