Not enough memory for baseline example code

I just started playing around with this library. I have a SimpleFOCShield v2.0.4 running on an Aruino Uno, 3510 gimble motor with a AS5600 encoder. I’ve been working my way through each of the examples and have made it to single_full_control_example. I slightly mod the base code for my encoder but cannot upload the code. The arduino IDE complains that the sketch uses 103% of the Uno’s storage. Isn’t that strange? I thought the shield was made specifically for the Uno and this example was specifically made for the shield. If I comment out the current sense lines it reduces the memory footprint enough to upload. But would should I do if I want to use current_sense?

Hi @Cylon-Garage , and welcome to SimpleFOC!

I think you are hitting a problem we have with the library: while originally conceived for Arduino UNO, the library has grown to support more functionality and more and more MCU types.
The Arduino UNO, with its 8 bit ATmega is really quite limited, and truthfully not the ideal MCU for motor control. Especially if you want current sensing, commander input, closed loop control, and everything in one program, it will be a big challenge to fit it into the UNO both in terms of memory and in terms of performance.

So while you can certainly hack up the code bit (esp. removing debug statements, etc) to make it fit, and then see how it goes performance-wise, my recommendation would really be to choose a more powerful MCU from the outset.

Dude thanks for the quick reply and explanation. I had a MKR1000 laying around and I was able to use this great post How connect ESP32 to the v2.0.4 Shield to get that running. Although there are some strange quarks with the MKR1000. I have some raspberry picos coming tomorrow and I’ll try to switch over to those when they get here.

1 Like