Lachlan Smith

Debugging

The code on your micromouse will be of a fair length, and will need a fair amount of testing. You will also want to start the code development process before you have the mouse built in order to maximise the amount of time for tuning the mouse' behaviour.

The key to successful software is cold hard numbers. Yes, set in stone key numbers in your design early, such as where you have placed the sensors. Changing the sensor placement changes the entire approach to the software and should not be done lightly. Change is the biggest enemy to good software.

Good firmware starts with computer simulation. Simulate key algorithms using a language similar to that you will be deploying in. For example, if you are using AVR-gcc, develop the computer simulation using lcc. This will increase the portability of your code saving valuable development time. By first simulating on the computer, you can use computer debugging tools that are not available for embedded systems. This is particularly important for larger algorithms such as the maze search algorithm.

Another key piece of software for computer simulation is MATLAB Simulink. This allows you to build a controller, and to simulate it. Spend a lot of time examining all the signals and working out where overflow may occur. This will lead you to developing more efficient software.

On chip debugging is usually done using the industry standard JTAG. Unfortunately JTAG interfaces are generally costly. However most Mega AVRs have a USART port for standard RS232 serial communication with a PC through hyperterminal. An RS232 interface only requires 4 wires (much like USB) and has longer communications ranges and better able to cope with line noise. No special cabling is required, this proved successful for several teams using standard multi core wire over distances of up to 10m. Solid core wire was also successfully used, however I do not recommend using solid core wire for the first part of the link. Solid core wire is also more likely to fail, so use multi core in this scenario. (Of course if you run out of multi core wire then you may just have to bow to the evils of solid core).

Remember, you will make mistakes while developing the software for your micromouse, and without adequate debug tools you will waste a lot of your time trying things without truly knowing the cause.


Last Modified: June 30, 2013 with 3 page views.