Skip to main content
Arnon
Associate III
July 14, 2020
Question

QSPI - Clock starts before chip select is set

  • July 14, 2020
  • 1 reply
  • 2637 views

0693W000001srG4QAI.jpgHi

I am using the QSPI to interface FPGA.

The setup includes STM32F769I-EVAL board wired to MAX10 evaluation board.

The QSPI is configured to indirect mode, data phase only. I was able to read data from the FPGA, control clock speed and set number of bytes to be read each time.

Among other issues, the problem I am facing is that sometime the clock would start while the Chip select is still high!

As the FPGA output a known pattern, it is clear that the CPU actually sample the data before the CS goes low.

The HAL_QSPI_Receive_DMA() function is used to trigger read, meaning that there is no control over the CS vs clock timing.

CCR register is 0x07000000 (Indirect read mode, data on 4 lines)

CR register is 0x40000f05:  DMA and interface enabled plus clock Prescalar and FiFo threshold configuration.

is this a known bug? There is nothing in errata sheet regarding indirect mode.

the attached pic- C1(yellow) is CS, while C2(purple) is clock. Both are CPU controlled.

*if anyone here consider using the QSPI as a simple quad SPI, do yourself a favor and reconsider…

This topic has been closed for replies.

1 reply

Andreas Bolsch
Lead III
July 14, 2020

You're totally right, there are indeed some pitfalls regarding the QSPI. But to be fair: The RM *explicitly* says it is intended for interfacing to serial flash ("The QUADSPI is a specialized communication interface targeting single, dual or quad SPI Flash memories.") as does the datasheet, and for this purpose, it works quite well. No promises for anything else. In particular, flash memory devices don't care about clock and data lines as long as they're not selected, so the problem you're facing is simply a don't care for serial flash.

Arnon
ArnonAuthor
Associate III
July 14, 2020

thanks @Andreas Bolsch​

"... flash memory devices don't care about clock and data lines as long as they're not selected" that's exactly my point - the CPU FW "thinks" X bytes are read while in reality, because the device is not selected, only X-1 bytes are read. the missing byte will be zeros or what ever the device outputs when its not selected.

Andreas Bolsch
Lead III
July 15, 2020

Ah, so the problem is not literally early start of clock, but missing clock cycles during CS being active?! You might try to add some dummy cycles before data phase. Of course, this means you have to adapt the FPGA design accordingly ...

The RM says "In order to assure enough 'turn-around' time for changing the data signals from output mode to input mode, there must be at least one dummy cycle when using dual or quad mode to receive data from the Flash memory." Although you don't have instruction nor address phase, it's quite possible this requirement is inherently used in the internal design of the QSPI.