Communication is crucial when it comes to embedded systems. Whether we are reading data from a sensor or sending information to another device we always rely on some type of communication interface (e.g I2C, SPI, UART, etc. ). In a perfect world, we would not have to worry about the factors that can make our communication unreliable, however, in practical situations, these factors are always present. We should be aware of that and try to mitigate their influence on our design. In this article, we will explain what a slew rate is and why it is important to be properly configured when it comes to using microcontroller digital outputs.

Slew Rate Theory

An ideal square wave signal looks like the one shown below in Fig.1. It has instantaneous transitions between the high and low levels.

Square wave signal without slew rate
Fig. 1 Ideal square wave signal

In practical situations, the signals in embedded systems will have transition time (slew rate) between the high and low levels and look like the one shown below in Fig. 2.

Square wave signal with slew rate
Fig. 2 Real square wave signal with slew rate

Slew rate (SR) (a.k.a slope of the signal) can be defined as the maximum rate of change of a voltage per unit of time.

SR = ΔV/Δt

The units usually used in datasheets of microcontrollers for specifying the output slew rate is V/μs. We should note that there is a difference between slew rate and rise time. The information they provide may differ depending on the context. For example, we can have two signals with identical rise time, but we can’t say for sure that their slew rate is also identical, as we need to know their amplitudes to make that judgment.

Practical Aspects of Slew Rate Control

Not having a signal with perfect waveform is not always a bad thing, in many cases, it may prove to be better for the performance of the embedded system.

A signal that has a fast slew rate contains more high-frequency components. This will result in radiated electromagnetic interference (EMI). Having a slower slew rate will reduce the high-frequency components of the signal and the EMI, but it may cause timing issues. In short, there is always a trade-off between the timing and the noise.

Communication interfaces usually have specific requirements regarding the slew rate. For example, I2C specification states that for 100kHz and 400kHz speed of communication the rise time should not exceed 1 us. In this particular case, the communication uses open-drain outputs and the rise time can be influenced by the selection of the pull-up resistors on the lines.

Having the ability to control the slew rate allows us to best adapt the rise and fall times of the signal so they cover the signal integrity requirements of the particular application. Some microcontrollers have integrated slew rate control for their digital outputs. If such control is not available we can use an external circuit to influence the slew rate. This is usually a resistor in series with the output that forms a low-pass RC filter (the capacitance is already present due to the line length and other devices connected to it).

Summary

  • All digital signals have some transition time from one logic level to the other.
  • The goal is to have the slowest output slew rate configuration that complies with the timing requirements of our application.
  • Having a slow slew rate reduces radiated emissions.

Was this article helpful?