title: Arduino/AVR ATmega microcontroller, random resets, jumps or variable/data corruption
body: <p>I thought many programmers of Arduino/AVRs MCUs could share some of knowledge.  </p>
  
  <p><strong>My specific problem was this:</strong><br>
  In my case on an Atmel Atmega128 AVR.<br>
  Based on ADC data I was running a loop which was doing some calculations into serial console, also it drove an interrupt.  </p>
  
  <p>What happened was that when I did use a certain amount of serial output the program suddenly became highly unstable.<br>
  Random jumps within the code, random unknown interrupts, random variable corruption, random resets without MCU register bits set.<br>
  Adding a buffer at a specific point solved the instability.<br>
  Changing optimization parameters of gcc also changed the behaviour, without optimization the code was quite stable.    </p>
  
  <p>Check my answer for possibly reasons and the real cause.</p>