I’ve always been fascinated by microcontroller systems and the process of making them come to life.
It all starts by designing the system, a controller with some peripheral hardware. Once I finally have a prototype of my design the first thing I do is to see if I can talk to the processor. This is always an exciting moment. Will it respond? Will it program?
I prepare a small hello-world type of program and try to load it into the controller (or in its external memory, depending on what I am working on). Suppose all went well and the controller accepted the program (what a deception if it didn’t). Usually the hello-world program is flawed and doesn’t work as intended. Maybe I was too brave and tried to put too much in it, maybe I didn’t understand some functionality? I modify the program and try again, but still nothing. So I hook up the oscilloscope and start probing around. Aha! found a signal, but on the wrong pin. Back to the code, locate the bug this time and now the hello-world program works. Great! Little by little I start adding functions to the code, first to test the peripherals and then to get fancy. And then suddenly it all stops working…
Oops. Now what exactly did I change the last time? Ehmm…
So I start taking bits of code out, but that doesn’t help. I remove more, change this and that, decide that some parts could be coded more elegantly and I end up spending many hours coding without much success.
And then, as suddenly as it stopped working, the program starts working again. Hallelujah! From this moment on, I know from experience, it will never stop working again. No matter what I do, the program will run. There will be a bug every once in a while, but I know I will fix it quickly and I just can’t seem to mess it up anymore. My baby is alive! I master the system without really knowing what went wrong, where and why. Now my prototype can and will grow into a fully functional system.
Fascinating, isn’t it? No? Oh well, I guess you had to be there.
So what’s the point? Well, the fact that I spend many hours fiddling around trying to figure out what and why made me into an expert. The experience gained from debugging and rewriting code helped me understand my system. Since this has happened often to me, I now know that I have to go through this phase to be able to finish the job.
So don’t despair when you can’t find out why your system doesn’t work. Keep patient. You will get there if you are willing to spend the time to learn your system. Once you are the expert, your system will listen to you and obey.
Do you recognise any of this? Let me know how you work, how do you learn your system? Please share your experiences.