Hi, I new to this project. I purchased the SimpleFOCShield for the Arduino UNO but the library doesn’t seam to support it. When I compile it I get the following:
Error: The program size (34626 bytes) is greater than maximum allowed (32256 bytes)
I’m using PlatformIO and my ini file looks like this:
Adding anything involving Serial library (including using simpleFOC Commander) increase the flash size considerably. You are running out of space in the flash as indicated by your error. You can try adding this to your build flags in platformio.ini:
Thank you for your reply. Adding the build_flags didn’t reduce the flash size. It seams to be compiling all of the hardware_specific files in, which maybe bloating the image. I created my own version of the SimpleFOC.h file and removed some includes but it didn’t reduce the image size.
Seams like this hasn’t been an issue for anyone else and that the Uno is supported. I’m just using the generic examples supplied with the library. What am I doing wrong?
It’s only hear-say, but I’ve read that newer versions of simpleFOC lib have grown too big for UNO when the code included serial interface.
They were OK as a starting platform, but now the drift goes towards 32bit MCU’s like STM32 or SAMD.
If you are already using wire or SPI protocol for sensor stuff, better use the commander_I2C version or go for an arduino Due or Nucleo.
It should be make more clear and more prominent exactly which MCU board is a reasonable choice. The g431 nucleo one is a good choice, imo. Except IDK if you can use them in an end product, which is a serious issue. People are under the impression that the UNO is reasonable compatible and useful, but even if you can get it working it has very limited capabilities.
I didn’t realize the UNO only has 32k- this really is very small. Even most people here are struggling with fitting simpleFOC on 64k boards. I don’t know how much flash the new UNO R4 has (edit: 256k!)- that might be a good choice if you don’t want to go for a NUCLEO board or one of the ESP dev kits with the UNO footprint.
Thank you for the great information. I had purchased the board a while back and thought I’d try it out as a simple baseline for learning the SimpleFOC library. I was intending on deploying in on the ESP32, as that’s my normal microprocessor of choice. It deploys there with no problems. I’ve been diving more into the library code and am very excited to use it in my future projects.
Yes, but also keep in mind that 8bit code is more compact than 32bit code… so with some care SimpleFOC still can run on an UNO.
If you use the dev branch code, we’ve made the LUT for the sine/cosine functions smaller by around 300bytes. Perhaps it’s enough. Generally it can be made to fit if you set ArduinoIDE to use the nano libs, -Osmall and not use any of the Commander code.
It looks like the new UNO R4 boards will run very well with SimpleFOC. But at the moment you would have to use the dev branch code, and I have not yet implemented current sensing for these MCUs.
Now there is also a new Arduino Nano ESP32 - maybe a nice combo of Arduino and Espressif?
Its on its way to me at the moment, but I expect SimpleFOC will run there no problems, since its a standard ESP32 S3 as the MCU on this board, which we support.
Glad to hear it! And we would be very interested to hear about your projects here in the forum if you feel like sharing them