On Zhihu, there is a very popular question – “What advanced applications are there for MCUs?”“
Zhihu:https://www.zhihu.com/question/623077193
It is often said that MCUs themselves are not particularly advanced. During the MCU development process, it is necessary to follow certain standards, such as defining variables and functions, determining their lifecycle, calling scope, access conditions, etc. Common communication protocols should often be abstracted, specifying fixed inputs and outputs to facilitate product portability.
However, in reality, there are often multiple implementation solutions for the same requirement, but there is always one optimal solution. Therefore, in this process, there are always some “out-of-the-box” operations that provide many ideas. Today, I will give a few examples for your reference.
Those Impressive Applications
When receiving a string of variable-length data via a serial port, you can use the serial port idle interrupt; this avoids entering an interrupt for every character received, reducing the number of times the program enters an interrupt and thus improving efficiency.
When measuring the frequency of a waveform, many people choose external interrupts. In fact, counting the waveform edges using the external clock input of a timer and then periodically reading the count to calculate the frequency can greatly reduce the interrupt trigger frequency and improve program execution efficiency.
In complex multitasking scenarios, a Real-Time Operating System (RTOS) can be used to manage task scheduling, improving system responsiveness and resource utilization.
For low-power operation scenarios, Dynamic Voltage and Frequency Scaling (DVFS) technology can be employed to adjust the MCU’s operating voltage and frequency in real-time based on system load, thereby reducing power consumption.
When storing data, using a flash memory wear leveling algorithm can extend the lifespan of the flash memory.
Utilizing hardware encryption modules (such as AES encryption engines) to ensure data security and confidentiality, rather than implementing encryption through software, improves encryption efficiency and security.
For processing sensor data, employing digital filtering algorithms (such as Kalman filtering) can enhance data accuracy and stability.
When needing to communicate with multiple devices, using a bus arbitration mechanism and priority settings ensures efficient and stable communication.
In power management, monitoring power voltage and current can enable intelligent power management strategies, such as entering low-power mode when battery levels are low.
For control tasks with extremely high real-time requirements, using hardware-triggered interrupts instead of software polling can reduce response delays.
Any dynamic control of a nonlinear system running on a microcontroller is considered an advanced application.
Using a microcontroller to implement a specific motion control and making a lot of money from it is also an advanced application.
GPIO Simulates Everything
A user named ShiinaKaze has done something quite challenging.
He used an STM32F1 to simulate a camera interface to drive the OV2640 camera module using GPIO. He stated that it was a very torturous process, and he optimized it to a maximum of 1.5 FPS, so choosing the right model is crucial to avoid torturing oneself. The device uses STM32F103C8T6 and OV2640, achieving the following effect:

Actual timing diagram of OV2640:

The challenges of this project include: 1. SCCB simulation: SCCB is a revision of the I2C bus, mainly because the OV2640 module does not have pull-up resistors, making communication impossible. It took a long time to discover this issue; 2. Simulating the parallel interface: If using IO simulation, only 1 FPS can be achieved, but by using Timer and DMA, it can reach 1.5 to 2 FPS.
Regarding the background of data reception and processing for the image sensor: The existing OV2640 image sensor has a DCMI (parallel interface). The problem is: the existing STM32H7 wants to obtain the MJPEG stream data from OV2640 and transmit the data to PC software. 1. Should we use USART or USB? 2. Which interrupt should we choose for data reception, Line interrupt or Frame interrupt? 3. DCMI transfers data to a RAM buffer via DMA; how should the buffer be designed? Should we set up a large continuous buffer or use a ring buffer to avoid data overwriting and disorder? 4. After triggering the interrupt, should we disable DCMI and DMA?
Embedded software architecture is quite important, especially for large projects. This is the software architecture for STM32; I wonder if anyone has other architectures.
A user complained that if you were in school, I would respect you as a man, but if you were doing this in a job, then your architecture is too poor. He also stated, “I was wrong, I will never simulate again.”

Different Perspectives on MCUs
Despite this, many still believe that MCUs are not advanced, and using microcontrollers is not advanced either. Advanced content is something that can be published in papers, but using microcontrollers to solve specific tasks is quite advanced.
Especially the examples mentioned above are indeed some high-end applications of MCU peripherals. However, these mechanisms may just be standard practices. A user named lion187 stated that many hardware mechanisms are added only after there is a practical need, such as receiving variable-length data. Initially, without timeout interrupts, it could only be implemented in software, which greatly wasted CPU efficiency, leading to the design of timeout interrupts to reduce software workload, thus forming a standard usage method.
Of course, this is also a benefit brought by the improvement of chip design and manufacturing processes. In the early days, when chip design and processes could not meet the needs of complex peripheral circuits, no one dared to think of using hardware to implement such complex functions. The development of any product is inseparable from specific business needs, and MCUs are no exception. For products, the driving of MCU peripherals is just a basic element of development; more work revolves around the application program development of business logic. At this point, data structures and algorithms, various control algorithms and numerical computation methods, design patterns, software engineering, and design concepts become advanced topics.
For example, the design of various driver subsystems in the Linux kernel, device objects, and driver objects have adopted the object-oriented programming ideas of C++, which can also be applied to MCU development. By separating devices from drivers, the same set of driver algorithms can be used to implement different driving methods for similar devices. For instance, the same UART driver can drive UART0 or UART1 based on different configurations, and the baud rate can also differ (as long as different instances of the UART class are created, this can be done using C language). This is the benefit of separating methods and properties in C++.
Similarly, in business application parts, the use of design patterns such as singleton and factory patterns, as well as state machine models, can bring many conveniences to development, making system structures clear, effectively reducing the number of bugs, and making maintenance and expansion easier.
Of course, some believe that when it comes to advanced applications, FPGA is the way to go. For example, with AMD’s (Xilinx) ZYNQ, when you need to receive a string of variable-length data via a serial port, you can directly use the Programmable Logic part to write a dedicated function, with the final result placed in DRAM, sending a signal to notify the ARM processor to read it. When you need to measure the frequency of a waveform, you can directly use the Programmable Logic part to write a dedicated function for real-time continuous measurement. This is indeed very advanced.

So, what are your thoughts on this? Do you have any “advanced” applications you would like to share?
Finally, we also welcome hardware team leaders, hardware managers, hardware directors, company CTOs, and CEOs to purchase our curated high-quality hardware design materials. When doing hardware, you must learn to summarize!
Disclaimer:
This account maintains neutrality regarding all statements and views of original and reprinted articles. The articles are provided for readers’ learning and communication. The copyright of the articles, images, etc. belongs to the original authors. If there is any infringement, please contact us for deletion.
—— The End ——Recommended ReadingFour Methods of BLDC Current Sampling and Their Advantages and Disadvantages ComparisonThe Impossible Triangle of Project Selection: Wanting, Needing, and Also Wanting, Has Come True!?Summary of Four Common RS-485 Isolation Solutions
Share 💬 Like 👍 Read ❤️
Support quality content with a “three-link” action!