STM32U5xx: QSPI as regular SPI - not possible! - needs external tricks
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):
- Datasheet says something like this: "you can omit any phase, e.g. no INSTR, no ADDR, no ALT, no TURN-AROUND".
But it says also something as:
"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."
So, it means - and I can confirm:
Just a DATA phase is not possible! You need at least a INSTR phase (one byte) - When I do an indirect write transaction (and OCTALSPI is configured for it) - I cannot stop via breakpoint on debugger right in the loop when all the data is sent:
If the SFRs page is open at the same time, in order to see the OCTALSPI device registers:
the debugger dies, is disconnected and the GUI stops the debug session.
(maybe obvious, because the _DR register is used to write but debugger polls/reads it - this seems to confuse the chip/debug).
Not very nice behavior (making debugging difficult).
My suggestions for future versions of the STM32U5xx chip:
- remap the pin assignment so that the QSPI pins match with a regular SPI (e.g. SPI1 uses the same OCTALSPI pins as NCS, SCK, DIO0 = MOSI, DIO1 = MISO)
- consider if possible that during a write the OCTALSPI (in single-mode = single-lane-mode) samples also input on DIO1 (different or the same register, just to sample also the input when shifting out data)
- make it possible to debug the chip when OCTALSPI is in write mode but debugger wants to display the _DR content (reading the same register)
===== 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:
- have an external signal multiplexer and connect a SPI to the QSPI pins (cost effective)
- have traces (wires) connecting also a SPI, e.g. SPI1 on OCTALSPI1, pins - but use both in an exclusive way (acceptable options)
- Use the OCTALSPI as a SPI Master (it will send only), but connect another regular SPI as a slave: the OCTALSPI master provides MOSI, the SPI slave, connected on DIO1, provides the MISO.
Just:
Due to fact that OCTALSPI cannot generate just a DATA phase (without INSTR) - you have to send one byte as INSTR (but the SW/FW could handle that as sending the first data byte via the _IR register)
So,
to have a shared QSPI with a regular SPI without to rewire pins - works only with some external "tricks" (components or wiring).

