Skip to main content
vshah
Associate II
February 7, 2019
Question

Unable to establish communication between STM32L4R5ZI and S25FL128L(NOR Flash) via Quad SPI.

  • February 7, 2019
  • 1 reply
  • 527 views

i have generated the code from STM32CubeMX for OctoSPI, but not able to establish communication with NOR Flash.

It get stuck at following line "if (HAL_OSPIM_Config(&hospi1, &OSPIM_Cfg_Struct, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)" and goes to hard-fault.

i have configured the OctoSPI in following manner in CubeMX,

OCTOSPI Mode : Quad Mode

Data [3:0] : Port1[3:0]

Control NCS : Port1 NCS

Clock Port : Port 1 CLK

//--------------generated code from CubeMX for STM32L4R5ZI ----------------------//
/* OCTOSPI1 init function */
static void MX_OCTOSPI1_Init(void)
{
 
 OSPIM_CfgTypeDef OSPIM_Cfg_Struct;
 OSPI_MemoryMappedTypeDef sMemMappedCfg;
 
 /* 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 = 23;
 hospi1.Init.ChipSelectHighTime = 3;
 hospi1.Init.FreeRunningClock = HAL_OSPI_FREERUNCLK_DISABLE;
 hospi1.Init.ClockMode = HAL_OSPI_CLOCK_MODE_0;
 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;
 if (HAL_OSPI_Init(&hospi1) != HAL_OK)
 {
 _Error_Handler(__FILE__, __LINE__);
 }
 
 OSPIM_Cfg_Struct.ClkPort = 1;
 OSPIM_Cfg_Struct.NCSPort = 1;
 OSPIM_Cfg_Struct.IOLowPort = HAL_OSPIM_IOPORT_1_LOW;
 if (HAL_OSPIM_Config(&hospi1, &OSPIM_Cfg_Struct, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
 {
 _Error_Handler(__FILE__, __LINE__);
 }
 
 sMemMappedCfg.TimeOutActivation = HAL_OSPI_TIMEOUT_COUNTER_DISABLE;
 sMemMappedCfg.TimeOutPeriod = 1;
 if (HAL_OSPI_MemoryMapped(&hospi1, &sMemMappedCfg) != HAL_OK)
 {
 _Error_Handler(__FILE__, __LINE__);
 }
 
}
//--------------generated code from CubeMX for STM32L4R5ZI ----------------------//

Thanks in advance.

    This topic has been closed for replies.

    1 reply

    Asantos
    Associate III
    December 1, 2020

    vshah,

    Did you succeed in using a QSPI NOR FLASH in the OCTOSPI interface?