Testing embedded microcontrollers using multiple types of modular instruments
Embedded systems, used in applications ranging from toys to advanced aircraft, use microcontrollers to execute specialized operations within a more complex system. Most microcontrollers are mixed signal devices using a combination of analog and digital signals. These embedded controllers need to communicate with other system components using complex serial interfaces and protocols that, while commonplace, can be difficult to verify and troubleshoot. Verifying, troubleshooting, and debugging these microcontrollers can require multiple instruments, including instruments to measure and confirm physical layer signal and digital data content. Embedded microcontrollers can also incorporate analog to digital converters (ADC) requiring analog signal sources for testing. Using modular instruments can perform all the required tests, lowering the cost of testing and reducing the required bench top space. They can combine digitizers to measure analog signals, arbitrary waveform generators to provide real-world signals, and digital input/output modules to stimulate and measure digital signals.
Consider as an example the microcontrollers used in a refrigerator. These embedded controllers must deal with the control panel user interface, controlling the cooling compressor, and the general operation of functions like an ice maker, the defrosting heater and fan. Designs may even include Wi-Fi interfaces. An example of a typical embedded control system for a refrigerator is shown in Figure 1.
From a testing point of view the system uses parallel and serial data links, analog sensors, motor controls, and DC power supplies.
Testing this system will require several modular instruments. The analog signal analysis requires a digitizer. Acquiring, simulating, and analyzing the digital data requires a digital I/O module. Simulation of analog sensor signals and physical layer serial communications waveforms can be accomplished using an arbitrary waveform generator (AWG).
The refrigerator embedded controller signals have moderate signal bandwidth. The Spectrum Instrumentation model M2p.5968-x4 eight channel digitizer, M2p.6568-x4 eight channel arbitrary waveform generator, and M2p.7515-x4 digital waveform/pattern generator with 32 I/O channels, shown in Figure 2, are well matched to the required testing.
These three modular instruments can be linked together using a Star-Hub module to achieve phase stable synchronization. These are PCI Express x4 cards that can stream data at up to 700 Mbytes per second. They are supported by Spectrum Instrumentations SBench 6 software or a wide variety of third-party software packages and programming languages.
Power Integrity Measurements
Testing usually begins with the power supplies. Generally, the nominal value of each supply rail and its associated load current are measured. Additionally, the microcontrollers generally have a specified power-on sequence. Starting the appliance while monitoring the power buses provides a view of the order in which the power supply voltage buses reach their specified voltages. A similar test is to monitor the shut-down power sequence. Examples of this type of testing is shown in Figure 3 using the model M2p.5968-x4 digitizer and Spectrum Instrumentations SBench 6 software to control and display the digitizer signals. Probes or attenuators may be needed for voltage magnitudes above 10 volts.
Power quality is also measured by evaluating the ripple on each of the power rails. Figure 4 is an example of the ripple measurement on a +12 Volt power rail. The ripple has a peak-peak amplitude of 27.5 mV as recorded in the peak-peak readout in the info panel to the left of the display grids. The average voltage of the rail is also recorded as 11.95 Volts. The ±10 Volt range is used with a 10 Volt offset; the high 16-bit resolution of the digitizer still permits measurement of the ripple in the order of tens of mV.
The Fast Fourier Transform (FFT) of the ripple signal shows its frequency composition. The two right hand grids of the figure shows that the frequency content of the ripple is principally below 10 kHz. The upper grid is the FFT shown with a span of 20 MHz while the lower grid is expanded horizontally to see the spectral detail below 100kHz, including the power supply switching frequency of 40 kHz. The FFT is an analysis tool that is part of the Spectrum Instrumentation SBench software for control, analysis, and measurement for the modular instruments. The wide dynamic range of the FFT shows of the 16-bit amplitude resolution of the M2p.5968-x4 digitizer. The signal peaks in the FFT are all in the range of -120 dB below the full-scale signal.
Digital Signal Measurements
Embedded systems utilize both individual digital control lines and bus structures containing multiple digital signals. In the example embedded system the links to the LCD display and the memory are parallel buses. Digital signals can be acquired or sourced by a digital I/O card like M2p.7515-x4 with 32 I/O channels. Figure 5 shows a digital acquisition of an eight-bit bus.
The M2p.7515-x4 offers 32-bits of digital input or output and clocks at a maximum rate of 125 Mb/s. Its digital threshold is compatible with digital inputs of 3.3 V and 5.0 V TTL. The input impedance of each input is user selectable as 110 Ohm or 50 kOhm, with the inputs having access to 1 GByte of on-board memory. For greater than 32 digital signals, multiple I/O cards can be linked. The digital signals can be displayed using the SBench 6 utility program. Multiple digital signals can be displayed in SBench 6 either individually in a line view or ladder diagram or they can be bundled in a bus view as shown in Figure 6.
The left-hand grid shows the bus view expanded to see the bus value versus time. Bus values can be displayed in hex, as shown, or in octal, binary, or as signed or unsigned decimal values.
Digital signals arising from the serial data buses, shown in the examples embedded system functional diagram, can be acquired, and displayed in either analog or digital format as shown in Figure 7.
The digital waveforms plot logic state versus time. The logic state is determined by a comparator which determines if the input waveform is above (digital 1) or below (digital 0) a logic voltage threshold. Transitions are sharp, being only one sampling clock period in duration. The example in the lower right grid of Figure 7 shows vertical transitions and no noise. In comparison, the analog signal in the upper right grid shows all the instantaneous perturbations of an analog domain, noise, overshoot, and finite transition time.
Digital waveforms should only be used to determine logical data content and timing either as a single line or as a bus display. Analog waveforms allow measurements of instantaneous amplitude values as well as timing. Signal characteristics like transition time, overshoot, under shoot, and noise level should be determined based on measurements of an analog signal.
Testing the response of a serial data interface
The microcontroller has three subassemblies which exchange information via serial data interfaces. The performance of the receivers in these interfaces can be tested using an AWG. The AWG, producing analog waveforms, can provide the required data patterns but can also vary the signal's transition times, amplitudes, and timing as well as add impairment (such as noise).
The AWGs used in this example have a full featured sequence mode which offers the ability to switch between waveforms in near real time eliminating even the time to reload different waveforms. The AWGs waveform memory is segmented, and every waveform needed for a test can be stored, each in its own segment. The AWG steps through the waveforms based on the instructions stored in a separate sequence memory. The contents of the sequence memory can be updated or changed without affecting the output state of the AWG. This sequence mode operation allows adaptive changes in the test sequence based on a test result. This permits adaptive waveform modification based on other measured results. It's a capability that greatly reduces test time and improves the thoroughness of the test.
As an example, the data content of a serial data stream can be altered is shown in Figure 8.
Each of the serial data streams in the figure has a different content. They are stored in the AWG's waveform memory and output in the order specified by a separate sequence memory. The content of the sequence memory can be changed without stopping the output in progress, resulting in a jump to a different segment. This permits adaptive change in the AWG output. So, for instance, the AWG can be used to replace the control panel simulating the front panel switch operations. An example might be simulating a change in the refrigerator temperature setting and monitoring the responses of the compressor.
The refrigerator has a few electro-mechanical subsystems like the ice maker, frost free ventilation, and the main cooling compressor. The frost-free ventilation fan uses a simple on-off control driven by a single digital line. The frost-free feature and the ice maker also use heaters, these are AC powered and are controlled via single digital lines for on/off control via an isolating photocoupler. The cooling compressor is controlled using a separate controller board. The compressor is a variable speed device and uses three phase pulse width modulation (PWM) to control the compressor's motor speed and torque. Pulse width modulated signals use a fixed clock frequency and vary the width of a pulse based on the modulation input. The three PWM signals, each with two horizontally expanded view, are shown in Figure 9.
The views in the bottom grids show the PWM clock with a period of 50 μs (20 kHz). The period of the PWM cycle is about 27 ms or about 37 Hz. Low pass filtering any of these waveforms with a cutoff below the PWM clock frequency will yield a sinusoidal waveshape. This periodicity determines the rotational speed of the compressor motor, in this case about 1100 RPM. Like all three phase power systems the individual phase waveforms have phase differences of 120 degrees.
PWM controllers have replaced older single-phase, on-off compressors in order to improve refrigerator efficiency, reduce power consumption, and reduce noise.
The power source for the compressor is the rectified line voltage, so measurements of this part of the controller requires attenuators or probes. The digitizer's 1 Mega-Ohm input termination is fully compatible with many probes or attenuators. For this measurement a probe attenuation of 100:1 is required.
The compressor control is a closed loop control system. The temperature sensor is the primary reference, but the motor speed and shaft position are sensed through a tachometer, motor phase currents are sensed using current shunts. These secondary sensors are integrated within the Inverter drive controller.
During circuit development, an arbitrary waveform generator like the M2p.6568-x4 eight channel AWG can be used to replace the temperature sensor, tachometer, and current sense signals for closed loop testing of the loop dynamics. These substitutions can be made singly or simultaneously.
The ice maker is also a closed loop control system, but it operates over a very long cycle duration. At the beginning of the cycle, the Fill control is asserted to fill the ice trays with water. The fill operation is monitored by a timer and stops after about seven seconds. The water is allowed to freeze, and this process is monitored by a temperature sensor. When the ice tray temperature drops to about -13°C, the tray is rotated to drop the ice into a bin. The process begins again. A sense arm sensers when the bin is full and stops the process until space is available. The basic processing cycle takes one to two hours.
Trouble shooting a slow process requires a good deal of digitizer memory. The M2p.5968-x4 offers a total memory of 512 MSamples. Even sampling at 10 kS/s it can capture the 2-hour cycle time using 72 MSamples. This provides a time resolution of 100 μs over the whole two hours cycle.
The example has provided a wide variety of different signal types showing that multiple modular instruments like digitizers, AWGs, and digital I/O cards can be used to test devices like microcontrollers in appliances performing data acquisition, logic state analysis, and signal simulation. These fully synchronized modules form a cost-effective test system for microcontroller development and troubleshooting. They also include a variety of features that can be used to speed up automated testing procedures.
- PDF version of article