cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7RS XSPI Req2AckTime assert failure

mkrk
Associate III

Using STM32H7R3L8HxH with external Flash and PSRAM. STM32CubeIDE version is 1.19.0 MxCube version is 6.15.0.

MX XSPI1 and XSPI2 initialization functions do not set sXspiManagerCfg.Req2AckTime value. Here is XSPI1 code:

static void MX_XSPI1_Init(void)
{
  /* USER CODE BEGIN XSPI1_Init 0 */
  /* USER CODE END XSPI1_Init 0 */
  XSPIM_CfgTypeDef sXspiManagerCfg = {0};
  /* USER CODE BEGIN XSPI1_Init 1 */
  /* USER CODE END XSPI1_Init 1 */
  /* XSPI1 parameter configuration*/
  hxspi1.Instance = XSPI1;
  hxspi1.Init.FifoThresholdByte = 2;
  hxspi1.Init.MemoryMode = HAL_XSPI_SINGLE_MEM;
  hxspi1.Init.MemoryType = HAL_XSPI_MEMTYPE_APMEM_16BITS;
  hxspi1.Init.MemorySize = HAL_XSPI_SIZE_256MB;
  hxspi1.Init.ChipSelectHighTimeCycle = 5;
  hxspi1.Init.FreeRunningClock = HAL_XSPI_FREERUNCLK_DISABLE;
  hxspi1.Init.ClockMode = HAL_XSPI_CLOCK_MODE_0;
  hxspi1.Init.WrapSize = HAL_XSPI_WRAP_32_BYTES;
  hxspi1.Init.ClockPrescaler = 0;
  hxspi1.Init.SampleShifting = HAL_XSPI_SAMPLE_SHIFT_NONE;
  hxspi1.Init.DelayHoldQuarterCycle = HAL_XSPI_DHQC_ENABLE;
  hxspi1.Init.ChipSelectBoundary = HAL_XSPI_BONDARYOF_8KB;
  hxspi1.Init.MaxTran = 0;
  hxspi1.Init.Refresh = 0;
  hxspi1.Init.MemorySelect = HAL_XSPI_CSSEL_NCS1;
  if (HAL_XSPI_Init(&hxspi1) != HAL_OK)
  {
    Error_Handler();
  }
  sXspiManagerCfg.nCSOverride = HAL_XSPI_CSSEL_OVR_NCS1;
  sXspiManagerCfg.IOPort = HAL_XSPIM_IOPORT_1;
  if (HAL_XSPIM_Config(&hxspi1, &sXspiManagerCfg, HAL_XSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN XSPI1_Init 2 */
  /* USER CODE END XSPI1_Init 2 */
}

Req2AckTime remains zero. Call of HAL_XSPIM_Config stucks in assert on line 15 in this snippet because it expects value to be greater than zero.

HAL_StatusTypeDef HAL_XSPIM_Config(XSPI_HandleTypeDef *const hxspi, XSPIM_CfgTypeDef *const pCfg, uint32_t Timeout)
{
  HAL_StatusTypeDef status = HAL_OK;
  uint8_t index;
  uint8_t xspi_enabled = 0U;

  XSPIM_CfgTypeDef IOM_cfg[XSPI_NB_INSTANCE] = {0};

  /* Prevent unused argument(s) compilation warning */
  UNUSED(Timeout);

  /* Check the parameters of the XSPI IO Manager configuration structure */
  assert_param(IS_XSPIM_NCS_OVR(pCfg->nCSOverride));
  assert_param(IS_XSPIM_IO_PORT(pCfg->IOPort));
  assert_param(IS_XSPIM_REQ2ACKTIME(pCfg->Req2AckTime));

Workaround is to set the value in the user code section after the sXspiManagerCfg declaration, but it would be nice if this value is configurable in the GUI and generated nicely.

GUI views of XSPI1 and 2 are:

mkrk_0-1755072749414.png

mkrk_1-1755072764856.png

I found several similar forum posts but they seem to blame the clock and multiplexing. But I don't see how that could explain uninitialized variable. HAL_XSPIM_Config isn't generated code, it's static. It must get valid input. So it does look like code generator bug.

1 REPLY 1
Ghofrane GSOURI
ST Employee

Hello @mkrk 

Your contribution is much appreciated.

Your change request has been raised to dev team.

Internal ticket number is 215712 

I will keep you posted with updates. 

THX

Ghofrane 

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.