Deploy task-specific microcontrollers to simplify complex designs
Microchip Technology Inc.
8-bit MCU Product Department
Robert Perkel
Abstract: Task-specific microcontrollers can help simplify the design process for a variety of applications by offloading tasks and workload from the main microcontroller or microprocessor.
Today, large 32-bit microcontrollers (MCUs) and microprocessors (MPUs) running real-time operating systems (RTOS) are becoming more and more popular. However, if a large microcontroller is used to handle complex applications, it may encounter problems with CPU resources when performing small background processing tasks that are not complex but very time-consuming. Small devices such as 8-bit and 16-bit MCUs can be used to offload the workload of 32-bit devices.
Consider an example where a 32-bit MCU is used to control non-safety functions of a car, such as the entertainment system, ambient lighting, and air conditioning. This 32-bit device must allocate its resources to handle all the tasks associated with these functions. Such tasks also include measuring the temperature at multiple points in the cabin, turning the air conditioning system on/off, updating the graphic display, processing user input, adjusting lighting conditions, and playing music. These workloads are too heavy even for a large 32-bit device.
However, if 32-bit devices offload some of these tasks to subprocessors that require little monitoring, with each subprocessor handling only one or two of these tasks, these tasks will be more manageable. This frees up CPU resources on the main processor, reducing software complexity while improving performance and reducing execution time.
This solution is similar to the way peripherals work in microcontrollers. Peripherals are small blocks of specialized hardware that can add new functionality (such as an op amp or analog-to-digital converter) or reduce the amount of work the CPU must do to perform a given function. In some cases, after initialization, peripherals can operate independently of the CPU.
To illustrate the benefits of peripherals, let's take the example of generating a pulse width modulated (PWM) signal. To generate PWM without a dedicated peripheral, you simply set the I/O line high, wait a certain number of cycles, set it low, wait again, and repeat. This takes a lot of CPU cycles and is difficult for some functions (such as RTOS) to perform reliably. In contrast, a PWM peripheral allows the CPU to set the desired waveform parameters while performing other tasks.
The first example presented in this article illustrates the benefits of offloading CPU-intensive tasks. In this case, an 8-bit MCU was used to create an I/O expander. I/O expanders are not complex; however, they can consume a significant amount of CPU time because they frequently need to handle interrupts. By using a dedicated MCU for this task, large 32-bit devices can reduce I/O usage and the number of interrupts that need to be handled. In addition, the feature set of the I/O expander can be set in software, allowing it to be customized and tuned to the application.
The second example in this article demonstrates the performance of core-independent peripherals by creating a voltage-to-frequency (V/F) converter that runs independently of the CPU. In this example, the CPU's only function is to initialize the peripherals and send debug print messages to the UART. In a larger system, the CPU can perform another simple task while the V/F runs in the background.
I/O Expanders
The biggest benefit of using an 8-bit MCU to create an I/O expander is increased flexibility. The feature set of the I/O expander ASIC is already embedded in the device, while the MCU can define its behavior based on the software it executes. This flexibility allows the MCU-based version to meet the needs of the end application.
Implementing Advanced I/O Expanders
Internally, the Advanced I/O Expander operates on a lookup table-based structure. Before a read or write, a virtual address is sent. This address has nothing to do with a register on the microcontroller - it is specific to the lookup table. This means that functionality that is not in the microcontroller hardware registers can be added transparently. In addition, the entries in the table can be easily rearranged for specific uses. Another advantage of this structure is the ability to add permissions to the lookup table. For example, to create a read-only register, simply omit the write entry of the lookup table.
Lookup Table for Advanced I/O Expanders
This more complex structure also accommodates non-standard functions. The “MEM OP” function allows the MCU to save or load its current General Purpose Input and Output (GPIO) configuration into memory.
Memory storage in the device
The MEM OP can also reset the GPIO configuration to the parameters set at compile time.
Note: Not all fields are available for all operations.
Functions of MEM OP
Additionally, the microcontroller can be optionally set to load saved settings at power-up. If enabled, the microcontroller will attempt to load the settings in Configuration 0. If the configuration fails to perform a checksum verification, the MCU will revert to compile-time constants. This feature can be disabled in software if not required.
Key points of the solution
The advantage of MCU-based solutions is excellent flexibility. Unlike ASICs on the market, we can configure MCUs with non-standard functions specific to application scenarios. This application is developed for the general-purpose PIC16F15244 series MCU.
For a deeper dive into the implementation or to try out the example, see the README file in the source repository. A demonstration of the Advanced I/O Expander with Arduino is also available.
Voltage-to-frequency (V/F) converter
Voltage-to-frequency converters improve upon traditional analog solutions by reducing bill of materials (BOM) costs and, in turn, design area. Many V/F converters on the market require external resistors and capacitors to operate, whereas microcontrollers can operate using only common decoupling and pull-up components, which are a must for all MCUs.
TC9400/TC9401/TC9402 10 Hz to 100 kHz V/F Converter Application Schematic
Instead of using analog techniques for digitization, MCUs use a combination of peripherals and functions that are independent of the core. The MCU uses an internal analog-to-digital converter (ADCC) with computational functions to measure the input signal and then divide the clock signal to create a variable frequency output. In this example, the peripherals have been set up to run independently of the CPU after initialization. This means that the CPU can be used for other tasks in the final application.
The challenge with an MCU-based solution is that the performance is not as good as an analog solution. The resolution of the output is inherently limited by the ADCC. On the surface, the ADCC is 12 bits, but it will run at 14 bits of resolution configured as oversampling, depending on how the program is configured. Likewise, the on-chip numerically controlled oscillator (NCO) used to synthesize the output frequency has limited resolution and there may be jitter in its output, depending on the value measured by the ADC.
The MCU-based solution can be divided into three different peripheral modules - analog sampling module, output oscillator module and duty cycle generator.
Solution Block Diagram
Analog Sampling Module
Analog sampling module implementation
The analog sampling block is responsible for performing the analog-to-digital conversion. In order to achieve a 100 kHz output within the frequency limitations of the device, the ADCC has been configured to oversample and then average to obtain a 14-bit result.
This oversampling configuration has the disadvantage of adding additional statistical noise to the result, which can be compensated for by calculating the average of the oversampled values and adding hysteresis. To implement hysteresis, the threshold interrupt feature of the ADCC can be used. (For simplicity, only the details of how this example uses the threshold interrupt feature will be described.)
After the ADCC has completed the oversampled average calculation, the resulting value is compared with the set value register in the peripheral. If the difference between the two is greater than or less than the set threshold, an interrupt is triggered. The CPU can mask this interrupt and will not be affected, however, this interrupt will trigger a direct memory access (DMA) to copy the averaged oversampled result to the ADCC set value register, resulting in hysteresis. If the threshold is not exceeded, the DMA copy will not occur, and the DMA update of the output oscillator module will not be triggered.
Output Oscillator Module
Output Oscillator Module Structure
The output oscillator block of this solution is responsible for generating a clock signal at the desired output frequency. This output signal is internally connected to a duty cycle generator, which halves the output frequency but produces a 50% duty cycle output. Therefore, the output oscillator block runs at twice the output frequency.
The heart of the Output Oscillator module is the Numerically Controlled Oscillator (NCO). The NCO peripheral works by adding incremental values to an accumulator on the rising edge of the input clock and then deriving the output of the peripheral based on accumulator overflow. (See the data sheet for a complete description of the NCO.)
In this example, NCO2 has been set up to internally create the required input clock frequency to obtain a 100 kHz output from a 14-bit input. A 14-bit result is used because the 12-bit result from the ADCC itself is not sufficient to produce a 100 kHz output without an external clock source.
Previous article:New strength added to domestic general-purpose MCUs--Xinji Semiconductor launches the HPM6300 series
Next article:Mir MYC-J1028X new product released! Dual-core Cortex A72+ supports 6 Gigabit industrial network ports!
Recommended ReadingLatest update time:2024-11-16 10:39
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications