Thursday, May 08, 2008

Development Stalled: Microcontrollers are Hard to Debug with PRINT Statements

I've done a fair about of tinkering with my UAV code the past month or two. I currently am able to read in a current GPS position, specify a 'desired' GPS position, and receive back the bearing and distance to the desired point, from my current point. I have programmed in some 'starter' code in order to have the rudder deflect to attempt to correct the aircraft's course using the actual track of my aircraft and comparing it to the desired track.

So far so good, except I have run into an issue testing the code. Since I only have one UART (serial port), and since I need it for GPS data, I haven't been able to 'debug' and test the code using PRINT statements like I'm used to. For a few weeks I dabbled with adding an LCD screen to printout relavant information, but that also proved to be a huge headache as type conversions, GPS errors, etc all started piling up and I never knew which part of the system was hosed. In order to solve this problem, I am going to implement a 'Software Serial' interface in order to do some real debugging and continue.

In addition to the above issues, I have had spotty luck with the accuracy of my onboard calculations. I'm not sure if the GPS is overoading the buffer, or what the issue is at this point, but I assume the answer will fall out when I am able to debug properly again.