2024-01-18 08:04 PM
Dear STM32 team,
I am a bit confused about the OCTALSPI device (using it as QuadSPI):
Why is it not possible (not supported) to use OCTALSPI also as a regular SPI?
Datasheet states that "Single-SPI" is possible - but it means actually: "Single-Lane-SPI": still in half-duplex mode (not possible to send and receive at the same time). Not regular SPI!
BTW:
It would be "cool" if the pin assignments (and ALT functions) would allow to use some QSPI signals also as regular (full-duplex) SPI signals. Why we, for instance, this mapping?
OCTALSPI1_NCS = SPI1_NS - nice: matching
OCTALSPI1_IO3 = SPI1_MISO - bad: map it to OCTALSPI1_IO1 - mismatching
OCTALSPI1_IO2 = SPI1_MOSI - bad: map it to OCTALSPI1_IO0 - mismatrching
and the SCK signal is on different pins: mismatching
It is obvious for me, why OCTALSPI cannot work as "regular" SPI:
It is NOT possible to configure an indirect read plus an indirect write at the same time (even the DIO1 signal turns properly to an input, but it does not receive at the same time when we send).
The OCTALSPI_CR register does not allow both operations enabled (WR and RD are exclusive). So, it remains half-duplex (RD or WR, but never both).
Other issues seen on OCTALSPI (as QSPI):
My suggestions for future versions of the STM32U5xx chip:
===== Here the trick how to solve with external PCB routing =========
I need SPI vs. QSPI on the same pins (no need to change an external adapter, an external chip wiring...).
Options:
So,
to have a shared QSPI with a regular SPI without to rewire pins - works only with some external "tricks" (components or wiring).
Solved! Go to Solution.
2024-01-20 01:25 PM
Due to "fact" that OCTOSPI is always a half-duplex device (even in single-SPI mode, better to call it "single-lane-SPI" - it is not a "regular full-duplex SPI" - here two HW options.
Intention: the OCTOSPI (used as QuadSPI) should reuse the same pins and signals to work also as a regular (full-duplex) SPI. So, I want to have:
Solution:
You lose two GPIO pins. Depending on the option - you lose entire SPI3 (option B).
With option A - the SPI1 remains available as a full regular SPI - just on different pins (with a different ALT setting).
Option A needs external components (tri-state drivers) and also some SW constraints:
Option B is easier, does not need external active components and is free of conflicts (SPI3 is always "listener", input). You just lose SPI3 as a regular SPI device.
Run OCTOSPI as master Tx and SPI as slave Rx in parallel (e.g. in INT mode or DMA mode, at least one device).
I go with option B.
2024-01-19 08:39 AM - edited 2024-02-15 11:31 PM
Hello @tjaekel ,
For the first issue, I advise you to take a look to this How to configure Octospi as a normal Spi interface (Not interfacing with external memory devices)? and RM0456 28.4.4 OCTOSPI regular-command protocol Section.
To check the second issue "Just a DATA phase is not possible!You need at least a INSTR phase(one byte)" , which STM32U5 are you using? STM32U575 or STM32U5A9...?
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.
2024-01-19 09:30 AM
I use STM32U5A5.
Yes, all what I have mentioned was after a deep digest of the RM.
At least a INST phase needed: as cited already from RM:
"Any of these phases can be configured to be skipped but, in case of single-phase
command, the only use case supported is instruction-phase-only." (28.4.4, page 1046).
Regarding "Single-Lane-SPI" (not "regular SPI), see register 28.7.1 OCTOSPI control register (OCTOSPI_CR), page 1070:
Bits 29:28 FMODE[1:0]: Functional mode
This bitfield defines the OCTOSPI functional mode of operation.
00: Indirect-write mode
01: Indirect-read mode
So, it is not possible to do a WRITE and a READ at the same time.
We can use OCTALSPI in single-lane half-duplex SPI mode, but not in full-duplex mode (as a regular SPI would do). Single-SPI means: Single-Lane-SPI.
2024-01-20 01:25 PM
Due to "fact" that OCTOSPI is always a half-duplex device (even in single-SPI mode, better to call it "single-lane-SPI" - it is not a "regular full-duplex SPI" - here two HW options.
Intention: the OCTOSPI (used as QuadSPI) should reuse the same pins and signals to work also as a regular (full-duplex) SPI. So, I want to have:
Solution:
You lose two GPIO pins. Depending on the option - you lose entire SPI3 (option B).
With option A - the SPI1 remains available as a full regular SPI - just on different pins (with a different ALT setting).
Option A needs external components (tri-state drivers) and also some SW constraints:
Option B is easier, does not need external active components and is free of conflicts (SPI3 is always "listener", input). You just lose SPI3 as a regular SPI device.
Run OCTOSPI as master Tx and SPI as slave Rx in parallel (e.g. in INT mode or DMA mode, at least one device).
I go with option B.
2024-02-15 08:53 PM
Using OCTOSPI as "regular SPI" has a caviat:
OCTOSPI is always "MSB first" - no way to configure "LSB first" (as we can do on "regular" SPI.
So, OCTOSPI (or QSPI) is "just" a "half-duplex" SPI on "single lane" (not a "regular" SPI as all other SPIx).
2024-02-15 11:50 PM
Hi @tjaekel ,
OctoSPI does not support full-duplex, only half-duplex is supported.
Note that both OctoSPI and QuadSPI work only as a master.
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.