cancel
Showing results for 
Search instead for 
Did you mean: 

OctoSPI configuration for hyperflash

Leo_Panda
Associate III

does anyone have a configuration for the CypressS26KL256S hyperflash? in the stm32cube_fw_l4_v1130 are examples only for regular command mode (micron or macronix) but not for hyperflash mode. thanks in advance

12 REPLIES 12
Leo_Panda
Associate III

With some investigation i can erase write and read the hyperflash.

The only problem now is reading flash in memory mapped mode: if i make an address jump, say read word from base and immediatly read word at base+300 then the system crashes, i lost the connection to the st-link, is not able to debug any more. I can do the same reading procedure on hyper ram without any problem!

Can anyone help? Thanks!

Leo_Panda
Associate III

it seems nobody has experiences with stm ospi on hyperflash memory here.

Now i solved the problem. I use dma and interrupt for writing the flash and then switch it into memory mapped mode. but the dma is still linked and the interrupt is active. this combination seems to be wrong for the memory mapped mode. after removing the dma and disabling the interrupt, it works fine.

ALan1
Associate II

Hi @Leo_Panda​ ,

Could you share how you got reading, writing and erase to work with Cypress HyperFlash? I am able to execute one command sequence (HyperbusCmd, Transmit, Receive), but after that OSPI driver returns with timeout error (busy flag not reset).

I'm not sure is it in OSPI configuration, command I send or hardware issue that is causing the error.

I have contacted ST support, but I guess holiday season is causing delays for answers...

That and everyone locked down for COVID-1984..

Might want to try your local Cypress/Infineon FAE, more likely to have specific understanding of their FLASH IC, and how it integrates with common MCUs

Parts distributors might also have support staff to help integrate.

Failing that you'll need to pull out a logic analyzer and review/interpret the data sheets

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Agran.1
Associate II

Hi @Leo_Panda (Community Member)​ and ALan (Community Member)

I'm developing with the STM32H7B0 and I use an external hyperFlash Memory (Cypress S26KL512) with HyperBus mode.

Octospi :

IO[7:0] as bidirectional data bus, RWDS for read and write data strobe,  nCS and CLK

Quartz : 24Mhz  => sysclock = 120 Mhz  and  OctoSPi Clock = 60 Mhz

.

Currently, I can't read the Status Register Mode of the flash, it answers 0xFFFF.

  

configuration :

void MX_OCTOSPI1_Init(void)

{

 OSPIM_CfgTypeDef sOspiManagerCfg = {0};

 OSPI_HyperbusCfgTypeDef sHyperBusCfg = {0};

 hospi1.Instance = OCTOSPI1;

 hospi1.Init.FifoThreshold = 1;

 hospi1.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;

 hospi1.Init.MemoryType = HAL_OSPI_MEMTYPE_HYPERBUS;

 hospi1.Init.DeviceSize = 26;

 hospi1.Init.ChipSelectHighTime = 1;

 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 = 2;

 hospi1.Init.SampleShifting = HAL_OSPI_SAMPLE_SHIFTING_NONE;

 hospi1.Init.DelayHoldQuarterCycle = HAL_OSPI_DHQC_ENABLE;

  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();

 }

 sHyperBusCfg.RWRecoveryTime = 3;

 sHyperBusCfg.AccessTime = 6;

 sHyperBusCfg.WriteZeroLatency = HAL_OSPI_LATENCY_ON_WRITE;

 sHyperBusCfg.LatencyMode = HAL_OSPI_FIXED_LATENCY;

 if (HAL_OSPI_HyperbusCfg(&hospi1, &sHyperBusCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)

 {

   Error_Handler();

 }

}

Can you help me ?

Best regard

Here is my settings for IS26KL128S (basically same chip as Cypress) using 100 MHz bus:

 hospi1.Instance = OCTOSPI1;

 hospi1.Init.FifoThreshold = 2;

 hospi1.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;

 hospi1.Init.MemoryType = HAL_OSPI_MEMTYPE_HYPERBUS;

 hospi1.Init.DeviceSize = 24;

 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 = 2;

 hospi1.Init.SampleShifting = HAL_OSPI_SAMPLE_SHIFTING_NONE;

 hospi1.Init.DelayHoldQuarterCycle = HAL_OSPI_DHQC_ENABLE;

 hospi1.Init.ChipSelectBoundary = 0;

 hospi1.Init.ClkChipSelectHighTime = 0;

 hospi1.Init.DelayBlockBypass = HAL_OSPI_DELAY_BLOCK_BYPASSED;

 hospi1.Init.MaxTran = 0;

 hospi1.Init.Refresh = 0;

 sHyperBusCfg.RWRecoveryTime = 0;

 sHyperBusCfg.AccessTime = 10;

 sHyperBusCfg.WriteZeroLatency = HAL_OSPI_NO_LATENCY_ON_WRITE;

 sHyperBusCfg.LatencyMode = HAL_OSPI_VARIABLE_LATENCY;

I also recommend to request a low level driver from Cypress/ISSI. It makes the necessary address conversion. Practically it does the same thing as this: sCommand.Address = (address << 1);

BR,

Aki

Hello, Thank you for your answer

For my part, I wanted to use the indirect mode to read and write in the flash.

And use the HAL_OSPI_HyperbusCmd, HAL_OSPI_Transmit and HAL_OSPI_Receive functions.

I still cannot read the Status Register Mode.

I think I have a sending problem in my DQ [0..7] data but at the moment I can't find where the problem is.

I have already recovered low level driver from Cypress for the commands.

I tried to switch it to Memory-mapped mode but it doesn't work either.

Should your configuration change following the write (HAL_OSPI_NO_LATENCY_ON_WRITE) or read (HAL_OSPI_LATENCY_ON_WRITE) commands?

Do you initialize the flash (NVCR / VCR) during the first use?

Best regard

Hi ALan (Community Member),

Are you in indirect mode or in memory mapped mode ?

For me, it works in indirect mode but not in memory mapped mode.

Best regard

Hi Agran,

Good to hear that you got it working in indirect mode.

I initialize VCR first in indirect mode then switch to memory mapped mode. I haven't got write command to work in memory mapped mode, but it is not an issue for me, because I use HyperFlash for XIP (code execution).

BR