Image
Graeme Clark
Graeme Clark
Principle Product Engineer
Published: October 21, 2022

The latest generation of RA microcontrollers builds on the rich history of the Renesas microcontrollers that came before it, using or enhancing many of the peripheral functions implemented on our older devices. These peripherals have been tried and tested over many years and provide proven reliable and predictable operation, some also provide unique features that can improve an applications performance or reduce power consumption.

In this short series of blogs I’ll highlight some of these unique peripheral functions, and how they can provide real benefit in your application.

My favorite peripheral, and probably one of the most interesting but less understood peripherals inside a typical RA microcontroller, is the Data Operations Circuit (DOC). This can provide some significant performance advantages in real time applications, allowing tasks to be offloaded from the CPU, improving the response time to asynchronous events, and potentially reducing power consumption. This is especially true when the DOC is used in conjunction with some of the other more advanced features available on the RA family.

At the heart of the DOC, is a simple Arithmetic Logic Unit (ALU). This simple ALU has only three basic functions, it can make a 16-bit data comparison, a 16-bit addition, or a 16-bit subtraction, and then to generate an interrupt based on a specified condition. These tasks can all be executed without any intervention from the CPU. See diagram below.

Image
Data Operating Circuit (DOC) Diagram

When using the 16-bit comparison mode, an initial reference value is loaded into the DOC, the 16-bit data to be compared in then loaded and compared with the reference value in hardware. The DOC can be programmed to generate an interrupt on match true or match false.

When using the 16-bit addition mode, an initial 16-bit value is loaded into the DOC, additional 16-bit values are then loaded (can be one or more) into the DOC and are added to the original value. When all the required values are loaded, the count is checked for overflow, and an interrupt generated if required. This simple mechanism allows for a decision to be made if a specific threshold value has been exceeded, ideal for instance for automatic level sensing using the ADC.

When using the 16-bit subtraction mode, an initial 16-bit value is loaded into the DOC, additional 16-bit values are then loaded (can be one or more) into the DOC and are subtracted from the original value. When all the required values are loaded, the count is checked for underflow, and an interrupt generated if required. This simple mechanism again allows for a decision to be made if a specific threshold value has been breached.

However, the true power of the Data Operation Circuit is in the fact that these three simple functions can be used to make simple decisions as to how the system will operate, without any CPU intervention. This means that we can make simple decisions, directly in the hardware of the microcontroller, allowing peripherals to decide how to manage the data they produce based on a simple comparison.

When combined with peripherals such as the Direct Memory Access Controller (DMAC) or the Data Transfer Controller (DTC), which can be used to automate the passing of data to the DOC, we can see how this can be used to create a system that’s capable of making decisions based on data from almost any source. This is done without any CPU intervention, even when the CPU is asleep. In many systems it can also provide a much faster response to changing data, rather than waiting for the CPU to be interrupted to then respond to the event.

We can imagine many uses for the DOC, for instance, when used with the UART interface, the DOC could be used to automatically detect and incoming address and alert the CPU when the address is valid. The DOC could be used with the Analogue to Digital convertor (ADC) in a level sensing system, to detect automatically when the level exceeds a programmed threshold. There are many advantages to using the DOC for functions like these. For instance, the CPU could be dedicated to other high priority tasks, only alerted by the DOC, by interrupt, when a particular condition is reached. The CPU could even be placed into sleep, to reduce power consumption, and only awakened again by an interrupt on a valid alarm condition detected by the DOC comparison.

You can find the Data Operating Circuit on all the members of the RA family, and we have continued to enhance the functions of the DOC and the latest versions have additional functions allowing more complex decisions to be made on data automatically.

In the next blog, I’ll look at the Data Transfer Controller and how this can be combined with the DOC to provide a complete ADC subsystem that operates without any CPU intervention, unless an alarm condition is met, when the CPU can be interrupted if required.

Share this news on