ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

From my experience most crashes on the atmega are memory related. Most often you simply run out of stack and start corrupting your heap (i.e. globally defined variables). This can be pretty devious and hard to debug, as the program running might not behave weird until some time later.

A simple and very effective debugging help is measuring the stack size. You should always keep a healthy amount of stack free for use (at least 1 byte ;). There is code on the Internets that can help you measure the stack size at runtime. In my last project I used this piece of code: (caveat: the site in German, however the code has English comments): http://www.rn-wissen.de/index.php/Speicherverbrauch_bestimmen_mit_avr-gcc

cheers Dariush