STM32H735G-DK OCTOSPI2 HyperRAM 1st Read PASS, next Read FAIL
Hello,
I created the STM32H735G-DK project with the board selector in STM32CubeIDE.
The OSPI_HyperRAM_MemoryMapped project was created by the example selector. Its HyperRAM test codes were added to the STM32H735G-DK project as below. The reading sequence was repeated twice on the same address w/o increasing the memory pointer. However, the 2nd reading was always failing while the 1st reading was fine as below. Please help me to solve this issue. The MX_OCTOSPI2_Init function is also pasted below.
Thanks.
SUCCESS1: mem_addr = 0x70000000 pattern = 2a2a2a20 output = 2a2a2a20
FAILURE2: mem_addr = 0x70000000 pattern = 2a2a2a20 output = 5655d557
SUCCESS1: mem_addr = 0x70000004 pattern = 6d654d2a output = 6d654d2a
FAILURE2: mem_addr = 0x70000004 pattern = 6d654d2a output = 55155146
SUCCESS1: mem_addr = 0x70000008 pattern = 2d79726f output = 2d79726f
FAILURE2: mem_addr = 0x70000008 pattern = 2d79726f output = 55555551
SUCCESS1: mem_addr = 0x7000000c pattern = 7070616d output = 7070616d
FAILURE2: mem_addr = 0x7000000c pattern = 7070616d output = 11113f51
static void MX_OCTOSPI2_Init(void)
{
/* USER CODE BEGIN OCTOSPI2_Init 0 */
/* USER CODE END OCTOSPI2_Init 0 */
OSPIM_CfgTypeDef sOspiManagerCfg = {0};
OSPI_HyperbusCfgTypeDef sHyperBusCfg = {0};
/* USER CODE BEGIN OCTOSPI2_Init 1 */
/* USER CODE END OCTOSPI2_Init 1 */
/* OCTOSPI2 parameter configuration*/
hospi2.Instance = OCTOSPI2;
HAL_OSPI_DeInit(&hospi2);
hospi2.Init.FifoThreshold = 4;
hospi2.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;
hospi2.Init.MemoryType = HAL_OSPI_MEMTYPE_HYPERBUS;
hospi2.Init.DeviceSize = OSPI_HYPERRAM_SIZE;
hospi2.Init.ChipSelectHighTime = 8;
hospi2.Init.FreeRunningClock = HAL_OSPI_FREERUNCLK_DISABLE;
hospi2.Init.ClockMode = HAL_OSPI_CLOCK_MODE_0;
hospi2.Init.WrapSize = HAL_OSPI_WRAP_NOT_SUPPORTED;
hospi2.Init.ClockPrescaler = 4;
hospi2.Init.SampleShifting = HAL_OSPI_SAMPLE_SHIFTING_NONE;
hospi2.Init.DelayHoldQuarterCycle = HAL_OSPI_DHQC_DISABLE;
hospi2.Init.ChipSelectBoundary = 23;
hospi2.Init.DelayBlockBypass = HAL_OSPI_DELAY_BLOCK_USED;
hospi2.Init.MaxTran = 0;
hospi2.Init.Refresh = 250;
if (HAL_OSPI_Init(&hospi2) != HAL_OK)
{
Error_Handler();
}
sOspiManagerCfg.ClkPort = 2;
sOspiManagerCfg.DQSPort = 2;
sOspiManagerCfg.NCSPort = 2;
sOspiManagerCfg.IOLowPort = HAL_OSPIM_IOPORT_2_LOW;
sOspiManagerCfg.IOHighPort = HAL_OSPIM_IOPORT_2_HIGH;
if (HAL_OSPIM_Config(&hospi2, &sOspiManagerCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
sHyperBusCfg.RWRecoveryTime = OSPI_HYPERRAM_RW_REC_TIME;
sHyperBusCfg.AccessTime = OSPI_HYPERRAM_LATENCY;
sHyperBusCfg.WriteZeroLatency = HAL_OSPI_NO_LATENCY_ON_WRITE;
sHyperBusCfg.LatencyMode = HAL_OSPI_FIXED_LATENCY;
if (HAL_OSPI_HyperbusCfg(&hospi2, &sHyperBusCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN OCTOSPI2_Init 2 */
/* Memory-mapped mode configuration --------------------------------------- */
sCommand.AddressSpace = HAL_OSPI_MEMORY_ADDRESS_SPACE;
sCommand.AddressSize = HAL_OSPI_ADDRESS_32_BITS;
sCommand.DQSMode = HAL_OSPI_DQS_ENABLE;
sCommand.Address = 0;
sCommand.NbData = 1;
if (HAL_OSPI_HyperbusCmd(&hospi2, &sCommand, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
sMemMappedCfg.TimeOutActivation = HAL_OSPI_TIMEOUT_COUNTER_DISABLE;
if (HAL_OSPI_MemoryMapped(&hospi2, &sMemMappedCfg) != HAL_OK)
{
Error_Handler();
}
/* USER CODE END OCTOSPI2_Init 2 */
}
