I'm running into a really strange problem with an Arduino Due. I have a rather large program (116,340 bytes program space) with about 15k of static data (bytes written to flash are 131664). If the Due has been disconnected for a while, when I try to upload the program, it uploads fine, but then it never starts.
I can upload repeatedly, and it still won't start. But if I remove a chunk of the static data, then upload, it works... And then if I re-add the same data and upload, it works fine. And from that point on, I can upload repeatedly and everything works fine. But if I disconnect the power, let it sit for a bit (30 seconds, maybe--I haven't tried shorter), and then reconnect it, the same problem happens again, even if I try to upload the exact same program.
At runtime, I still have around 70-80k of SRAM available. So while this problem seems related to the size of the program + data, it doesn't look like an out of memory issue.
I'm plugging the Due into my computer (Windows) using the USB Programming port. I'm currently running the Arduino IDE, v 1.5.5, but the same thing happens with 1.5.6-r2.
I have a variety of libraries I'm using:
- Adafruit_9DOF
- Adafruit_L3GD20_U
- Adafruit_LSM303DLHC
- Adafruit_NeoPixel
- Adafruit_Sensor
- libfixmath
- libfixmatrix
- RGBmatrixPanelDue
I have several spin-offs of this project (same libraries, similar code, similar data), and they all work fine, but this is the largest one, in terms of program + data size. It's gotten to the point where I just added a redundant block of data that I can remove and re-add when I want to start programming, to work around this problem.
If anyone has any ideas what might be wrong or what further investigation I can do, I'd really appreciate it.