Skip to main content
jonathanmeyer
Associate II
February 1, 2024
Question

HardFault error in ai_platform_network_process()

  • February 1, 2024
  • 12 replies
  • 4721 views

Hello, 

I have implemented https://wiki.st.com/stm32mcu/wiki/AI:How_to_perform_motion_sensing_on_STM32L4_IoTnode this project. When I run the program I had a hard fault error when function enters  ai_platform_network_process().  I have incremented the heap and stack sizes. I don't know what else I can do to run properly. As below, after ai_network_run() it enters ai_platform_network_process(). This function is source coded and cannot see the content of this function. 

If you can help me, I will be very grateful...

Regards.

 

static void AI_Run(float *pIn, float *pOut)

{

ai_i32 batch;

ai_error err;

 

/* Update IO handlers with the data payload */

ai_input[0].data = AI_HANDLE_PTR(pIn);

ai_output[0].data = AI_HANDLE_PTR(pOut);

 

batch = ai_network_run(network, ai_input, ai_output);

if (batch != 1) {

err = ai_network_get_error(network);

printf("AI ai_network_run error - type=%d code=%d\r\n", err.type, err.code);

Error_Handler();

}

}

 

12 replies

Laurent
ST Employee
February 1, 2024

Hello Jonathan 

Can you check you call  MX_CRC_Init function before access to AI librarie ?

best regards 

L

jonathanmeyer
Associate II
February 1, 2024

I'm sorry but, I couldn't understand what you say. Should i look into that function when debugging or ? 

Laurent
ST Employee
February 1, 2024

I meant that you should check that the function "MX_CRC_Init ()" is called somewhere in your code before making use of AI librarie , you can do that by breaking into the function an chcek that the function "__HAL__HAL_RCC_CRC_CLK_ENABLE();" this CRC IP is needed to be enabled before calling the AI Librarie (ai_network_run)

   

jonathanmeyer
Associate II
February 1, 2024

It is enabled there is no problem about that.

Laurent
ST Employee
February 1, 2024

Which version of X-CUBE-Are you using ?  and which network are you trying, the pretrained one given in the wiki ? 

jonathanmeyer
Associate II
February 1, 2024

Yep, the trained one and also the latest version of X-Cube AI 8.1.0

Laurent
ST Employee
February 1, 2024

may be you can try the version as recommended (and tested) by the wiki that is 7.2  

jonathanmeyer
Associate II
February 1, 2024

jonathanmeyer_0-1706795455761.png

Had an error when i downgraded the version to 7.2.0

Laurent
ST Employee
February 1, 2024

this is strange, 

I just checked on my side:

Screenshot 2024-02-01 151019.png

with model freshly downloaded from link given by wiki, and installed 7.2 version of X-CUBE_AI 

as you can see analyze is passing . 

I am using cube-mx 6.12

jonathanmeyer
Associate II
February 1, 2024

Could I change x-cube-ai version from https://stm32ai-cs.st.com/home this site. It is defined 8.1 and couldn't find anything to change.

Laurent
ST Employee
February 1, 2024

As it seems you could select one of the three versions :

Laurent_0-1706797639609.png

but not 7.2.0 , so you should try with cube mx local installation. to reach version 7.2.0 (to be aligned with wiki )

fauvarque.daniel
ST Employee
February 1, 2024

You need to be sure that the network runtime library (under Middlewares/ST/AI/lib) is at the same version as the generated network.c

For example if you have generated the network.c using the STM32CubeAI dev cloud, you need to update the library in your project too and the set of include files.

Regards

Daniel

jonathanmeyer
Associate II
February 1, 2024

Didn't work still cannot analyze with 7.2 version of X-Cube-AI.