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.
You may also like
I recently started working on a project for work where they use Microsoft Severs. After some consideration I decided to used the […]
One of the downsides of graduation college is that I no longer have access to the circuits/robotics lab. So I decided to […]
Currently started a new project for the year. I figured switching jobs and living situations wasn’t enough for me, so I started […]
In my last post I showed a controller action which contained a lot of boilerplate code. When the action of a controller […]
One thought on “Memory Issues on the Arduino Uno”