cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Hyperflash/Hyperbus with STM32H562

J_Kirsch
Associate II

Hello,

I am trying to use infineons S26KL128SDABHI020 HYPERFLASH memory with a STM32H562VI microcontroller.

For now I am just trying to do a simple write and read manually to make sure that everything is working.

I use the OCTOSPI module with Hyperbus-mode and execute the following in the main-function.

  /* USER CODE BEGIN 2 */
  uint8_t data_storage[125] = {0};
  uint8_t receive_storage[125] = {0};

  HAL_StatusTypeDef ret;
  XSPI_HyperbusCmdTypeDef command;
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  data_storage[0] = 0xAA;
  data_storage[1] = 0x0;
  data_storage[2] = 0xFB;
  data_storage[3] = 0x0;

  command.DQSMode = HAL_XSPI_DQS_ENABLE;	//HAL_XSPI_DQS_DISABLE	//HAL_XSPI_DQS_ENABLE
  command.AddressSpace = HAL_XSPI_MEMORY_ADDRESS_SPACE; //HAL_XSPI_MEMORY_ADDRESS_SPACE;	//HAL_XSPI_REGISTER_ADDRESS_SPACE
  command.AddressWidth = HAL_XSPI_ADDRESS_32_BITS;
  command.Address = (0x00000000);	//maximum 0x001FFFFF - DataLength
  command.DataLength = 4;

  HAL_XSPI_HyperbusCmd(&hospi1, &command, 1000);
  ret = HAL_XSPI_Transmit(&hospi1, &data_storage[0], 1000);

//  HAL_Delay(1);
  HAL_XSPI_HyperbusCmd(&hospi1, &command, 1000);
  ret = HAL_XSPI_Receive(&hospi1, &receive_storage[0], 1000);

  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
  }

 

But all that happens is the following:

J_Kirsch_1-1732704012873.png

In the first phase you see the transmit happening. But then after the receive command the controller just endlessly runs the clock because there is no response from the Hyperflash.

What am I doing wrong?

I also attached my main.c file with the MX_GPIO_Init()-function in line 1119 if needed...

Thanks and best regards,
Johann

6 REPLIES 6
SofLit
ST Employee

Hello @J_Kirsch and welcome to the comunity,

Please use </> button to paste your code instead of posting screenshots of it.

SofLit_0-1732706286710.png

You can review our tips on posting a thread in this community.

Thank you

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Hello,

I have changed my original post accordingly.

KDJEM.1
ST Employee

Hello @J_Kirsch

 

Which OCTOSPI frequency are you used?

Try to decrease the OCTOSPI clock frequency and to enable the delay block.

Make sure that the output speed is set to "very high" for all the GPIOs.

 

Thank you.

Kaouthar

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello Kaouthar,

in the picture from my post I use 3 MHz for the clock. I decreased it also to around 375 kHz but nothing changed. I don't think that the clock is the problem.

The GPIO speed is set to "very high" for all the OCTOSPI pins...

J_Kirsch
Associate II

I also tried to remove the OCTOSPI-Module and just use bare GPIO-commands periodically.

I copied the following "Read Status Register" command example from the datasheet of the S26KL128

J_Kirsch_0-1733129761910.png

But the result didn't change...

J_Kirsch_1-1733129814817.png

Nothing happens after the Read instruction.

Note that after the first three clock cycles of the Read instruction, I configured the DQ0-7 and DQS pins ans GPIO inputs to make sure, that the hyperflash can drive them.

Hello @J_Kirsch 

 

The S26KL128 HyperFlash memory requires issuing specific commands before initiating the program and erase command sequence. Additionally, an erase operation must be issued before initiating the programming process. For more details, please refer to section '6.2.3.1 Word Programming' in the memory datasheet. This post may also be helpful: How to Program Simple Data to OctoSPI External Flash.

To read the status, you first need to issue the Status Register Read command by sending the 70h command to address 555h. You then perform a read operation to retrieve the data stored in the Status Register.

Regarding the "AccessTimeCycle" parameter, please note that it should be set to 16 clock cycles instead of 12, according to the memory datasheet (default value).

Kind regards/