Skip to main content
JJuli.1
Associate II
March 10, 2023
Solved

octospi configuration cubemx

  • March 10, 2023
  • 8 replies
  • 4586 views

I have octospi hyperram memory to use on stm32h7b0 with nor flash I usually use stm32cubemx because it make the life easier but it's my first time configuring memories with it..can anyone help me with that ?

This topic has been closed for replies.
Best answer by ChahinezC

Hello @JJuli.1​,

The parameters you cited are memory related ones which means they are specific to the memory used:

  • The memory type should be set based on the memory you are using, you can check the different types mentioned in the reference manual at the MTYP bits of the OCTOSPI device configuration register. The OCTOSPI interface on the STM32 devices do support as well other memories that follow the same protocols as the mentioned types. 
  • For the Chip select high time (CSHT), it defines the chip-select minimum high time in number of clock cycles, configured an you can set it based on the memory datasheet.
  • For the refresh rate, the chip select must go high each (REFRECH x OCTOSPI clock cycles), configured depending on the memory datasheet as well. 

Please mark my answer as best by clicking on the "Select as Best" button if it fully answered your question. This will help other users find this solution faster.

Thank you.

Chahinez

8 replies

ChahinezC
Technical Moderator
March 10, 2023

Hello @JJuli.1​,

You can use STM32CubeMX to configure both of the OCTOSPI interfaces present on the STM32H7B0.

There are some parameters to set that are related to the memory you are using and to the use case.

Regards,

Chahinez.

Ghofrane GSOURI
Technical Moderator
March 13, 2023

Hello @JJuli.1 

First let me thank you for posting.

Please check this LINK you will find information that could help you understand how to configure the OCTOSPI.

Thanks,

Ghofrane

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.
JJuli.1
JJuli.1Author
Associate II
March 14, 2023

thank you for your responses, I am currently using cubemx for my project. are there any examples to help me on how to set the following parameters:

memory type, chip select high time, refresh rate ?

ChahinezC
ChahinezCBest answer
Technical Moderator
March 14, 2023

Hello @JJuli.1​,

The parameters you cited are memory related ones which means they are specific to the memory used:

  • The memory type should be set based on the memory you are using, you can check the different types mentioned in the reference manual at the MTYP bits of the OCTOSPI device configuration register. The OCTOSPI interface on the STM32 devices do support as well other memories that follow the same protocols as the mentioned types. 
  • For the Chip select high time (CSHT), it defines the chip-select minimum high time in number of clock cycles, configured an you can set it based on the memory datasheet.
  • For the refresh rate, the chip select must go high each (REFRECH x OCTOSPI clock cycles), configured depending on the memory datasheet as well. 

Please mark my answer as best by clicking on the "Select as Best" button if it fully answered your question. This will help other users find this solution faster.

Thank you.

Chahinez

Senior
November 16, 2023

About the refresh rate. My octospi clock is 104Mhz, i use as external ram memory APMemory APS6408L-3OBMx, could someone help me calculate the refresh rate?

Senior
November 16, 2023

I have found the answer to my question myself. 
1/104MHZ = 9.62ns = octospi clock cycle

Refresh = Refresh rate/ octospi clock cycle   = 4µs/9.62ns = 4µs/(1/(104MHZ)) = 416
Choose as refresh value 417 or 418, don't ask me why.


The value of refresh rate, we can find it in datasheet, for APMemory it is the parameter tCEM(CE# low pulse width), for my memory it has the value 4µs. --> See picture below.

FLuba1_0-1700177536063.png

Refresh rate for the Hyperbus Cypress memory(infineon): look at the parameter "HyperRAM Chip Select Maximum Low Time - Industrial Temperature" = tCSM = 4.00 µs --> see picture below

FLuba1_1-1700177788641.png

 

ChahinezC
Technical Moderator
March 14, 2023

I recommend you checking the Table 7. STM32CubeMX - Configuration of OCTOSPI parameters of the "6.2.4 OCTOSPI configuration and parameter settings" section of the AN5050. It will certainly help you understand the parameters configuration and how to set them.

Regards,

Chahinez.

JJuli.1
JJuli.1Author
Associate II
March 14, 2023

thank you for your help i will check the table

I have one more question, when to use the hyperbus instead of the regular one?

ChahinezC
Technical Moderator
March 14, 2023

Hello @JJuli.1​,

The OctoSPI interface can operate in two different low-level protocols: Regular-command and HyperBus. 

When in Regular-command protocol, the OCTOSPI communicates with the external device using commands. Each command can include the following phases:

  • Instruction phase
  • Address phase
  • Alternate-byte phase
  • Dummy-cycle phase
  • Data phase

The HyperBus protocol enables the communication with HyperRAM and HyperFlash memories and the frame is composed of the following phases:

  • Command/address phase
  • Data phase

For any further inquires, I suggest you open another thread. It will help us and the other users of the community assist you with your issue.

It will also be helpful for others to find the answer faster if they have a similar issue/question.

Thank you.

Chahinez.

Senior
November 16, 2023

For my externa flash memory MX25L12833FMI-10G

Chip Select high time--->in datasheet of external flash memory: look for "deselect time after a non READ command"(tSHSL or tCSH): for my memory it's 30 ns. See picture below.
Example:  fclk = 104Mhz = 9.62ns , prescaller = 1, what's the chip select high time?
Chip select high time: 30 ns/1*104Mhz = 3.12-->4.

FLuba1_2-1700178674715.png

For my external ram memory APS6408L-3OBM-BA_PSRAM

Chip select high time is : 2

Look at the parameter "tCPH =CE# HIGH between subsequent burst operations = 18 ns" to calculate this.
Example:  fclk = 104Mhz = 9.62ns , prescaller = 1, what's the chip select high time?
Chip select high time: 18 ns/1*104Mhz = 1.87-->2.

FLuba1_3-1700179078435.png