Deploy task-specific microcontrollers to simplify complex designs

Publisher:EE小广播Latest update time:2022-05-11 Source: EEWORLDAuthor: Microchip Technology Inc.Keywords:Microchip Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

image.png

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.

image.png

Memory storage in the device


The MEM OP can also reset the GPIO configuration to the parameters set at compile time.

image.png

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.

image.png

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.

image.png

Solution Block Diagram


Analog Sampling Module

image.png

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

image.png

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.

[1] [2]
Keywords:Microchip Reference address:Deploy task-specific microcontrollers to simplify complex designs

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

#51 MCU#PWM
PWM, the full name of Pulse Width Modulation, is translated as pulse width modulation. Function: Change the pulse width to achieve different effects. Digital signals can be used to achieve the effects of analog signals. PWM is widely used in microcontrollers, and its meanings vary in different applications. Let’
[Microcontroller]
#51 MCU#PWM
Find the cause of the MCU program crashing and running away
If the microcontroller program crashes or runs away, the reasons can be found in the following aspects: 1. Unexpected interruption. Is an interruption enabled, but no response or clearing of the intermediate flag, causing the program to keep entering the interruption and causing the illusion of a freeze? 2. Improp
[Microcontroller]
51 MCU Basics of IoT 05-Control Relay
Preface In this section, we begin to learn how to use the 51 single-chip microcomputer to control relays. With relays, we can use the low level output by the single-chip microcomputer to control the operation during the high level period. For example, if the relay is connected to a 220V electrical appliance, the elect
[Microcontroller]
51 MCU Basics of IoT 05-Control Relay
Teach you to learn 51 single chip microcomputer step by step: light up your LED
2.1 MCU Internal Resources Three major resources: Flash: program storage space RAM: Data storage space SFR: Special Function Register 2.2 MCU Minimum System Three elements: power supply, crystal oscillator, reset circuit 2.3 LED small light Current limiting: 5~20mA (calculated by the current limiting r
[Microcontroller]
Design of Micro Oscilloscope Based on Single Chip Microcomputer
1. Performance indicators (1) Sampling rate: 9 levels adjustable: 334kHz, 100kHz, 50kHz, 20kHz, 10kHz, 5kHz, 2kHz, 1kHz, 500Hz. (2) Working voltage: 3.5-5V, powered by built-in rechargeable lithium battery, charged using computer USB port. (3) Input impedance: 1MΩ. (4) Input voltage: ±2.5V, ±12.5V two adjustable level
[Test Measurement]
Design of Micro Oscilloscope Based on Single Chip Microcomputer
C51 MCU Learning Notes (II) - Implementation of Patterned Flowing Lights
1. The functions of MCU pins, crystal oscillator, and reset Reset circuit: Reset is the initialization operation of the microcontroller. When the microcontroller starts, it needs to be reset first. Its function is to "clear zero", that is, the CPU and other components are in a certain initial state and start from th
[Microcontroller]
C51 MCU Learning Notes (II) - Implementation of Patterned Flowing Lights
Detailed explanation of MCU IO structure
1. What is source-sink type? What is a pull-up resistor? Pull-down resistor? What is line drive output open collector output, push-pull output? Let’s first talk about the structure of open collector output. The structure of the open collector output is shown in Figure 1. The collector of the right triode is not connec
[Microcontroller]
MCU sleep-external interrupt INT0 INT1 wake up (assembly + C language program)
I would like to share with you a sleeping program that I adapted myself after searching for information on the Internet for a long time. It can be used for projects that have requirements for static power consumption. The microcontroller source program is as follows: /**************** Functional description of this
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号