Home Instrumentation Elimination of short duration interference

Elimination of short duration interference

Anthony Stram of Microchip Technology observes the effect of switching the channel of an A/D converter on the I/O pins
When switching between channels of an A/D converter on a microcontroller many problems can often arise at the input and output. Analog functionality can create complex interactions with the digital part of the circuitry and the firmware it is running on. This causes the application to have unwanted interactions unless the analog functions are understood. Digital logic controls the analog channel multiplexer (MUX). Being an element that uses digital logic that switches between analog channels (A/D converter), signals from different pins of the device can be momentarily connected. Thus, two unlinked I/O pins can be connected when switching the input channels of the A/D converter. I/Os can be connected for as long as the signal needs to propagate through the MUX to trigger a change in the A/D converter channel. This connection can last up to 40ns, a time greater than the minimum rise and fall times – 15 to 30ns – of the logic of the I/O pin, thus causing a short duration interference signal (glitch) in the connections. pins connected. The effects of the interference can last more than 40ns due to the time it takes for the pins to change their state and recover the previous level. As an example, when switching between A/D converter inputs AN2 and AN5, RB4 and RC0 could be connected during the switching time.

Since RB4 is configured as an input controlled halfway by high-level and low-level logic, interference can cause it to be seen on RC0 as if it were an output. When the two connected pins are at the same logic level, the crosstalk is reduced to less than 10mV. In the most extreme case, where both pins are at different logic levels, the interference can exceed 160mV. Another source of interference can originate from the switching of the channels of the A/D converter itself. These interferences can be seen externally if the input channel of the A/D converter is also an input to an active comparator or op amp in the device. There can be three different sources of interference: 1. The channel switching of the A/D converter varies the voltage across the sample-and-hold capacitor of the converter itself, thus generating interference due to potential differences across the capacitor. Depending on the level of the external voltage applied to the capacitor, the interference can be positive or negative. 2. A second interference may occur while the first one is still recovering. This interference is due
to the disconnection of the capacitor with respect to the electronics of the pin. 3. The third interference occurs when the conversion is complete and the capacitor is reconnected to the pin electronics.

Digital tickets

When the I/O pins are used as digital inputs, there is little scope to avoid switching problems on the A/D converter channel. If the input pin is being polled, one option is to not switch the A/D converter channels during the poll cycle. If you are not polling, you would not need to check for an input pin state change after switching an A/D converter channel. Enter a NOP (no operation) instruction after the channel change, and then check the input state change. The best option, at least for handling a change of state, is to debounce the input in software. Multiple check the input and count the number of times a particular status is logged. Once a sufficient number of state changes have been registered, the state variable can be changed. In this way, any switching interference of a channel of the A/D converter can be filtered against a possible change of state.

digital outputs

Using the digital pin as an output can cause spurious interference to external circuitry when switching an A/D converter channel. The output pin, when going high or low, may see interference corresponding to the opposite direction of the desired state. For example, if the output is pulled high, interference in the negative direction of up to 200mV below the high state may appear on the pin. This interference can last between 15 and 40ns depending on the stabilization time of the switching logic. The main ways to reduce or eliminate the problem are to reduce the energy in the interference, make external circuitry immune to interference, or filter out the interference altogether. First, try adding a resistor to the output pin to limit the current in the interference so it doesn't appreciably affect the external circuitry. External circuitry with Schmitt trigger inputs would be immune to interference due to their inherent hysteresis. Another option is to filter the interference. A low pass RC filter on the output pin will reduce or even eliminate any interference so that it does not reach the external circuitry. Several factors must be taken into account when choosing the values ​​of the R and C components of the filter. The RC time constant should be greater than the interference duration (t > 40ns) to filter the interference. The RC time constant is equal to R x C. Be careful with the frequency response of the RC low-low filter so that it does not interfere with the external circuitry. The cutoff frequency should be at least one decade higher than the highest frequency signal the application supplies to that pin. The cutoff frequency fc is equal to 1/(2πRC). As an approximation, using the rise and fall times of the interference from 15 to 40ns (tr) a frequency of interest between 8 and 24MHz (bandwidth) would be obtained. Thus, an approximate idea of ​​the highest frequency component of the interference is obtained from the equation that relates bandwidth and rise time (the bandwidth of the signal is equal to 0,35/tr). In this case, tr equals 10 to 90 percent of the rise time of a square wave.

Analog inputs

First and second analog interference can be reduced or eliminated by pre-charging the sample and hold capacitor using a D/A converter. Set the D/A converter to a voltage level close to the expected voltage at which the A/D converter will sample in order to reduce interference. The sample and hold capacitor must be charged before switching the channels of the external A/D converter. If the approximate voltage is known, the D/A converter can be used to pre-charge the capacitor to a similar potential. The third analog interference is eliminated by switching the A/D converter to a different channel after the conversion has started, but before it has finished.
Start by selecting the conversion channel and then
n start the conversion. Then switch the A/D converter to the next channel to be converted. Finally the conversion is complete and the process can be started again.

Conclusion

Be careful when switching between channels of the A/D converter as the switching logic can inadvertently connect the I/O pins. If the recommendations indicated here are applied, many of the effects caused by channel switching can be mitigated. Modern microcontrollers with digital and analog components close together can be the source of problems never seen before, but following a few simple tips can get your application working properly.

Tags
short sideburns