Using Smart I/Os to build pin-level digital logic functionality and reduce CPU loading - Embedded.com

Using Smart I/Os to build pin-level digital logic functionality and reduce CPU loading

Engineers working on system design often face the need to implement pin-level digital logic on input and output signals. For example, systems engineers working on clock propagation through a microcontroller often need to create clock trees, replicate an input clock into several buffered instances (with appropriate driving capabilities), and/or invert clock polarity. There are numerous other examples in which systems engineers have to implement combinatorial logic on the output or input signals. The option they usually have is to implement these last-minute changes using external components such as discrete combinational logics and “blue wires” to connect these components. This not only inflates the bill-of-material cost but also involves time-consuming PCB spins.


Figure 1. MCU + Discrete Logic ICs (Source: Cypress Semiconductor)

With the rapid growth of battery-operated devices, power consumption has become a major concern for systems engineers. Every bit of energy saved adds longevity to the battery before it has to be charged. Therefore, systems engineers try to offload the CPU – one of the most significant contributors to the total power – by implementing some simple I/O signal-processing tasks in hardware. For example, multiple breathing LEDs can be implemented by using XOR gates with two pulse-width modulated signals as inputs and the I/O port as output. The two pulse-width modulated signals should have slightly different frequencies; the beat frequency is the desired breathing rate of the LEDs. This scheme saves the CPU from turning ON at regular intervals, which would have been the case had this logic been implemented in firmware.


Figure 2. Hardware Implementation of 8 Breathing LEDs (Source: Cypress Semiconductor)

Today, microcontrollers are available that offer programmable logic on I/O ports for integration of board level glue logic IO functionality such as AND, OR, and XOR gates. Figure 3. shows how such a Smart I/O block might be integrated. The Smart I/O block is positioned in the signal path between the MCU’s Peripherals (such as TCPWM, UART and SPI) and the I/O port. Inputs to the chip from the I/O port can be logically operated upon before being routed to the MCU’s peripherals and connectivity of the chip. Likewise, outputs from the peripheral blocks and internal connectivity of the chip can be logically operated upon before being routed to the GPIO port. The Smart I/O block can operate even when the device is in low-power modes and can wake up the chip using the port interrupt, when required.


Figure 3. Example of Smart I/O in a microcontroller (Source: Cypress Semiconductor)

Components of Smart I/O block
Each Smart I/O block is associated with a specific port and can operate on the signal coming from or going into that specific port. In the case of the PSoC 4 from Cypress, for example, the Smart I/O block is composed of eight 3-input Look-Up Tables (LUTs) with an interconnection matrix as shown in Figure 4.


Figure 4. Smart I/O LUTs (Source: Cypress Semiconductor)

Smart I/O offers flexibility for interconnection using the interconnection matrix. Users need not write any code to configure the Smart I/O block. The MCU design tool chain, in this case PSoC Creator, simplifies the configuration of the Smart I/O block using a graphical user interface.

The input signals to the LUTs and the output signal from the LUT can be easily routed by selecting the dropdown list in the GUI. The Smart I/O LUTs truth table can be configured by specifying the output value for all the possible input combinations as shown in Figure 5.


Figure 5. Configuring the Smart I/O LUTs in PSoC Creator (Source: Cypress Semiconductor)

Next page >>

Applications of Smart I/O blocks
There are numerous applications that can use Smart I/O to reduce BOM, CPU loading, and device power consumption. The following examples demonstrate two such applications:

Using Smart I/O to implement logic elements – Smart IO LUTs can be used as general logic elements to build custom logic functions. Examples include logic gates, four-to-two priority encoders, shift registers, and glitch filters.

Figure 6 shows the implementation of a breathing LED by XOR-ing two PWM signals that have slightly different frequencies. Figure 7 shows how the Smart I/O in a PSoC 4 MCU can be used to implement the LED breathing effect. Here the XOR gate is implemented in the Smart I/O by configuring the LUT truth table as shown in Figure 8.


Figure 6. Implementing LED Breathing Effect using Logic Gates (Source: Cypress Semiconductor)


Figure 7. Implementation of LED Breathing Effect using PSoC 4 Smart I/O (Source: Cypress Semiconductor)


Figure 8. Implementing XOR gate using Smart I/O (Source: Cypress Semiconductor)

Pattern Detection – Smart I/O LUTs can be configured to detect a particular pattern on the input signals (for example, logic to detect if three input signals are all low). Battery-operated embedded systems put the microcontroller into low power modes to reduce power consumption. When a specific event occurs, the CPU is woken up by an interrupt to process the event (Figure 9).


Figure 9. Low-power embedded application (Source: Cypress Semiconductor)

In certain applications, it is required to wake-up the device based on specific combination of multiple events and process the event. Microcontrollers available in the market today require the CPU to wake up to detect this pattern and process the event. This causes the CPU to unnecessarily wakeup at each event and check for the specific combination, which results in increased power consumption.

Smart I/O can work in low-power modes and be used to wake up the device based on a specific combination of multiple events. Figure 10 shows an application where the MCU wakes from deep sleep based on a specific combination of multiple events. In this case, only when both the inputs are high (i.e., it is dark and the window is open) the device wakes-up and sends the sensor status to the receiver or drives an alarm to inform the user to lock all the doors.


Figure 10. Detecting Specific Pattern using PSoC 4 Smart I/O (Source: Cypress Semiconductor)

An implementation of this system is shown in Figure 11. The inputs from the two I/O pins are AND-ed by the Smart I/O block and fed to the CPU wakeup interrupt controller to wake up the device from deep sleep (Figure 12). Waking up only when both the conditions are TRUE results in reduced device power consumption and longer battery life.


Figure 11. Detecting Specific Input Pattern – PSoC Creator Implementation (Source: Cypress Semiconductor)


Figure 12. Implementing AND gate using Smart I/O (Source: Cypress Semiconductor)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.