GD32W51x User Manual
714
21.3.5.
SQPI controller output clock configuration
SQPI clock period is configured by CLKDIV bits(SQPI_INIT register). The frequency formula
of SQPI_CLK is:
𝑓
𝑠𝑞𝑝𝑖_𝑐𝑙𝑘
=
𝑓
ℎ𝑐𝑙𝑘
𝐶𝐿𝐾𝐷𝐼𝑉 + 1
Note: CLKDIV cannot be 0. When CLKDIV field is even number, the output clock high level
time has 1 HCLK period more than low level time. After the rise edge of SQPI_CSN there is
1 HCLK period clock to on SQPI_CLK signal to support some old PSRAM memory.
Figure 21-4.
SQPI_CLK Example
SQPI_CLK
SQPI_CSN
1 HCLK
21.3.6.
SQPI controller initialization
In the beginning, users should program the initialization register SQPI_INIT. Data sampling
clock edge is selected via the PL bit, read device ID length could be configured by the IDLEN
bits, address bit number is controlled by the ADDRBIT, command bit number is set by
CMDBIT, and the SQPI controller clock is configured by CLKDIV bits.
21.3.7.
Read ID command flow
The first, user should configure RCMD bits by Read ID command (e.g. 0x9F for SQPIPSRAM)
and read waitcycle number in SQPI_RCMD register. The second user sets RID bit to 1 and
wait it reset to 0. The third, user can get ID value by read SQPI_IDL and SQPI_IDH registers.
21.3.8.
Read/Write operation flow
Six modes of memory access are possible. Access mode should be configured before
read/write operations. Read/Write command mode is programmed by the RMODE and
WMODE, wait cycle is controlled by the RWAITCYCLE and WWAITCYCLE bit, and the
specific memory operating command should be programmed in RCMD and WCMD bit, these
read/write settings are located in SQPI_RCMD and SQPI_WCMD registers respectively.
After memory access mode configuration, user can directly access external device as SRAM
by using SQPI memory logic address.
21.3.9.
SQPI controller mode timing
SQPI controller mode timing for read/write operation, each AHB read/write access to SQPI
memory logic address will transfer to one of below timing: