Power Cycle Required
When troubleshooting your hardware or software, sometimes a power cycle is all you need. This helps restore your system back to its normal state.
Last updated March 2019
Debugging is a very strategic process. It’s hard to teach and it’s one of those things where you learn with experience. Don’t we all wish we could get our hardware and software to work the first time? Yes, but where’s the fun in that? When something doesn’t work, you become an investigator and try to figure out why it occurred, so it doesn’t happen again.
Software
Writing code is fun, but when it doesn’t work, it can be frustrating. You can spend hours trying to figure out the issue only to find out that your data buffer wasn’t big enough. It can be the simplest things sometimes. Once you do find and correct the mistake, it most likely won’t take you as long to find the issue if it were to arise again. The error messages are usually quite detailed allowing you to quickly fix the issue. Other times, you won’t get an error message when your code doesn’t work.
Let’s say you’re running some code on a microcontroller. When a particular action happens, you trigger an LED (light-emitting diode) to turn on to notify you that that action happened. 5 minutes goes by, 10 minutes, 15 minutes. Still nothing on the LED. What’s happening? Your code is getting hung up somewhere. If you’re polling an input instead of using an interrupt, the code will wait on the input to change before it can execute the next line of code. You can easily power cycle the microcontroller to start the code from the beginning, but if it still gets hung up in the same spot, the input could be the problem.
Hardware
Once you determined that the issue is the hardware, and not the software, you start getting closer to fixing the problem. Maybe we have a limit switch connected to the microcontroller and our code checks when the switch is pressed to perform an action. If the code never sees that the limit switch is pressed, it will keep waiting and waiting. The mechanical switch could not be making contact when it is pressed so you switch it out with a new one, and voila, your code runs smoothly!
Operating System
If you’re trying to debug an issue on your computer, that can be very complex. You hope that the automatic troubleshooting or reinstallation of a driver or software package does the trick. That’s not always the case. The next thing to try is a power cycle which stores your system back to its normal state. This restarts the software, reloads the operating system, clears the cache memory, and resets the resource management.
There could have been a memory leak where one memory cell “leaks” to an adjacent cell and causes that cell’s bit to flip. This can cause a program or file to become corrupt so executing a power cycle can reset it.
Cache is memory that is on the central processing unit (CPU). It is much faster, but more expensive than your solid state or hard disk drive. As a result, there is a very limited amount of cache so it can quickly fill up if it’s not managed correctly. When the cache becomes full, your computer becomes inefficient. For example, when you’re browsing the web, your computer caches each webpage. That way, if you decide to go back to a webpage you already visited, the computer can go to cache to fetch the data instead of sending a request and retrieving the data from the server that the page is hosted from. Like I mentioned, one way to clear the cache, is to power cycle your computer often to avoid overloaded cache.
What did we learn?
- Debugging is often a skill that is learned from experience.
- Try to rule out one or the other with hardware and software. For example, once you determine it’s not a software issue, then you can use techniques used to debug hardware.