Verifying serial buses and components in embedded designsEmbedded systems typically involve a number of serial communications links running between microcontrollers, peripheral chips and the outside world. Before working firmware is completed, designers often need to confirm that a peripheral chip is working as expected. One efficient way to do this is by correlating inputs or outputs with serial bus data being sent between the chip in question and a microcontroller
But verifying that serial buses are in fact working and sending the correct data can be difficult with a simple four-channel digital oscilloscope alone. For applications such as this, it’s vital to have the ability look at both the analog and digital representations of the signal at the same time. This article describes three application examples where signals on peripheral chips were correlated with serial bus data to verify system operation using a mixed signal oscilloscope.
With traditional test and measurement tools it can be difficult to trigger on the event that the engineer is looking for. It can be nearly impossible to tell what information is present by just looking at the analog signal, and it is an extremely time-consuming and error-prone process to have to manually decode bus activity. Mixed signal oscilloscopes equipped with the appropriate triggering and analysis tools offer the necessary decode and search capabilities to verify system operation or to support debug and deeper analysis.
Serial communications controlling a battery charger
The charging of lithium ion batteries is critical. For instance, overcharging can result in damage to the battery and even fire. Lithium ion batteries have protection electronics embedded in the battery pack to monitor cell voltages and temperature as well as current and state of charge. Some versions of the protection electronics provide a means of communicating to the charger or the load to allow access to the information.
Knowledge of battery temperature and individual cell voltages can help prevent over charging or other unsafe conditions. The same information can be used by the load device to indicate to the user when the battery is nearing the point of failure. The most common communications scheme used for this is SMBus, which uses the I2C protocol.
In this example, the charger periodically interrogates the battery temperature (and the cell voltages as well) using the I2C bus. The challenge is to determine the response of the battery protection electronics and the charger to a new analog temperature input. The charger was specially designed to adjust the charge current to prevent damage to the battery if the battery temperature is below a threshold. To determine if the unit is working properly, the following points should be evaluated:
* Time from a change in temperature to when the data is available via the I2C bus
* Time from when the data is available to when the current starts to adjust
* Time and stability of the current adjustment
* Actual current values before and after the adjustment
Figure 1 below shows the operation of the charger over a period of four seconds to show the response to a temperature change. Information captured included the following:
* The top trace labeled TEMPERATURE shows the sampled analog temperature reading at the battery. The next two analog traces labeled SWITCH_V and “SWITCH_I show the power transistor’s voltage and current respectively, which provide the pulse width modulated control of the charge current.
* The decoded I2C communications bus is monitored by two digital lines labeled DATA and CLOCK shown at the bottom of the screen. The decoded data from the I2C bus labeled I2C is displayed below the current trace.
* The digital signal to the gate of the power transistor marked DRIVE is also captured to allow confirmation of the power control operation.
* In addition, a digital signal marked UPDATE is programmed into the microcontroller to mark when the charger makes a current control correction so that the system response can be measured.
Click on image to enlarge.
Figure 1. Operation of a charger over a period of four seconds.