Eliminating level shifters in microcontroller applications – Part 1

When designing a system, one of the most important design decisions is choosing what voltage domain(s) to use. Some voltage domains, such as 5 V, are good for noisy and harsh operating environments such as those found in industrial applications, while other domains, such as 3.3 V, are commonly used for wireless communication. However, each voltage domain adds complexity to the design and requires a means to communicate across domains. In Part 1 of this two-article series, a new level-shifting peripheral in microcontrollers called multi-voltage I/O (MVIO) will be introduced. MVIO reduces the design complexity and part count required to communicate across domains.

When designing a system, ideally only one voltage domain is needed, which keeps the design process straightforward. In many cases, a single domain is not possible, as many sensors and modules are only available at specific logic levels. Bluetooth and other wireless communication modules frequently operate in the 3.3-V domain, while industrial applications tend use 5-V logic for higher noise immunity in harsh operating environments. The 1.8-V operation is also common in microprocessors and other high-performance devices.

When communicating across voltage domains, it is very important to translate from one domain to the other. Most devices cannot properly handle a higher (than operating) voltage applied to their input pins. This may cause damage or unexpected behavior from the device. As an example, consider an industrial 5-V sensor connected to a 3.3-V microcontroller. The sensor will apply 5 V into the inputs of the microcontroller, which could potentially damage the device or other connected circuits. Figure 1 shows the absolute maximum ratings of a device from the AVR DB microcontroller family. In this situation, the 5 V input signal exceeds the rating of the pins when powered from 3.3 V.

Figure 1 Example of I/O pin limits has been created from Table 39-1 in the AVR DB microcontroller datasheet. Source: Microchip

Another possible problem that could arise is that the signal input might not meet the required low or high input voltage thresholds (Figure 2). This could result in marginal operating behavior. The design might not work at all, or worse, it might work except in specific edge cases or operating conditions.

Figure 2 Example of I/O pin thresholds has been created from Table 39-7 in the AVR DB microcontroller datasheet. Source: Microchip

The standard solution for this problem is to add an external level shifter to the design. The level shifter operates on both voltage domains and shifts from A to B, or vice-versa. But level shifters bring their own costs and problems to the design. There are many different sizes and types of level shifters, with varying feature sets.

A large and complex design may need multiple variants of a level shifter to fulfill the design requirements. For instance, I2C must be used with a bi-directional level shifter, while serial buses, like SPI, will work better with a faster unidirectional level shifter with dedicated inputs and outputs on both domains. Additionally, each external level shifter adds to the bill of materials (BOM) and PCB real-estate.

To eliminate the area and expense associated with using external level shifters, Microchip has introduced a new peripheral called multi-voltage I/O or MVIO; it has been introduced in the AVR DB microcontroller family. MVIO allows a port of the microcontroller to operate in a separate voltage domain than the rest of the device. This special port still retains the normal digital configurability of microcontroller I/O. Since the MVIO features are transparent to the hardware, digital peripherals will function on the port as usual (when powered). This allows for hardware based I2C, SPI, UART, PWM and other peripherals to function and improve the microcontroller’s power efficiency and performance (Figure 3).

Figure 3 An industrial application presents itself as a possible use case of MVIO. Source: Microchip

Key MVIO features

MVIO is true level shifting. The MVIO port can operate on higher- or lower- voltages than the rest of the microcontroller. Currently, MVIO has a recommended operating range between 1.8 V and 5.5 V on the AVR DB family. Here, MVIO requires a dedicated power supply to function but does not require power supply sequencing. If either the primary microcontroller power supply or the MVIO power supply is below the required minimums, then the MVIO pins are tri-stated.

The behavior of the pins when power is restored depends on which supply lost power. In the case of the MVIO supply losing power, the I/O will return to its register settings when powered up. If the microcontroller supply loses power, the pins will reset to the power-on-reset (PoR) defaults when the microcontroller restarts.

During run time, the operation of the MVIO can be monitored by the microcontroller in three ways:

  • Polling the power status
  • Interrupting on power state change
  • Measuring with the ADC

The MVIO status register indicates whether the power supply for the MVIO exceeds the minimum voltage requirement. This bit can be polled by the microcontroller, or an interrupt can be generated when it changes state. Additionally, analog-to-digital converter (ADC) in the microcontroller can measure the MVIO power supply through an internal 10x divider network.

Simple demonstration of MVIO

A visual way to show the MVIO is to modulate the supply voltages while observing a digital output. This creates mixed-signal waveforms that track the power-supply of the MVIO while being gated by the digital I/O. The analog waveforms in the following demo were created on the AVR DB microcontroller via the on-board digital-to-analog converter (DAC) and were buffered by one of the internal op amps to power the MVIO port.

The op amp can be used to power the MVIO in other applications as well, but it comes with two important caveats:

  • The maximum and minimum op amp output voltage is limited by both the microcontroller power supply and the amount of output current.
  • The quiescent current of this setup is much higher than that of a dedicated power supply regulator.

In this demonstration, the value in the DAC is updated every 10 µs from a timer/counter B (TCB) interrupt service routine (ISR), as shown in Figure 4. The ISR either reads a value from a look-up table or computes the DAC value from a pre-programmed formula. The exact behavior depends on the waveform being generated; the sine wave is synthesized from a fixed lookup table, while other waveforms are computed by the microcontroller.

Figure 4 Block diagram of the MVIO demonstration that uses the AVR128DB48 microcontroller. Source: Microchip

To show the digital functionality, a pulse width modulated (PWM) output was set up on the MVIO port. A timer/counter D (TCD) creates a 250-kHz PWM signal with a 50% duty cycle. But, since the TCD doesn’t have an output on the MVIO port, a cell of the configurable custom logic (CCL) is used to pass the signal through to an MVIO I/O pin.

The resulting output waveform is shown in Figure 5 below. The DAC is generating a fixed 1-kHz sine wave for the MVIO supply, with a voltage offset so the MVIO supply does not drop below the minimum operating level and shuts down.

Figure 5 Here is what the resulting output waveform of the demo looks like. Source: https://github.com/microchip-pic-avr-examples/avr128db48-pam-generator-mplab

1.8 V interfacing with the MVIO

To demonstrate a more practical application of the MVIO, Microchip co-developed a demonstration with Melexis, another supplier of semiconductor solutions; the demo uses its MLX90392 3D magnetometer as a window security sensor. Reed switches are a common way of detecting whether a window is open or closed, but the switches are vulnerable to being tricked with an external magnet placed near them. In contrast, the MLX90392 magnetometer measures the magnetic field in three dimensions, making it much more resistant to this type of attack. The user can also program a custom open/closed window threshold to allow the window to be slightly opened without disarming the system.

The MLX90392 magnetometer communicates with the microcontroller over I2C at 1.8 V. Normally, this would require an external level shifter, but since the MVIO is available on the microcontroller, no level shifters are needed. Additionally, an MLX90632 Far InfraRed (FIR) sensor was also implemented to perform room temperature monitoring. This sensor is powered from 3.3 V but has a variant which can also communicate on a 1.8 V I2C bus.

The second voltage domain in this demo is 3.3 V. This domain powers the microcontroller and the RN4870 Bluetooth module. Bluetooth communication was implemented to allow the demo to interact with smartphones without using specialized hardware. In a production application, other simpler and lower-power wireless communication methods, like Sub-GHz radio, may make a better choice for each monitoring node.

This application will be discussed in more detail in Part 2 of this two-article series. The source code and documentation for this application are linked below.

Application source code and documentation: https://github.com/microchip-pic-avr-examples/avr128db28-smart-security-sensor-mplab

Robert Perkel is application engineer for 8-bit MCU business unit at Microchip Technology.

Related Content

Source link