I'm attempting to build a fairly simple data logger with a teensy 3.0. It polls an i2c gyro, magnetometer and accelerometer several times a second, and stores the x/y/z values as int16_t for all 3 sensors in an array in ram (with each entry = 3*3*2 = 18 bytes). I have a for-loop that polls the sensors and writes to an incrementing address in my array. For some reason, I am reliably seeing the program lock up after it writes to index 308 in the array.
I used the code from here: http://forum.pjrc.com/threads/23256-Get-Free-Memory-for-Teensy-3-0 to find the free SRAM while I'm running, and it's showing 6756 bytes, which should be plenty (if I make my array 308 entries, it works fine. If I make it anything greater than 308, it locks up). Here is the output at compile time:
Binary sketch size: 16,544 bytes (of a 131,072 byte maximum)
Estimated memory use: 9,248 bytes (of a 16,384 byte maximum)
How much free ram are we supposed to leave? Does anyone have any further suggestions for debugging? I should be able to get 500-600 total samples, given the free RAM I currently have.
I used the code from here: http://forum.pjrc.com/threads/23256-Get-Free-Memory-for-Teensy-3-0 to find the free SRAM while I'm running, and it's showing 6756 bytes, which should be plenty (if I make my array 308 entries, it works fine. If I make it anything greater than 308, it locks up). Here is the output at compile time:
Binary sketch size: 16,544 bytes (of a 131,072 byte maximum)
Estimated memory use: 9,248 bytes (of a 16,384 byte maximum)
How much free ram are we supposed to leave? Does anyone have any further suggestions for debugging? I should be able to get 500-600 total samples, given the free RAM I currently have.