Skip to main content
Graduate
February 15, 2025
Solved

How to disable XSPI SCK Clock preamble?

  • February 15, 2025
  • 2 replies
  • 743 views

Good day Folks,

I am hoping you are able to shed some light on this odd XSPI clock behaviour.  I have connected XSPI2 to a W25Q64 Flash in QSPI mode.

There are 'preamble' clocks present prior to the NCS being asserted. I've noticed that the number of preamble clocks depends on the frequency of the bus. The least I have seen is 150 clocks. As you can see below it's 641 clocks, prior to the NCS falling.

exarian_0-1739629846858.png

I am guessing the clock is used internal by the XSPI peripheral, however the 'noise' on the bus certainly is undesirable.

This prevents me from using a NCS other than the dedicated NCS pin. Other than that it looks like it creates additional delays in the XSPI transaction, with the reads maxing out about every 30us.

exarian_1-1739630051967.png

This is with a XSPI read being done in a while(1) loop.

exarian_2-1739630122997.png

The data is being correctly read when the NCS is low, expected Byte of 0x16:

exarian_3-1739630235507.png

When the SCK preamble clocks are present I can see the data lines (e.g. IO0 below) go high impedance and rise to the external pullup, until the NCS is asserted.

exarian_4-1739630623903.png

If you are able to advise on a solution to hide these preamble clocks, it would be great!

I'm assuming that they are also contributing to additional Delays in the successive XSPI reads. 

I've attached a super simple project with a XSPI Read in the while(1).

 

Kindest regards

    This topic has been closed for replies.
    Best answer by RomainR.

    Hello @exarian 

    The clock cycles SCK that you observe before the memory access phase (when NCS1 is low) correspond to the automatic calibration phase of the high-speed interface. There is a description in RM0486 Rev2, in section 28.4.19 XSPI high-speed interface and calibration. This is automatic and occurs in the following three cases:

    • The XSPI exits reset state.
    • A value is written in PRESCALER[7:0] of XSPI_DCR2.
    • A value is written in XSPI_CCR.

    So if you change the prescaler value between HCLK and XSPI, it is normal that you observe a varying number of clock cycles. This calibration is transparent to the user as it occurs only once (if you do not change the prescaler with XSPI_DCR2) and you cannot disable it.
    Best regards

    Romain,

    2 replies

    RomainR.Answer
    ST Employee
    February 17, 2025

    Hello @exarian 

    The clock cycles SCK that you observe before the memory access phase (when NCS1 is low) correspond to the automatic calibration phase of the high-speed interface. There is a description in RM0486 Rev2, in section 28.4.19 XSPI high-speed interface and calibration. This is automatic and occurs in the following three cases:

    • The XSPI exits reset state.
    • A value is written in PRESCALER[7:0] of XSPI_DCR2.
    • A value is written in XSPI_CCR.

    So if you change the prescaler value between HCLK and XSPI, it is normal that you observe a varying number of clock cycles. This calibration is transparent to the user as it occurs only once (if you do not change the prescaler with XSPI_DCR2) and you cannot disable it.
    Best regards

    Romain,

    exarianAuthor
    Graduate
    February 17, 2025

    Thank you @RomainR.