2024-01-10 05:16 PM
I've been working on a project that involves classifying accelerometer data for activity detection. I have some python code that generates a trained model in both keras and tflite formats.
Initially I was developing with a NUCLEO-G070RB board. With that board I can open up the .ioc file, select X-CUBE-AI Core as well as the application for validation.
With this I can add a network with my .tflite model. Upon saving the .ioc file and selecting yes to generating code, I get a main that calls MX_X_CUBE_AI_Init(); at startup and in the while loop it calls MX_X_CUBE_AI_Process();
When i try the same process with a project created for the NUCLEO-F302R8 or a project created for a custom board with a STM32F302K8 and go through the same steps I run in to some problems.
The first problem I run in to is that it says i don't have enough Flash or Ram. It's weird because it reports needing 4.37KiB of RAM and 35.85KiB of flash and this board has 64K flash and 16K RAM. Well ok maybe the flash is used up for other stuff in the validation application template so maybe its not so weird.
Since this one has a floating point unit i tried with the Keras not quantized model. With medium compression It seems happy about the flash requirement and the Analyze step completes successfully. Next I close the .ioc file. It asks me if I want to save it and i select yes. There is no popup about generating code and my main is left with the default stuff with no calls to the MX_X_CUBE_AI functions. Right clicking on the .ioc file shows the generate code option is grayed out.
Any advice about how i might be able to get this code generation to work on this hardware would be greatly appreciated.
2024-01-11 02:55 AM
Hello @marchold and welcome to the community,
I will look into this issue and get back to you as soon as possible.
Thanks,
Rim.
2024-01-11 07:55 AM - edited 2024-01-11 07:56 AM
Hello @marchold ,
I have tried to reproduce the problem but code generation works successfully for X-CUBE-AI for validation template Application with stm32CubeIDE 1.14.0 , stm32CubeMX 6.10.0 and the MCU STM32F302K8.
Could you please specify which CubeIDE and CubeMX you are using for this project.
2024-01-11 02:27 PM
When I wrote the question I was on IDE version 1.13 under Mac OS Ventura. Since it worked for you I assumed it must have had something to do with my version or something with my computer setup, so I tried on a windows 10 PC and installed a fresh copy of 1.14.0. I ran in to the same problem. Here are my repro steps:
I eventually did find a workaround. If I re-open the .ioc file the Generate Code under the project menu will not be greyed out and i can select it. This sort of unlocks the .ioc code generation and I am able to make changes to it and get the popup about generating code again.
Its the same on my mac.
I think that somehow when i went through the process for the NUCLEO-G070RB I did not trigger the bug because my repro steps were slightly different. I think if i follow the exact same steps for but use this board it will reproduce the same way. So it seems to have something to do with the order I do things instead of having anything to do with the STM32F302K8.
2024-06-02 04:28 AM - edited 2024-06-02 04:33 AM
I have the exact same issue as @marchold, also using a .tflite model in Cube.AI. His workaround also works for me. I just updated my IDE to the newest version, so the bug still persists.
I am glad I found his answer, otherwise I would have given up, since not being able to generate code from the .ioc file makes all further development impossible.