Skip to main content
rsun.11
Associate II
December 3, 2022
Solved

Configuration of OCTOSPI

  • December 3, 2022
  • 3 replies
  • 5927 views

1.in the manual "AN5050", What's the meaning of "memory type"? Does this mean that OCTO only supports these four types of memory chips? The flash I used is "IS25LP064A", Does the OCTOSPI support this flash?

0693W00000WK9HTQA1.jpg2.How to set the "DEVSIZE"?

0693W00000WK9HsQAL.jpg0693W00000WK9I2QAL.jpg 

if the flash size is 8MByte, hospil.Init.DeviceSize=23 or 22? I don't know how to set the parameter.

This topic has been closed for replies.
Best answer by Andreas Bolsch

MTYP: See RM of your MCU, in particular OCTOSPI_DCR1.

DEVSIZE: no, as indicated above, 23 would be adviseable.

Clock: Well, take OCTOSPI kernel clock (as given by the clock tree and

OCTOSPISEL bit in RCC_D1CCIPR) and calculate the required divider to yield a clock below the flash's limit (50MHz in your case). If you're unsure (there are a lot of settings involved) check the resulting clock with a scope.

3 replies

Andreas Bolsch
Lead III
December 3, 2022

For SPI flash the memory type (macronix vs. micron) is relevant only in Octal-DTR mode, it affects the byte order within one clock cycle.

As your chip is only SPI or Quad-SPI, the setting of type (macronix/micron) doesn't matter, i.e. MTYP should be 000 or 001.

Regarding DEVSIZE: In theory 22 would be correct as 2^(22+1) gives 8 MBytes. But due to a silicon bug (see errata sheet), it's a good idea to choose a bigger value, so 23 would be a much safer choice.

rsun.11
rsun.11Author
Associate II
December 3, 2022

ok, thanks, what's the meaning of "MTYP", and how to set it to "000" or "001"?

According to your explanation, in my source code "hospil.Init.DeviceSize" should be 22, right?

another question is how to set the frequency of OCTOSPI? what's the difference between "Max

OCTOSPI speed (MHz)" and "Indirect mode"?0693W00000WK9NWQA1.jpgand according to my flash, how to set the OCTOSPI CLK correctly?

0693W00000WK9NbQAL.jpg

Andreas Bolsch
Andreas BolschBest answer
Lead III
December 3, 2022

MTYP: See RM of your MCU, in particular OCTOSPI_DCR1.

DEVSIZE: no, as indicated above, 23 would be adviseable.

Clock: Well, take OCTOSPI kernel clock (as given by the clock tree and

OCTOSPISEL bit in RCC_D1CCIPR) and calculate the required divider to yield a clock below the flash's limit (50MHz in your case). If you're unsure (there are a lot of settings involved) check the resulting clock with a scope.

Tesla DeLorean
Guru
December 3, 2022

The IS25LP064A should be workable.

These other "Type" relate how the signalling works/sequences, and which player its most like.

Winbond, ISSI, Infineon should all work

The size can be sensed by getting a Hard Fault once you get to the end, or the content appear to wrap.

I don't think ST has been consistent in the API vs register, and some of the H7 have some known errata up within the last 32-bytes, and caching.

Yeah the table/note are unhelpful.

2**23 = 8MB, DEVSIZE at the register 22, it's a 5-bit field

Walk the code to check what the API does in a given context, or look at Peripheral View post setup.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
rsun.11
rsun.11Author
Associate II
December 3, 2022

If I use IS25LP064A How to select in the selection list of memory type ?

rsun.11
rsun.11Author
Associate II
December 3, 2022

ok, thanks, what's the meaning of "MTYP", and how to set it to "000" or "001"?

According to your explanation, in my source code "hospil.Init.DeviceSize" should be 22, right?

another question is how to set the frequency of OCTOSPI? what's the difference between "Max

OCTOSPI speed (MHz)" and "Indirect mode"?0693W00000WK9NWQA1.jpgand according to my flash, how to set the OCTOSPI CLK correctly?

0693W00000WK9NbQAL.jpg