2025-06-21 10:32 AM - edited 2025-06-21 10:38 AM
Hello,
I am working on a NUCLEO-N657X0-Q and i'm trying to fill the runtime input buffer of an NPU accelerated miniresnet model with random data in order to verify that it is working, however, the buffer remains unaffected and filled with zeroes.
Do I have to do something different before/after filling (like invalidate some kind of cache?)
I am attaching a snippet of the code and the UART output aswell as the model analysis text.
I am using the external flash to store the model @ 0x71000000 (n6-extflash profile). The npuRAM5 (0x342e0000) is also used and project is setup as LRun.
The base code was generated by STM32CubeMX GUI
Thanks
Tasos
Solved! Go to Solution.
2025-07-02 6:46 AM
Hello Tasos,
As mentioned by Julian, this error concerns the RAM configuration generated by CubeMX. The RAM sections are initialized but they're not turned on. To be able to properly write on the input buffer, add these following lines of code into your project:
They simply turn on the RAM that you've previously enabled. You can add them into the CubeMX Cube AI Init function, as shown above. To make it easier for you, copy it from the text below:
RAMCFG_SRAM2_AXI->CR &= ~RAMCFG_CR_SRAMSD;
RAMCFG_SRAM3_AXI->CR &= ~RAMCFG_CR_SRAMSD;
RAMCFG_SRAM4_AXI->CR &= ~RAMCFG_CR_SRAMSD;
RAMCFG_SRAM5_AXI->CR &= ~RAMCFG_CR_SRAMSD;
RAMCFG_SRAM6_AXI->CR &= ~RAMCFG_CR_SRAMSD;
Moreover, you might also encounter false inference values if your RIF is not correctly configured. Therefore,
in CubeMX RIF initialization function (SystemIsolation_Config) add the following line of code if you don't have it
already:
HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_NPU, RIF_ATTRIBUTE_PRIV | RIF_ATTRIBUTE_SEC);
This shall solve your problem.
Best regards,
Pedro.
2025-07-01 1:42 AM
Hello @Unfgr,
It seems that there is issue in the way Cube MX handles the N6.
In your case, X Cube AI does not properly configure the memory used by the buffer, I think it is not activated.
We will come back to you soon to explain you what to do.
Sorry for the inconvenience and thank you for the remark.
Have a good day,
Julian
2025-07-01 7:19 AM
Thanks @Julian E.
I though so...
take a look at the following post aswell, more info/analysis there (same problem different approach)
2025-07-02 6:46 AM
Hello Tasos,
As mentioned by Julian, this error concerns the RAM configuration generated by CubeMX. The RAM sections are initialized but they're not turned on. To be able to properly write on the input buffer, add these following lines of code into your project:
They simply turn on the RAM that you've previously enabled. You can add them into the CubeMX Cube AI Init function, as shown above. To make it easier for you, copy it from the text below:
RAMCFG_SRAM2_AXI->CR &= ~RAMCFG_CR_SRAMSD;
RAMCFG_SRAM3_AXI->CR &= ~RAMCFG_CR_SRAMSD;
RAMCFG_SRAM4_AXI->CR &= ~RAMCFG_CR_SRAMSD;
RAMCFG_SRAM5_AXI->CR &= ~RAMCFG_CR_SRAMSD;
RAMCFG_SRAM6_AXI->CR &= ~RAMCFG_CR_SRAMSD;
Moreover, you might also encounter false inference values if your RIF is not correctly configured. Therefore,
in CubeMX RIF initialization function (SystemIsolation_Config) add the following line of code if you don't have it
already:
HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_NPU, RIF_ATTRIBUTE_PRIV | RIF_ATTRIBUTE_SEC);
This shall solve your problem.
Best regards,
Pedro.