In this blog post, we will talk about the new Analog Peripheral Manager (APM) on the PIC18-Q71 device family to understand how it can be used to decrease overall power consumption in embedded designs.
Understanding the Issue
In the realm of microcontrollers and embedded systems, power consumption has become a paramount concern for developers across a variety of applications. As we continue to integrate technology into every aspect of our lives, whether that be smart devices, IoT applications, wireless sensors, automotive innovations, connected household appliances and more, the need to reduce power consumption has never been more critical.
The Significance of Power Efficiency
Why is power consumption so crucial with microcontrollers and embedded systems? Well, a large portion of embedded applications are analog systems that contain sensors, amplifiers or any other analog modules, which by their nature, tend to be power-hungry due to the analog signals needing to be digitized and processed to be of any practical use. Typically, these systems are designed for consumer convenience and are usually battery powered devices. In this age of portable technology and wireless connectivity, the batteries powering our devices need to last longer—sometimes days, weeks or even months without recharging. In an era where convenience and cost-effectiveness are vital, it is no longer practical to constantly replace or recharge batteries. This alone serves as a reminder to how critical power-efficient designs are for the longevity and continued use of such embedded systems.
Techniques to Reduce Power Consumption
There are many techniques to reduce power consumption, such as utilizing the low-power modes that the device offers or using Core-Independent-Peripherals (CIPs), which is hardware that performs dedicated tasks independently of the CPU. The CIP that this blog post will focus on is the Analog Peripheral Manager (APM).
What Is the Analog Peripheral Manager?
The APM is a versatile feature designed to tackle one of the many challenges designers face—this challenge being how to efficiently manage analog peripherals while reducing the power consumption of the overall system. The APM can automatically turn on and turn off analog peripherals on the device such as the Analog-to-Digital Converter (ADC), Comparator (CMP), Digital-to-Analog Comparator (DAC), Operational Amplifier (OPA) and Fixed Voltage Reference (FVR), eliminating the need for constant CPU intervention and allowing systems to operate for extended periods of time.
The APM offers designers the flexibility to create custom time intervals, during which analog modules activate periodically to perform specific functions before being disabled, allowing the device to return to a low-power state. The APM leverages an internal 16-bit timer with a 16-bit pre-scaler to control the activation frequency of analog peripherals without requiring CPU intervention. This 16-bit timer can be clocked by various sources, including LFINTOSC (31 kHz), SOSC (32.768 kHz), ADCRC or an external clock source connected to a dedicated Peripheral Pin Select (PPS) input pin allowing users to set periods of up to 38 hours.
Analog peripherals typically consume more power than digital CIPs, even when they are idle. The APM is particularly well suited for low-power applications where analog sensors require periodic measurements rather than continuous monitoring.
The APM groups its modules into two distinct Start (S1/S2) and End Times (E1/E2), each having their own dedicated peripheral control registers, (APMPERSx) and (APMPEREx) respectively. Within these registers, users have the capability to tailor their configurations to their application needs. The individual start bits enable specific analog peripherals to activate, and the end bits to disable the respective analog peripherals whenever the desired functionality has been accomplished. This level of configurability gives extreme flexibility to the user, allowing them to determine which analog modules to activate and disable.
The peripherals managed by APMPERSx and APMPEREx registers can vary between devices, depending on the available analog peripherals within each family.
Figure 1: PIC18-Q71's AMPERSx and AMPEREx control registers
Functionality With the Analog-to-Digital Converter
The APM offers a unique feature with the ADC, allowing users to periodically enable the ADC module to save power between samples. This is achieved using the Analog-to-Digital Converter Peripheral Start (ADCA) bit and the Analog-to-Digital Converter Conversion Trigger Start (ADCD) bit. The ADCA bit will prepare the module for the conversion of the signal while the ADCD bit performs the ADC conversion and any computation setup.
Simple Use-Case of the Analog Peripheral Manager
Figure 2 shows a simple example that demonstrates how the APM can be used when sampling signals using an Operational Amplifier (Op Amp), ADC and an FVR. At its most basic level, the Op Amp will be used to prepare signal for the ADC conversion, which can involve buffering or amplifying the analog signal. Additionally, the FVR supplies a stable voltage reference for the ADC.
Initially, all peripherals are turned off to minimize power consumption.
Start Event 1 (S1): Prepare the signal for analog measurement
Enable the Op Amp
Enable the ADC peripheral (ADCA)
Enable the FVR
Start Event 2 (S2): Preform the Conversion
Enable the conversion trigger of the ADC (ADCD)
End Event 1&2 (E1/E2): End Sequence
Disable the Op Amp
Disable the ADC (both ADCA and ADCD controls)
Disable the FVR
In this sequence, the APM is responsible for enabling and disabling these peripherals as needed. It is also worth noting that the APM can perform these functions even while the device is in Sleep mode, highlighting the power-saving capabilities of the APM.
In conclusion, the Analog Peripheral Manager (APM) offers capabilities for optimizing power management and enhancing flexibility in embedded systems. For more information and to learn how to implement the APM in your next design, be sure to check out MPLAB® Discover, which is home to an array of many projects.
Ethan Layton, Dec 19, 2023
Tags/Keywords: Industrial and IoT