I was trying to find a bug the other day and I thought that it was a good idea to write a few words about it. The bug looks like this: Every time that I’m trying to run a predefined set of AT commands the systems freezes always at a specific location. It happens that this location is the first that responds back with two replies at ones (plus \r\n at the beginning and end of every reply).
My first thought was that the bug exists at my firmware and somehow can’t recognize this double response. Something like a wrong initialization of a variable or even worst a wrong interpretation of the overall architecture for the AT recognition by the microcontroller.
But the verdict was different! It seems that the “bug” was totally hardware oriented! A weak power supply circuit unable to source the high demand for current! Of course, the problem was invisible for commonly used AT commands that demand low currents. That’s why at the beginning I had an interrupted system.
So, in order to investigate even furtherer I decided to run a simple experiment! I am not going to use the “faulty” supply as it was made in a breadboard and it is already dissembled. Instead I will try to profile a few different sources.
The seen consists of the previously used hardware that runs the same code from point A to point B for a fixed period of time (a little lower than 3 minutes). During this time a variety of “power hungry” AT commands are executed (like GSM connect, GPRS activation, Neighbor network survey, Socket activation etc). At the power pins of the module I’ve connect my Tektronix TDS2024B oscilloscope. The time base is set to 2.50ns/Div and 1V/Div at the Y-axis. The persist function (at the display menu) is set to infinite and the acquire mode to spike detect. At the beginning of every run I am resetting the contents of the oscilloscope screen and at the end I am taking a snapshot of the screen to a USB stick. And here we go…
First, we have the best power source (picture above). This is the Li-Ion battery and it is not something that should create wonders. A battery can source huge amount of currents quiet rapidly. In other words a system that is powered directly from a battery can handle power spikes better that the same system powered by a fixed power supply. At least this is the general rule for common systems and not the case in specially designed power circuits with dedicated components, topologies and PCB tracks/planes for output stability in fast load variations. As you can see from the oscilloscope snapshot the voltage isn’t falling below 3.6V. This is above the lowest operating voltage levels of the GSM/GPRS module with a fair bit of threshold. In top of that, the graphs are close together indicating a smaller variation at the powers supply voltage of the module
Buck Converter – 9V @ 3A input
Buck Converter – 9V @ 1.5A input
Following the battery, the next source is a small buck converter circuit that I’ve designed based on an IC from Linear. The converter is capable of sourcing 2.5A. At the first picture the input of this converter is 9V @ 3A and at the second one is 9V @ 1.5A. In both of those photos we have almost minimal differences. The minimum voltage of the second one is at 4.04V compared to the 4.08V of the first one, as it captured by the oscilloscope. The interesting result is that the graphs are almost painting yellow the entire output voltage span!
Bench Power Supply @ 3A
Next, we have a bench power supply set to around the same voltage as the battery (4V) and limited to 3A max. It seems somehow that even this high output current is not good enough to sustain a clean output graph. The lowest voltage value is not creating any problem as it is well above the lowest operating voltage of the GSM/GPRS module. Most of the graphs are at the topside and just a few passes are at the lowest values.
Apple Cinema Display USB port
Next in the test line, the power is sourced from one of the three USB 2.0 ports of an Apple Cinema Display. I am not quite sure (as it is not specified at the monitor specs) but resulting from the graphs the USB ports must be high-current ones (around 1.5A) for fast device charging. The oscilloscope snapshot is the one above and even now the system is working perfectly. This doesn’t mean that we shouldn’t pay attention to the details. Even now that the voltage is still good enough the safety threshold is decreased and we should take actions
Bench Power Supply @ 1.5A
And finally the snapshot above created from the previous bench power supply with the difference that now is limited to just 1.5A output current. Probably this is the worst power source of the ones capable to power my system.
Of course the final circuit will include a specially designed power source.