cancel
Showing results for 
Search instead for 
Did you mean: 

X-Cube-AI. AI_ERROR_CODE_LOCK during network creation.

GBrug.1
Associate

I'm working on a ML project with X-Cube-AI version 7.3.0 with the STM32F4DISCOVERY board.

I created the neural network with tensorflow, and the analysis went smooth, the network occupies 25 kb of flash and 8 kb of ram.

This is the neural network summary;

Model: "sequential_8"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 conv1d_10 (Conv1D)          (None, 28, 16)            1456      
                                                                 
 batch_normalization_49 (Bat  (None, 28, 16)           48        
 chNormalization)                                                
                                                                 
 conv1d_11 (Conv1D)          (None, 28, 32)            1568      
                                                                 
 max_pooling1d_25 (MaxPoolin  (None, 14, 32)           0         
 g1D)                                                            
                                                                 
 batch_normalization_50 (Bat  (None, 14, 32)           96        
 chNormalization)                                                
                                                                 
 conv1d_12 (Conv1D)          (None, 14, 64)            6208      
                                                                 
 batch_normalization_51 (Bat  (None, 14, 64)           192       
 chNormalization)                                                
                                                                 
 conv1d_13 (Conv1D)          (None, 14, 64)            4160      
                                                                 
 max_pooling1d_26 (MaxPoolin  (None, 7, 64)            0         
 g1D)                                                            
                                                                 
 batch_normalization_52 (Bat  (None, 7, 64)            192       
 chNormalization)                                                
                                                                 
 conv1d_14 (Conv1D)          (None, 7, 14)             910       
                                                                 
 max_pooling1d_27 (MaxPoolin  (None, 3, 14)            0         
 g1D)                                                            
                                                                 
 batch_normalization_53 (Bat  (None, 3, 14)            42        
 chNormalization)                                                
                                                                 
 flatten_8 (Flatten)         (None, 42)                0         
                                                                 
 dense_2 (Dense)             (None, 1)                 43        
                                                                 
 batch_normalization_54 (Bat  (None, 1)                3         
 chNormalization)                                                
                                                                 
 activation_8 (Activation)   (None, 1)                 0         
                                                                 
=================================================================
Total params: 14,918
Trainable params: 14,536
Non-trainable params: 382
_________________________________________________________________

However, at runtime when I call the function ai_network_create I obtain an error of tyoe 51 and code 65 which corresponds to AI_ERROR_CREATE_FAILED and to AI_ERROR_CODE_LOCK respectively.

What this code means? Why it happens?

	ai_handle network;
	ai_error err = ai_network_create(&network, (const ai_buffer*)AI_NETWORK_DATA_CONFIG);
	    if (err.type != AI_ERROR_NONE)
	    {
	        printf("E: AI error in NN creation - type=%d code=%d\r\n", err.type, err.code);
	        // TODO: error handling
	    }
	    else
	    {
	        printf("NN successfully created.\n");
	    }

1 ACCEPTED SOLUTION

Accepted Solutions
jean-michel.d
ST Employee

Hi,

Before to call the ai_network_XX() fcts, the STM32 CRC IP should be enabled. This IP is used to check that the AI library is executed on a STM32 device.

The following HAL code is normally sufficent to enable and to clock the CRC IP.

  __HAL_RCC_CRC_CLK_ENABLE();

br,

JM

View solution in original post

2 REPLIES 2
jean-michel.d
ST Employee

Hi,

Before to call the ai_network_XX() fcts, the STM32 CRC IP should be enabled. This IP is used to check that the AI library is executed on a STM32 device.

The following HAL code is normally sufficent to enable and to clock the CRC IP.

  __HAL_RCC_CRC_CLK_ENABLE();

br,

JM

Thank you! This solved my problem.