AVR – common problems and mistakes
Archived post from 2010, recovered from my old blog. The technology described here is probably out of date. Original at the Internet Archive.
A bunch of tips I’ve learned after dozens of hours spent on debugging AVR programs:
- make sure to provide a correct and stable power supply to a microcontroller
- make sure F_CPU variable matches your crystal oscillator frequency (otherwise UART communication may be broken for example)
- all variables used both by ISR and a regular code must be defined as volatile
- disable JTAG interface (JTAGEN fuse) if you’re using its pins for other purposes
- makes sure to program fuses properly – especially CKOPT, BOOTSZx, CKSELx – this online fuse calculator may help
You may also find this post useful.