cancel
Showing results for 
Search instead for 
Did you mean: 

STM32N657 XIP + STM32CubeAI Studio – aiRun() stuck in LL_ATON_RT_WFE loop

ayaaaa
Associate II

 

Hello,

I’m working on a project generated by STM32Cube AI Studio targeting the NUCLEO-N657X0-Q, using an XIP configuration with external XSPI flash ( It was said in another post that the generated projects from STM cube AI Studio follow XIP configuration).


Setup

  • Board: STM32N657X0-Q
  • Toolchain: STM32CubeIDE(2.1.1) + STM32CubeProgrammer(2.22.0)
  • Project generated with STM32Cube AI Studio
  • Execution mode: XIP (application in external flash)
  • Runtime: Bare metal (LL_ATON_OSAL_BARE_METAL)

Memory mapping

Model location (from generated network.c):

.addr_base = (unsigned char *)(0x71000000UL)

Programming steps

I programmed manually using STM32CubeProgrammer:

  • second_Appli.elf 
  • network_atonbuf.xSPI2.bin → placed at 0x71000000

Debug configuration (FSBL project)

I start debugging from the FSBL project.
In Debug Configuration → Startup → Load Image and Symbols, I configured:

  • second_Appli.elf
    • Download = OFF (already flashed manually)
    • Load symbols = ON

So FSBL is loaded/debugged, while App and model are already present in flash.

Additionally, I also tried adding the runtime GCC libraries to the FSBL debug configuration, but this did not change the behavior


 What works

  • FSBL runs correctly from RAM (0x3418xxxx)
  • XSPI initialization seems correct
  • Jump to application works
  • Application reaches:

     
    STM32CubeAI_Studio_AI_Init();
    STM32CubeAI_Studio_AI_Process();
     
  • Execution enters:

     
    aiRun();
     

 Problem

Execution gets stuck in:

 

 
do {
ll_aton_rt_ret = LL_ATON_RT_RunEpochBlock(&NN_Instance_network);

if (ll_aton_rt_ret == LL_ATON_RT_WFE)
LL_ATON_OSAL_WFE();

} while (ll_aton_rt_ret != LL_ATON_RT_DONE);
 

 

Observed behavior:

  • ll_aton_rt_ret remains LL_ATON_RT_WFE
  • Loop never exits

Question

  • is this the right debug configuration for projects generated by STM Cube AI Studio ?
  • if so ,is there additional steps before debugging so that the inference ?

Thanks for your assistance 

4 REPLIES 4
ayaaaa
Associate II

 

 Additional debug attempts (LED + UART)

 LED test

To verify that the application is actually running, I added a simple GPIO test:

  • Configured a GPIO pin as output in MX_GPIO_Init()
  • Set the pin high before and after aiRun()

Result

  • The code does reach the LED control function
  • However, the LED does not visibly toggle .

UART / printf test

I also tried UART debugging. USART1 is initialized and I have used USART1 successfully on the same board in other projects. However, in this Cube AI Studio project, printf does not output anything. I noticed that _write() is already defined in aiTestUtility.c, so I did not add a duplicate _write() in main.c.


 Interpretation

  • The application does execute (Confirmed by code stepping)
  • But : aiRun() never completes (still stuck in LL_ATON_RT_WFE)
  • Could not debug with printf /leds as they dont output anything despite not having any building errors and the code stepping in their functions .

Can you please provide and explanation/tutorial that would be very helpful 

ayaaaa
Associate II

Update : 

I now understand that not being able to use the virtual com port or leds to debug was because they were not configured in the generated Cube mx project , but i still didnt find a solution to the inference stuck in the aiRun() Loop

i attach here my full project on zip format 

can you please look into it 

hamitiya
ST Employee

Hello @ayaaaa 

On my side, your project is not stuck in the while loop:

hamitiya_0-1777895606136.png

I will share with you a NUCLEO-N657X0-Q project with outputs in UART, if it works on your side, I will try to help you to modify the model integrated in it.

 

Best regards,

Yanis


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.