cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H735 QSPI init failed with NCS pin disabled

MStei.4
Associate III

preconditions:

  • CubeIDE 1.11.0
  • configured QSPI with disabled NCS
  • enabled: Project Manager-->Code Generator-->HAL Settings-->Enable Full Assert

The idea is to have multiple QSPI chips connected to the QSPI with their own chip select pin. So the use NCS shall not be provided through the HW. In the Cube GUI the NCS is not selected:

0693W00000WLBinQAH.pngcode generation:

In the generated MX_OCTOSPI1_Init() function, HAL_OSPIM_Config() is called with the sOspiManagerCfg structure.

/**
  * @brief OCTOSPI1 Initialization Function
  * @param None
  * @retval None
  */
static void MX_OCTOSPI1_Init(void)
{
 
  /* USER CODE BEGIN OCTOSPI1_Init 0 */
 
  /* USER CODE END OCTOSPI1_Init 0 */
 
  OSPIM_CfgTypeDef sOspiManagerCfg = {0};
 
  /* USER CODE BEGIN OCTOSPI1_Init 1 */
 
  /* USER CODE END OCTOSPI1_Init 1 */
  /* OCTOSPI1 parameter configuration*/
  hospi1.Instance = OCTOSPI1;
  hospi1.Init.FifoThreshold = 1;
  hospi1.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;
  hospi1.Init.MemoryType = HAL_OSPI_MEMTYPE_MICRON;
  hospi1.Init.DeviceSize = 32;
  hospi1.Init.ChipSelectHighTime = 1;
  hospi1.Init.FreeRunningClock = HAL_OSPI_FREERUNCLK_DISABLE;
  hospi1.Init.ClockMode = HAL_OSPI_CLOCK_MODE_3;
  hospi1.Init.WrapSize = HAL_OSPI_WRAP_NOT_SUPPORTED;
  hospi1.Init.ClockPrescaler = 1;
  hospi1.Init.SampleShifting = HAL_OSPI_SAMPLE_SHIFTING_NONE;
  hospi1.Init.DelayHoldQuarterCycle = HAL_OSPI_DHQC_DISABLE;
  hospi1.Init.ChipSelectBoundary = 0;
  hospi1.Init.DelayBlockBypass = HAL_OSPI_DELAY_BLOCK_BYPASSED;
  hospi1.Init.MaxTran = 0;
  hospi1.Init.Refresh = 0;
  if (HAL_OSPI_Init(&hospi1) != HAL_OK)
  {
    Error_Handler();
  }
  sOspiManagerCfg.ClkPort = 1;
  sOspiManagerCfg.IOLowPort = HAL_OSPIM_IOPORT_1_LOW;
  if (HAL_OSPIM_Config(&hospi1, &sOspiManagerCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN OCTOSPI1_Init 2 */
 
  /* USER CODE END OCTOSPI1_Init 2 */
 
}

Of course there:

sOspiManagerCfg.NCSPort = 0;

because NCS is not used.

In HAL_OSPIM_Config (stm32h7xx_hal_ospi.c, line: 2484) the following assertion will be hit of course:

assert_param(IS_OSPIM_PORT(cfg->NCSPort));

This is wrong in my opinion. Either it is not possible not to use the NCS; then the Cube GUI is wrong as shown in the picture above. Or the generated code is wrong.

What is your opinion about that?

0 REPLIES 0