2019-06-26 06:53 AM
We made a board ourselves, using the chip STM32L4R9VI, and plugged an IS66WVH8M8BLL chip (the same as the EVAL development board), but the implementation of a similar example chip is always hanging, how to continue to analyze this situation?We welded four such boards to the same problem.
#define OSPI_HYRAM_CS_PIN GPIO_PIN_3
#define OSPI_HYRAM_CS_GPIO_PORT GPIOD
#define OSPI_HYRAM_CLK_PIN GPIO_PIN_10
#define OSPI_HYRAM_CLK_GPIO_PORT GPIOB
#define OSPI_HYRAM_DQS_PIN GPIO_PIN_2
#define OSPI_HYRAM_DQS_GPIO_PORT GPIOB
#define OSPI_HYRAM_D0_PIN GPIO_PIN_12
#define OSPI_HYRAM_D0_GPIO_PORT GPIOE
#define OSPI_HYRAM_D1_PIN GPIO_PIN_13
#define OSPI_HYRAM_D1_GPIO_PORT GPIOE
#define OSPI_HYRAM_D2_PIN GPIO_PIN_14
#define OSPI_HYRAM_D2_GPIO_PORT GPIOE
#define OSPI_HYRAM_D3_PIN GPIO_PIN_15
#define OSPI_HYRAM_D3_GPIO_PORT GPIOE
#define OSPI_HYRAM_D4_PIN GPIO_PIN_4
#define OSPI_HYRAM_D4_GPIO_PORT GPIOD
#define OSPI_HYRAM_D5_PIN GPIO_PIN_5
#define OSPI_HYRAM_D5_GPIO_PORT GPIOD
#define OSPI_HYRAM_D6_PIN GPIO_PIN_6
#define OSPI_HYRAM_D6_GPIO_PORT GPIOD
#define OSPI_HYRAM_D7_PIN GPIO_PIN_7
#define OSPI_HYRAM_D7_GPIO_PORT GPIOD
static void MX_OSPIHYRAM_Init(void)
{
OSPIM_CfgTypeDef OSPIM_Cfg_Struct = {0};
GPIO_InitTypeDef GPIO_InitStruct;
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_OSPIM_CLK_ENABLE();
#if OSPI_HYRAM_INST == 2
__HAL_RCC_OSPI2_CLK_ENABLE();
/* Reset the OctoSPI memory interface */
__HAL_RCC_OSPI2_FORCE_RESET();
__HAL_RCC_OSPI2_RELEASE_RESET();
#else
__HAL_RCC_OSPI1_CLK_ENABLE();
/* Reset the OctoSPI memory interface */
__HAL_RCC_OSPI1_FORCE_RESET();
__HAL_RCC_OSPI1_RELEASE_RESET();
#endif
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_11, GPIO_PIN_RESET);
/*Configure GPIO pin : PE11 */
GPIO_InitStruct.Pin = GPIO_PIN_11;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
/*##-2- Configure peripheral GPIO ##########################################*/
/* OSPI CS GPIO pin configuration */
HAL_GPIO_WritePin(OSPI_HYRAM_CS_GPIO_PORT, OSPI_HYRAM_CS_PIN, GPIO_PIN_SET);
GPIO_InitStruct.Pin = OSPI_HYRAM_CS_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_OCTOSPIM_P2;
HAL_GPIO_Init(OSPI_HYRAM_CS_GPIO_PORT, &GPIO_InitStruct);
/* OSPI CLK GPIO pin configuration */
GPIO_InitStruct.Pin = OSPI_HYRAM_CLK_PIN;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Alternate = GPIO_AF10_OCTOSPIM_P1;
HAL_GPIO_Init(OSPI_HYRAM_CLK_GPIO_PORT, &GPIO_InitStruct);
/* OSPI D0 GPIO pin configuration */
GPIO_InitStruct.Pin = OSPI_HYRAM_D0_PIN;
HAL_GPIO_Init(OSPI_HYRAM_D0_GPIO_PORT, &GPIO_InitStruct);
/* OSPI D1 GPIO pin configuration */
GPIO_InitStruct.Pin = OSPI_HYRAM_D1_PIN;
HAL_GPIO_Init(OSPI_HYRAM_D1_GPIO_PORT, &GPIO_InitStruct);
/* OSPI D2 GPIO pin configuration */
GPIO_InitStruct.Pin = OSPI_HYRAM_D2_PIN;
HAL_GPIO_Init(OSPI_HYRAM_D2_GPIO_PORT, &GPIO_InitStruct);
/* OSPI D3 GPIO pin configuration */
GPIO_InitStruct.Pin = OSPI_HYRAM_D3_PIN;
HAL_GPIO_Init(OSPI_HYRAM_D3_GPIO_PORT, &GPIO_InitStruct);
/* OSPI D4 GPIO pin configuration */
GPIO_InitStruct.Pin = OSPI_HYRAM_D4_PIN;
HAL_GPIO_Init(OSPI_HYRAM_D4_GPIO_PORT, &GPIO_InitStruct);
/* OSPI D5 GPIO pin configuration */
GPIO_InitStruct.Pin = OSPI_HYRAM_D5_PIN;
HAL_GPIO_Init(OSPI_HYRAM_D5_GPIO_PORT, &GPIO_InitStruct);
/* OSPI D6 GPIO pin configuration */
GPIO_InitStruct.Pin = OSPI_HYRAM_D6_PIN;
HAL_GPIO_Init(OSPI_HYRAM_D6_GPIO_PORT, &GPIO_InitStruct);
/* OSPI D7 GPIO pin configuration */
GPIO_InitStruct.Pin = OSPI_HYRAM_D7_PIN;
HAL_GPIO_Init(OSPI_HYRAM_D7_GPIO_PORT, &GPIO_InitStruct);
/* OSPI DQS GPIO pin configuration */
GPIO_InitStruct.Pin = OSPI_HYRAM_DQS_PIN;
HAL_GPIO_Init(OSPI_HYRAM_DQS_GPIO_PORT, &GPIO_InitStruct);
/*##-3- Configure the NVIC for OSPI #########################################*/
#if OSPI_HYRAM_INST == 2
HAL_NVIC_SetPriority(OCTOSPI2_IRQn, 0x0F, 0);
HAL_NVIC_EnableIRQ(OCTOSPI2_IRQn);
#else
HAL_NVIC_SetPriority(OCTOSPI1_IRQn, 0x0F, 0);
HAL_NVIC_EnableIRQ(OCTOSPI1_IRQn);
#endif
OSPIM_Cfg_Struct.ClkPort = 1;
OSPIM_Cfg_Struct.DQSPort = 1;
OSPIM_Cfg_Struct.NCSPort = 2;
OSPIM_Cfg_Struct.IOLowPort = HAL_OSPIM_IOPORT_1_LOW;
OSPIM_Cfg_Struct.IOHighPort = HAL_OSPIM_IOPORT_1_HIGH;
///< 撤销HYPER SRAM的�?�?
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_11, GPIO_PIN_SET);
HAL_Delay(500);
#if OSPI_HYRAM_INST == 2
hhyram.Instance = OCTOSPI2;
#else
hhyram.Instance = OCTOSPI1;
#endif
hhyram.Init.FifoThreshold = 4;
hhyram.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;
hhyram.Init.MemoryType = HAL_OSPI_MEMTYPE_HYPERBUS;
hhyram.Init.DeviceSize = OSPI_HYRAM_HYPERRAM_SIZE;
hhyram.Init.ChipSelectHighTime = 1;
hhyram.Init.FreeRunningClock = HAL_OSPI_FREERUNCLK_DISABLE;
hhyram.Init.ClockMode = HAL_OSPI_CLOCK_MODE_0;
hhyram.Init.WrapSize = HAL_OSPI_WRAP_NOT_SUPPORTED;
hhyram.Init.ClockPrescaler = 3;
hhyram.Init.SampleShifting = HAL_OSPI_SAMPLE_SHIFTING_NONE;
hhyram.Init.DelayHoldQuarterCycle = HAL_OSPI_DHQC_ENABLE;
hhyram.Init.ChipSelectBoundary = 0;
if (HAL_OSPIM_Config(&hhyram, &OSPIM_Cfg_Struct, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
assert_failed(__FILE__, __LINE__);
}
if (HAL_OSPI_Init(&hhyram) != HAL_OK)
{
assert_failed(__FILE__, __LINE__);
}
OSPI_HyperbusCfgTypeDef sHyperbusCfg;
OSPI_HyperbusCmdTypeDef sCommand;
OSPI_MemoryMappedTypeDef sMemMappedCfg = {0};
/* Configure the Hyperbus to access memory space -------------------------- */
sHyperbusCfg.RWRecoveryTime = OSPI_HYRAM_HYPERRAM_RW_REC_TIME;
sHyperbusCfg.AccessTime = OSPI_HYRAM_HYPERRAM_LATENCY;
sHyperbusCfg.WriteZeroLatency = HAL_OSPI_LATENCY_ON_WRITE;
sHyperbusCfg.LatencyMode = HAL_OSPI_FIXED_LATENCY;
if (HAL_OSPI_HyperbusCfg(&hhyram, &sHyperbusCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
assert_failed(__FILE__, __LINE__);
}
/* 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(&hhyram, &sCommand, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
assert_failed(__FILE__, __LINE__);
}
sMemMappedCfg.TimeOutActivation = HAL_OSPI_TIMEOUT_COUNTER_DISABLE;
sMemMappedCfg.TimeOutPeriod = 64;
if (HAL_OSPI_MemoryMapped(&hhyram, &sMemMappedCfg) != HAL_OK)
{
assert_failed(__FILE__, __LINE__);
}
}
void MX_OSPIHYRAM_Test()
{
#if OSPI_HYRAM_INST == 2
__IO uint8_t *ospi_base_addr = (__IO uint8_t *)OCTOSPI2_BASE;
#else
__IO uint8_t *ospi_base_addr = (__IO uint8_t *)OCTOSPI1_BASE;
#endif
__IO uint8_t * mem_addr = ospi_base_addr;
for (int index = 0; index < 1024; index++)
{
*mem_addr = 0x5a;
mem_addr++;
}
mem_addr = ospi_base_addr;
for (int index = 0; index < 1024; index++)
{
if(*mem_addr != 0x5a)
{
log_e("QSPI Memory Read/Write Failed at 0x%08x.", mem_addr);
break;
}
mem_addr++;
}
log_d("QSPI Memory Test over!");
}
2019-06-26 06:54 AM
We use PE11 as RESET#
2019-06-27 12:36 AM
We may have bought the wrong chip. The IS66WVH8M8ALL / BLL has two small models, which are distinguished by OPN. The functions of B1 and B2 are different.
It is a pity that the application documentation of ST is not mentioned, and we did not pay attention to it.