cancel
Showing results for 
Search instead for 
Did you mean: 

using Dual-Quad-SPI with OCTOSPI in STM32H5xx

shii
Associate II

Hi,

I have been trying to connect PSRAM and NOR FLASH to STM32H563 nucleo board using Dual-Quad-SPI.

I was able to successfully read/write to PSRAM and NOR Flash individually in single-Quad-SPI mode with base address 0x90000000. i'm not clear how the addressing is taken care, when we connect both PSRAM and NOR Flash in dual-Quad-SPI mode.

20 REPLIES 20

Dual in ST parlance typically means two identical devices side by side

Different devices? Perhaps if you don't use the concurrently, and you can mux/swap the chip select?

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

Hello @shii and welcome to the Community 🙂,

When DMM = 1 in OCTOSPI_CR, the OCTOSPI is in dual-memory configuration: if DMODE = 011, two external Quad-SPI devices (device A and device B) are used in order to send/receive eight bits (or 16 bits in DTR mode) every cycle, effectively doubling the throughput.

If address X is even, then the byte that the OCTOSPI gives for address X is the byte at the address X/2 of device A, and the byte that the OCTOSPI gives for address X + 1 is the byte at the address X/2 of device B. In other words, the bytes at even addresses are all stored in device A and the bytes at odd addresses are all stored in device B.

Thanks to alternate function, you can connect a PSRAM and NOR Flash memories using one OCTOSPI interface. So, you can use different GPIOs to mange the chips select and the clock.  The software should configure the chips select and the clock for the memory to be accessed.

For more information about the Dual-quad configuration, I advise you to refer to RM0481 "Dual-quad configuration" par graph under "23.4.5 OCTOSPI regular-command protocol signal interface" section and Figure 141 OCTOSPI block diagram in dual-quad configuration.

I hope this answer your request.

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.

LCE
Principal

RAM + Flash in dual quad mode does not make sense at all - except when you MUX them as you seemingly already did.

Playing with fire anyway...

In Dual-memory configuration, the bytes at even addresses are all stored in device A and the bytes at odd addresses are all stored in device B. We dont want to store like this as we are connecting FLASH and RAM different devices. If we use single-memory configuration and try to switch between Device A and Device B using MSEL bit, how that memory mapped mode addressing will work? for example, if Device A address is mapped with 0x90000000 means what will be the address mapping for Device B?

We are not going to use concurrently. Either one the of the devices will be accessed at a time. How do we mux/swap the chip select between two devices?

Should be an IOSelect or FlashID type settings. Physically would need different NCS pins.

As I've said before "Dual" means two identical devices ganged side to side.

Diagram what pins you have wired up. Certainly possible to wire things up that won't work...

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

Two different NCS pins means, do i need to configure two GPIO pins as outputs and connect with chip select pins of FLASH and RAM accordingly and have to control the chip select in software?

Hello @Nagarajan ,

To clarify my last comment, for dual quad mode, both devices must be identical, because in this mode the same commands and addresses are issued in parallel to both memories.

When DMM = 1, the bytes at even addresses are all stored in device A and the bytes at odd addresses are all stored in device B, as detailed in  RM0481 "Dual-quad configuration" section.

But it is possible to connect 2xQuadSPI memories using only one OCTOSPI instance.

There are 2 possible solutions:

  • Use a dedicated bit in OCTOSPI_CR register for external memory selection: MSEL bit  for STM32H5: The idea is to select the external memory to be addressed in single-, dual-, quad-SPI mode in single-memory configuration (when DMM = 0).
    MSEL 
    0: External memory 1 selected (data exchanged over IO[3:0])
    1: External memory 2 selected (data exchanged over IO[7:4])
    This bit is ignored when DMM = 1 or when octal-SPI mode is selected.
    DMM: Dual-memory configuration bit in OCTOSPI_CR register. This bit activates the dual-memory configuration, where two external devices are used simultaneously to double the throughput and the capacity.
  • Use different chip select GPIO pins for each memory.  The two memories must be connected to the same OCTOSPI instance, then the chip select of each memory must be connected to an OCTOSPI chip select GPIO port (for STM32H573 MCU, the OCTOSPI1_NCS must be connected to PB6 and PB10) as shown in the below figure. With STM32H573 MCU, and when transferring data to Quad-SPI memory1, it is recommended to set the Quad-SPI memory2 chip select (PB10) to high voltage by using a pull-up resistor for example.KDJEM1_0-1719483765900.png

     

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.

See @KDJEM.1 post below

I think one could also multiplex the AF settings for the NCS / CLK functionality to support multiple devices.

Some of the H5 have a single OCTOSPI, I think it is not well setup for FLASH and RAM operation 

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