2025-09-02 3:39 AM
I’m encountering an issue with XSPI1 in my application. I boot the application via XSPI2 in an LRUN configuration, and this part works perfectly. However, within the application, I need to use XSPI1 to write data to a different flash.
During MX_XSPI1_Init(), the code crashes at this line:
if (HAL_XSPIM_Config(&hxspi1, &sXspiManagerCfg, HAL_XSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
I traced the crash to the exact line:
IOM_cfg[0].IOPort = pCfg->IOPort;
The initialization code for XSPI1 was generated using CubeMX. Interestingly, if I initialize XSPI1 in the boot project, everything works fine.
I’ve already spent a week trying to solve this issue, but so far nothing has worked.
I would really appreciate suggestions to help solve my problem.
Solved! Go to Solution.
2025-09-03 1:39 AM
I’ve solved the problem. It seems there’s currently an issue in the HAL driver provided by STMicroelectronics, specifically in the HAL_XSPIM_Config function. I found a similar case reported by another user and based my solution on their approach. However, small adjustments are required depending on which XSPI instance you are using and the type of memory involved. The reason why the code crashes is also described in the forum entry.
2025-09-02 4:23 AM
Hello @Danhe ,
You can use the XPI example available on our GitHub repository, which can help you with your testing. Please find the example at the following link:
https://github.com/STMicroelectronics/STM32CubeH7RS/tree/main/Projects/NUCLEO-H7S3L8/Examples/XSPI
Br
2025-09-03 1:39 AM
I’ve solved the problem. It seems there’s currently an issue in the HAL driver provided by STMicroelectronics, specifically in the HAL_XSPIM_Config function. I found a similar case reported by another user and based my solution on their approach. However, small adjustments are required depending on which XSPI instance you are using and the type of memory involved. The reason why the code crashes is also described in the forum entry.