[Bug Report] X-Cube AI stucks on initialization when CRC peripheral is off.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-14 3:47 AM - last edited on ‎2024-07-24 3:23 AM by Amel NASRI
X-Cube AI initialization stucks on ai_network_create() when CRC peripheral is off. I noticed this problem when i tried to use X-Cube AI library inside a C++ class and called ai_network_create() inside a constructor. Class constructor was called before main(), so CRC peripheral was not initialized at that time.
I propose to change ai_network_create() to return an error when CRC fails or is off, instead of stucking in an infinite loop.
- Labels:
-
STM32CubeAI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-14 4:48 AM
Dear @TAdam.1​ ,
This is normal CRC is required to support the NN library run-time protected mechanism and CRC activation was mentioned in UM2526 (Getting started with X-CUBE-AI Expansion Package for Artificial Intelligence (AI)) / section 3.2.3 CRC .
STM32
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-14 4:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-14 5:16 AM
Dear @TAdam.1​ ,
So this is not a bug (as per the title) since the CRC activation is mandatory and the information was provided in the Cube AI document ;).
But you are talking about a "change request" of the implementation of ai_network_create() to return an error when CRC.
I will ask internally to study this change, if it will be taken I will inform you.
Thank you.
STM32
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-14 5:36 AM
Enable the peripheral clock in SystemInit() which should execute prior to constructors. ​
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-14 5:42 AM
It is aslo an option, but I've already moved initialization to separate function ran after main(), and it solved the problem. I write this post to warn users and to encourage ST developers to improve the library, so it would return an error instead of freezing the whole system.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-14 5:47 AM
Dear sir,
When a function encounters an incorrect hardware configuration and it freezes the application instead of returning an error, I consider this a bug. Whether you consider it a bug or not is none of my concern. I am glad that this problem has been noticed and I am happy for your quick response.
Thank you for your help.
Tomasz Admaczyk-Koreywo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-14 8:26 AM
Just saying it's the CMSIS architected way to get pre-init stuff in order, like enabling the FPU, external memories, etc that need to be viable to unpack and initialize the statics, and call the constructors.
The initialization of things in main() which the HAL and CubeMX promote is the "worst practices" methodology.
Having stuff locked to STM32 hardware via the CRC Peripheral is also a bit pointless/petty in my opinion,
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-03 8:27 AM
Dear,
With the latest release v7, now if the CRC is not clocked before to call the ai_network_create function, the following ai_error is returned:
.type =AI_ERROR_CREATE_FAILED, .code=AI_ERROR_CODE_NETWORK
Not that for the other functions (ai_networl_***), previous behavior is conserved, the application hangs.
br,
Jean-Michel
