With such a broad range of applications, there are many types of microcontrollers which have widely varying sets of features. Figure 1 shows the block diagram of one example.

Figure 1:

An example of a block diagram of a microcontroller. Note at the bottom there are connections for I2S, I2C, UART, SPI and CAN busses

Some microcontrollers are activated by push buttons while others are controlled by sensors or other means. It is fairly common for a microcontroller to have an analog to digital converter (ADC) which converts an analog signal into a digital reading. In less common cases, the MCU may contain a digital to analog converter (DAC) which will convert a series of numbers into voltages.

Generating Test Signals

Microcontrollers will often communicate with other devices via serial data busses. At the bottom of Figure 1 there are connections to I2S, I2C, SPI, CAN, UART and other busses. A design or test engineer who needs to check proper operation of a product that contains an MCU may need to generate test signals in order to check the response of the MCU to various stimuli or may need to use an oscilloscope to look at the output signals from the ports of an MCU to see that it is sending the expected serial data signals. In the first case a function/arbitrary signal generator such as a LeCroy WaveStation or ArbStudio is a useful tool. These instruments can create basic waveforms such a pulse, square wave, triangle, sine and so forth. They can also create more complex signals which could simulate analog waveforms from a variety of sensors or digital signals from other electronic devices. If necessary, multiple outputs of a function/arbitrary generator can be used to create multiple simultaneous signals (both analog and digital). A very useful capability of both the WaveStation and ArbStudio is the ability to import waveforms that have been captured by a digital oscilloscope. This allows the signal generator to produce that waveform repeatedly or to produce a modified version to which the user has added glitches, noise or other changes.

Testing MCU Outputs

An oscilloscope is the most commonly used test instrument for verifying the proper operation of a circuit or to debug faults. Typical oscilloscopes have two or four input channels. Some scopes have MSO (mixed signal oscilloscope) capability which allows them to additionally capture 16 or more digital lines. Oscilloscopes such as the LeCroy WaveAce and WaveSurfer have MSO capability. An engineer testing an MCU may need to look at signals ranging from DC (power inputs to the MCU) up to high speed clocks and serial data signals. It is very easy for the test engineer to get bogged down in looking at strings of logic high and low voltage levels trying to figure out where (or whether) there is a problem in a series of serial data packets. In order to speed the test process, oscilloscope vendors have designed both hardware and software options for oscilloscopes that allow them to trigger and decode many of the popular protocols. Figure 2 shows an example of triggering and decoding an I2C signal. The trigger setup is in the lower portion of the oscilloscope display. In this case, the scope is set to trigger on a combination of a specific address, 5C, and a data packet with a specific value, 4C. On the primary portion of the scope display the address, at the beginning of the packet, is highlighted in red while the data packets are highlighted in blue. The trigger time indicator is the small yellow triangle at the bottom of the display. It is positioned at the end of the data packet whose value is 4C.

Figure 2:

An I2C signal is captured and decoded. The trigger setup is very easy to use.

Summary

Modern instruments make it much faster to test microcontrollers. Though the scopes of several vendors can trigger and decode some serial data protocols, LeCroy offers the widest range of capabilities including I2C, I2S, SPI, SSPI, CAN, FlexRay, LIN, UART, RS 232, ARINC 429, MIL-STD-1553, and a wide variety of other busses. Both the generation of test signals and the capture and decode of serial data can be done automatically. This saves times and helps cut down on mistakes which can happen due to human error.