Skip to main content
Visitor II
January 14, 2022
Solved

STM32H735G BSP_OSPI_NOR_Erase_Chip(0) not work

  • January 14, 2022
  • 2 replies
  • 1445 views

I have STM32H735G configured and worked with TouchGFX,. I have tihis configuration works:

MX_OCTOSPI1_Init ->okay

BSP_OSPI_NOR_Init(0, &ospi_nor_int)-> okay

BSP_OSPI_NOR_EnableMemoryMappedMode(0)-> okay

(post code)

static void MX_OCTOSPI1_Init(void)

{

 /* USER CODE BEGIN OCTOSPI1_Init 0 */

BSP_OSPI_NOR_Init_t ospi_nor_int;

 /* 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 = 4;

 hospi1.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;

 hospi1.Init.MemoryType = HAL_OSPI_MEMTYPE_MACRONIX;

 hospi1.Init.DeviceSize = 32;

 hospi1.Init.ChipSelectHighTime = 2;

 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;

 hospi1.Init.ClkChipSelectHighTime = 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.DQSPort = 1;

 sOspiManagerCfg.NCSPort = 1;

 sOspiManagerCfg.IOLowPort = HAL_OSPIM_IOPORT_1_LOW;

 sOspiManagerCfg.IOHighPort = HAL_OSPIM_IOPORT_1_HIGH;

 if (HAL_OSPIM_Config(&hospi1, &sOspiManagerCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)

 {

  Error_Handler();

 }

 /* USER CODE BEGIN OCTOSPI1_Init 2 */

 HAL_OSPI_DeInit(&hospi1);

 ospi_nor_int.InterfaceMode = BSP_OSPI_NOR_OPI_MODE;

 ospi_nor_int.TransferRate = BSP_OSPI_NOR_DTR_TRANSFER;

 BSP_OSPI_NOR_DeInit(0);

 if(BSP_OSPI_NOR_Init(0, &ospi_nor_int) != BSP_ERROR_NONE)

 {

  Error_Handler();

 }

 if(BSP_OSPI_NOR_EnableMemoryMappedMode(0) != BSP_ERROR_NONE)

 {

  Error_Handler();

 }

 /* USER CODE END OCTOSPI1_Init 2 */

}

//end code

Then i try to use this functions, but nothigs works:

BSP_OSPI_NOR_Erase_Chip(0);

BSP_OSPI_NOR_Write(0, writebuf, 0, 100);

BSP_OSPI_NOR_Read(0, readbuffer, 0,100);

BSP_OSPI_NOR_ReadID(0,&myid);

Somebody can i help me please?

    This topic has been closed for replies.
    Best answer by PChia.2237

    I solve this.

    After BSP_OSPI_NOR_EnableMemoryMappedMode(0) 

    all other BSP command not work any more

    2 replies

    PChia.2237AuthorAnswer
    Visitor II
    January 17, 2022

    I solve this.

    After BSP_OSPI_NOR_EnableMemoryMappedMode(0) 

    all other BSP command not work any more

    Visitor II
    February 23, 2024

    Hi,

    im also facing similar issue,

    how did you achieve the read and write erase operations on STM32H7 series with BSP APIs? 

    is there any application example available or any user manual available? to use the BSP OSPI NOR APIs? if yes, please attach here.

     

    Thanks

     

    Graduate II
    February 23, 2024

    The Reference Manual on the H7 side will usually provide a good outline of what the peripheral can do and the plumbing.

    The OSPI memory device itself will also have a Data Sheet or Manual describing that ends expectations. 

    It would help to be specific about the memory part and how it interfaces with your board, to direct you the specific answers. 

    Visitor II
    February 23, 2024

    Hi Tesla,

    Thanks for Immediate response.

    Im using STM32H735G-DK kit, 

    mx25lm51245g is NOR flash is connected. 

    I was trying to bring up the memory with BSP API's, is it possible to give any examples upon BSP API's

    i have already checked, available examples from git repo :STM32CubeH7/Projects/STM32H735G-DK/Examples/OSPI/OSPI_HyperRAM_MemoryMapped at 5975bffae9358bc2b2890a35a203d940a395efef · STMicroelectronics/STM32CubeH7 · GitHub

    this has been provided upon the HAL OSPI API

    But I wanted to use BSP APIs instead HAL OSPI