2025-07-07 1:08 PM - edited 2025-07-07 1:09 PM
Hi,
I'm working on a NUCLEO-N657X0-Q board with all the newest software releases. The model I've uploaded stalls on one epoch forever while debugging or running the app. I'm trying to debug the following generated inference loop (in app_x-cube-ai.c file) of the X-Cube-AI application generated with CubeMX for a TFLite model quantized to int_8 (also attempted with ONNX-converted model):
void MX_X_CUBE_AI_Process(void)
{
/* USER CODE BEGIN 6 */
LL_ATON_RT_RetValues_t ll_aton_rt_ret = LL_ATON_RT_DONE;
const LL_Buffer_InfoTypeDef * ibuffersInfos = NN_Interface_Default.input_buffers_info();
const LL_Buffer_InfoTypeDef * obuffersInfos = NN_Interface_Default.output_buffers_info();
buffer_in = (uint8_t *)LL_Buffer_addr_start(&ibuffersInfos[0]);
buffer_out = (uint8_t *)LL_Buffer_addr_start(&obuffersInfos[0]);
LL_ATON_RT_RuntimeInit();
// run 10 inferences
for (int inferenceNb = 0; inferenceNb<10; ++inferenceNb) {
/* ------------- */
/* - Inference - */
/* ------------- */
/* Pre-process and fill the input buffer */
//_pre_process(buffer_in);
/* Perform the inference */
LL_ATON_RT_Init_Network(&NN_Instance_Default); // Initialize passed network instance object
do {
/* Execute first/next step */
ll_aton_rt_ret = LL_ATON_RT_RunEpochBlock(&NN_Instance_Default);
/* Wait for next event */
if (ll_aton_rt_ret == LL_ATON_RT_WFE) {
LL_ATON_OSAL_WFE();
}
} while (ll_aton_rt_ret != LL_ATON_RT_DONE);
/* Post-process the output buffer */
/* Invalidate the associated CPU cache region if requested */
//_post_process(buffer_out);
LL_ATON_RT_DeInit_Network(&NN_Instance_Default);
/* -------------------- */
/* - End of Inference - */
/* -------------------- */
}
LL_ATON_RT_RuntimeDeInit();
/* USER CODE END 6 */
}
The inference loop is stalling on line 26 above, where ll_aton_rt_ret never equals LL_ATON_RT_DONE to indicate the model is done with inference. When I debugged the function LL_ATON_RT_RunEpochBlock, I found that after epoch 3, the following line is never true, stopping the model from progressing any further and continuously looping back:
if ((nn_instance->exec_state.triggered_events & _wait_mask) == _wait_mask)
I'm guessing the problem is with LL_ATON_OSAL_WFE() which is supposed to wait until the layer is finished with a step.
I haven't changed any code at all yet in this application (changed several other drafts to try and get past this). I'm very confused on why I can't get the application to work since the model runs well when I use 'Validate on Desktop' and 'Validate on Target' options in CubeMX. Any help would be greatly appreciated.