Memory Issues on the Arduino Uno

As we are nearing the competition, I wanted test the algorithms on a bigger maze. The test maze that we have in the lab is 6×3. This maze is good for doing small tests but it is a far cry from the stress tests that I wanted to perform on the navigational algorithm. As I changed the array to be a 16×16 array I noticed that the SRAM memory usage was at 150%. Uh oh. Turns out that the data type “int” is assumed to be a 2 byte unsigned integer on the AVR architecture. By using the data types defined by inttypes.h I was able to reduce the memory usage by 50% primarily by using uint8_t and int8_t when I only needed a unsigned or signed 1 byte integer (See commits 90e3d13fbe, 422791a8ba, 2f2773a4e4 and bd9412e1fa). This still means that we are at 100% memory usage. We might be able to get away with it but certain mazes might cause a collision of the heap and the stack. So we put in an order for a Arduino Mega 2560 R3 which has 8k of SRAM. That way we don’t take any chances.

Leave a comment

Your email address will not be published. Required fields are marked *

One thought on “Memory Issues on the Arduino Uno”