Date: 12.21.15 - 4:19pm
Arduino is in it tricky spot, the base hardware is quite good as are the base libraries, but when you start adding new hardware from third-party vendors, and third-party libraries... And then combining them, some weird shit can happen.
Debugging on an embedded platform is tricky in its own right.. So fishing out and identifying these bugs is a not fun task. I'm going to share some that I have found.
• Serial.print seems that it may cause system instability when no PC is hooked up to receive the messages. I found a couple other online posts that mention this, apparently always in conjunction with hardware that is using I2C. in my case I was also using I2C. the program ran fine when plugged into the PC, but had serious bugs when running stand alone off of the power supply. The only thing I could think of were the serial statements. Adding a flag to turn those off fixed the problem.
• The next bug comes when using the Adafruit CC3000 library. The fastrprint function apparently will cause memory corruption and can lock up the Arduino if you send it more than 50+ characters in a single call. Try sending it a 150 byte string and you are guaranteed a lockup. It took me a long long and painful time to find this bug! I never would've suspected it.
• Another bug that I found is when working with the Adafruit tft capacitive touchscreen, in conjunction with the CC3000 wifi breakout. If you use these two together, or probably any other device that uses interrupts with the tft, make sure you do not utilize interrupt pins 20 or 21 on the mega or you will get an instant lockup.
I will update this list as more gotchas show up.