cancel
Showing results for 
Search instead for 
Did you mean: 

Configuration of OCTOSPI

rsun.11
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

9 REPLIES 9
Andreas Bolsch
Lead II

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.

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 Venmo
Up vote any posts that you find helpful, it shows what's working..
rsun.11
Associate II

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

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

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

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.

"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.", for my flash-IS25LP064A, I think I should set MTYP to 010, do you think so?

0693W00000WK9rCQAT.jpg2.For "DEVSIZE", when my flash size is 8MB, I should set this parameter to 23, right?

Do you have any actual experience with this peripheral?

3.Do you have a OCTOSPI Project demo? or Contact information, such as teams or skyper? so we can communicate with my issue.

  1. As far as I understand, 010 and 011 are both RAM modes, but like 000 and 001 only different regarding byte order in DTR mode. As I've used only flash / EEPROMs devices up to know, I can't say anything regarding these modes. For all devices I've used so far, mode 000 works.
  2. Yes 23 or 0x17. If you use 22, an attempted access to the last few bytes in this bank may lead to an irrecoverable stall of the whole MCU, only a system reset (or maybe an OctoSPI reset via RCC) will clear that. Learned this the hard way ... At https://review.openocd.org/c/openocd/+/4321 there are some sample configurations of OctoSPI (and QuadSPI) for a bunch of different flash chips (see patchset 8), e.g. nucleo-h7a3zi with two W25Q256.
  3. Demo project is as above, although it's intended only for flashing, the necessary setup is shown there.

Hello @rsun.1​,

Adding to all the contributors' comments, and for the frequencies presented in the Table 2 of the AN5050:

  • Max OCTOSPI speed represents the OCTOSPI interface frequency that should be respected when using the interface, you can refer to the product used datasheet
  • Max bus frequency access represents the bus frequency, as the OCTOSPI is an AHB/AXI slave mapped on a dedicated AHB/AXI layer. It does affect the performance of the whole application system speed.

Regards,

Chahinez.