cancel
Showing results for 
Search instead for 
Did you mean: 

Inference Blocking on LL_ATON_OSAL_WFE() with ThreadX

Foahh
Associate II
Hello,
 
I am working on implementing an object detection application for the STM32N6570-DK, starting from the reference projects:
 
I'm encountering a blocking issue when implementing the inference pipeline:
 
During debugging, I found that the inference execution blocks indefinitely at LL_ATON_OSAL_WFE() on line 105 of Appli\App\Src\app_nn.c. The code is stuck in the following loop:
static void NN_RunInference(void) {
  LL_ATON_RT_RetValues_t ret;

  do {
    ret = LL_ATON_RT_RunEpochBlock(&NN_Instance_od_yolo_x_person);

    if (ret == LL_ATON_RT_WFE) {
      LL_ATON_OSAL_WFE();  // <-- Blocks here
    }
  } while (ret != LL_ATON_RT_DONE);

  LL_ATON_RT_Reset_Network(&NN_Instance_od_yolo_x_person);
}
 
I've reviewed similar posts in the community
, but it didn't resolve my issue.
 
Questions:
What could be the issue that blocks inference indefinitely at `LL_ATON_OSAL_WFE()`, and how to fix it?
 
Source Code:
My current implementation is available at: https://github.com/Foahh/stm32n6-ai-camera.git
1 ACCEPTED SOLUTION

Accepted Solutions
Foahh
Associate II

The problem fixed by adding the code below.

void HAL_CACHEAXI_MspInit(CACHEAXI_HandleTypeDef *hcacheaxi)
{
  __HAL_RCC_CACHEAXIRAM_MEM_CLK_ENABLE();
  __HAL_RCC_CACHEAXI_CLK_ENABLE();
  __HAL_RCC_CACHEAXI_FORCE_RESET();
  __HAL_RCC_CACHEAXI_RELEASE_RESET();
}

void HAL_CACHEAXI_MspDeInit(CACHEAXI_HandleTypeDef *hcacheaxi)
{
  __HAL_RCC_CACHEAXIRAM_MEM_CLK_DISABLE();
  __HAL_RCC_CACHEAXI_CLK_DISABLE();
  __HAL_RCC_CACHEAXI_FORCE_RESET();
}

I compared it with other projects, and it looks like I forgot to implement something for enabling the CACHEXI.

I found npu_cache_init() calls HAL_CACHEAXI_Init() and the latter one internally calls HAL_CACHEAXI_MspInit(),

but HAL_CACHEAXI_MspInit() is not implemented in my code.

View solution in original post

3 REPLIES 3
Foahh
Associate II

Update: I initially used STEdgeAI 3.0. I later switched to STEdgeAI 2.2, but the issue persisted.

Foahh
Associate II
 .text.NPU0_IRQHandler
                0x340322d8      0x124 CMakeFiles/Firmware_Appli.dir/.../ll_aton/ll_aton_runtime.c.obj
                0x340322d8                NPU0_IRQHandler

The furthest I’ve been able to debug is that NPU0_IRQHandler (expanded by ATON_STD_IRQHandler macro in ll_aton_runtime.c) never fires.

Foahh
Associate II

The problem fixed by adding the code below.

void HAL_CACHEAXI_MspInit(CACHEAXI_HandleTypeDef *hcacheaxi)
{
  __HAL_RCC_CACHEAXIRAM_MEM_CLK_ENABLE();
  __HAL_RCC_CACHEAXI_CLK_ENABLE();
  __HAL_RCC_CACHEAXI_FORCE_RESET();
  __HAL_RCC_CACHEAXI_RELEASE_RESET();
}

void HAL_CACHEAXI_MspDeInit(CACHEAXI_HandleTypeDef *hcacheaxi)
{
  __HAL_RCC_CACHEAXIRAM_MEM_CLK_DISABLE();
  __HAL_RCC_CACHEAXI_CLK_DISABLE();
  __HAL_RCC_CACHEAXI_FORCE_RESET();
}

I compared it with other projects, and it looks like I forgot to implement something for enabling the CACHEXI.

I found npu_cache_init() calls HAL_CACHEAXI_Init() and the latter one internally calls HAL_CACHEAXI_MspInit(),

but HAL_CACHEAXI_MspInit() is not implemented in my code.