STM32F7 14 Quad-SPI interface (QUADSPI)

Started by tha, November 22, 2022, 02:04:44 PM

Previous topic - Next topic

tha

14 Quad-SPI interface (QUADSPI)

14.1 Introduction

The QUADSPI คือ a specialized communication อินเตอร์เฟสเป้าหมาย single, dual หรือ quad SPI Flash memories. มันสามารถทำงานหนึ่่งใน the three following modes:
•   indirect mode: ทุก the operations ถูกดำเนินการโดยใช้ the QUADSPI registers
•   status polling mode: the external Flash memory status register จะถูกอ่านเป็นระยะๆและ an interrupt สามารถถูกสร้างใน
     กรณีที่มีการเซ็ต flag
•   memory-mapped mode: the external Flash memory ถูกแม็ปเข้ากับ the microcontroller address space และถูกมอง
     โดย the system ราวกับว่ามันเป็น an internal memory

ทั้งปริมาณงานและความจุสามารถถูกเพิ่มขึ้นเป็นสองเท่าโดยใช้ dual-flash mode, โดยที่ two Quad-SPI Flash memories ถูกเข้าถึงพร้อมกัน.

tha

14.2 QUADSPI main features

•   Three functional modes: indirect, status-polling, and memory-mapped
•   Dual-flash mode, โดยที่ 8 bits สามารถถูกส่ง/รับพร้อมกันโดยการเข้าถึง two Flash memories ขนานกันไป.
•   SDR and DDR support
•   Fully programmable opcode สำหรับทั้ง indirect and memory mapped mode
•   Fully programmable frame format สำหรับทั้ง indirect and memory mapped mode
•   Integrated FIFO สำหรับ reception and transmission
•   8, 16, and 32-bit data accesses ถูกอนุญาต
•   DMA channel สำหรับ indirect mode operations
•   Interrupt generation บน FIFO threshold, timeout, operation เสร็จสิ้น, และ access error

tha

14.3 QUADSPI functional description

14.3.1 QUADSPI block diagram






tha

14.3.2 QUADSPI pins

Table 90 แสดงรายการ the QUADSPI pins, หกสำหรับการอินเตอร์เฟสกับ a single Flash memory, หรือ 10 ถึง 11 สำหรับการอินเตอร์เฟสกับ two Flash memories (FLASH 1 and FLASH 2) ใน dual-flash mode.



tha

14.3.3 QUADSPI command sequence

The QUADSPI สื่อสารกับ the Flash memory โดยใช้ commands. แต่ละ command สามารถประกอบด้วย 5 phases: instruction, address, alternate byte, dummy, data. ใดๆของ phases เหล่านี้สามารถถูกกำหนดค่าเพื่อที่จะถูกข้าม, แต่อย่างน้อยหนึ่งของ the instruction, address, alternate byte, หรือ data phase ต้องมีอยู่.

nCS จะตกก่อนการสตาร์ทของแต่ละ command และพุ่งขึ้นอีกครั้งหลังจากแต่ละ command เสร็จสิ้น.


tha

Instruction phase

ในระหว่าง phase นี้, an 8-bit instruction, ที่กำหนดค่าใน INSTRUCTION field ของ QUADSPI_CCR[7:0] register, จะถูกส่งไปยัง the Flash memory, ระบุประเภทของการทำงานที่จะถูกดำเนินการ.

แม้ว่า Flash memories ส่วนใหญ่สามารถรับ instructions หนึ่งบิตในแต่ละครั้งจาก the IO0/SO signal (single SPI mode), the instruction phase สามารถมีทางเลือกส่ง 2 bits ในแต่ละครั้ง (บน IO0/IO1 ใน dual SPI mode) หรือ 4 bits ในแต่ละครั้ง (บน IO0/IO1/IO2/IO3 ใน quad SPI mode). นี้สามารถถูกกำหนดค่าโดยใช้ the IMODE[1:0] field ของ QUADSPI_CCR[9:8] register.

เมื่อ IMODE = 00, the instruction phase จะถูกข้าม, และ the command sequence จะสตาร์ทด้วย the address phase, ถ้ามีอยู่.

tha

Address phase

ใน the address phase, 1-4 bytes ถูกส่งไปยัง the Flash memory เพื่อระบุ the address of the operation. จำนวนของ address bytes ที่จะถูกส่งถูกกำหนดค่าใน the ADSIZE[1:0] field of QUADSPI_CCR[13:12] register. ใน indirect and automatic-polling modes, the address bytes ที่จะถูกส่งถูกระบุใน the ADDRESS[31:0] field of QUADSPI_AR register, ในขณะที่ใน memory-mapped mode the address ถูกให้โดยตรงโดยทาง the AHB (จาก the Cortex® หรือจาก a DMA).

The address phase สามารถส่ง 1 bit ในแต่ละครั้ง (บน SO ใน single SPI mode), 2 bits ในแต่ละครั้ง(บน IO0/IO1 ใน dual SPI mode), หรือ 4 bits ในแต่ละครั้ง (บน IO0/IO1/IO2/IO3 ใน quad SPI mode). นี้สามารถถูกกำหนดค่าโดยใช้ the ADMODE[1:0] field of QUADSPI_CCR[11:10] register.

เมื่อ ADMODE = 00, the address phase จะถูกข้าม, และ the command sequence จะดำเนินการต่อโดยตรงไปยังเฟสถัดไป ถ้ามี

tha

Alternate-bytes phase

ใน the alternate-bytes phase, 1-4 bytes จะถูกส่งไปยัง the Flash memory, โดยทั่วไปเพื่อควบคุม the mode of operation. จำนวนของ alternate bytes ที่จะถูกส่งถูกกำหนดค่าใน the ABSIZE[1:0] field of QUADSPI_CCR[17:16] register. The bytes ที่จะถูกส่งถูกระบุใน the QUADSPI_ABR register.

The alternate-bytes phase สามารถส่ง 1 bit ในแต่ละครั้ง (บน SO ใน single SPI mode), 2 bits ในแต่ละครั้ง (บน IO0/IO1 ใน dual SPI mode), หรือ 4 bits ในแต่ละครั้ง (บน IO0/IO1/IO2/IO3 ใน quad SPI mode). นี้สามารถถูกกำหนดค่าโดยใช้ the ABMODE[1:0] field of QUADSPI_CCR[15:14] register.

เมื่อ ABMODE = 00, the alternate-bytes phase จะถูกข้าม, และ the command sequence จะดำเนินการต่อโดยตรงไปยังเฟสถัดไป ถ้ามี.

อาจมีบางครั้งที่เฉพาะ a single nibble จำเป็นต้องถูกส่งในระหว่าง the alternate-byte phase แทนที่จะเป็น a full byte, อย่างเช่นเมื่อ dual-mode ถูกใช้และมีเพียง two cycles ถูกใช้สำหรับ the alternate bytes. ในกรณีนี้, firmware สามารถใช้ quad-mode (ABMODE = 11) และส่ง a byte ที่มี bits 7 and 3 of ALTERNATE ถูกเซ็ตเป็น '1' (ทำให้ the IO3 line high), และ bits 6 and 2 ถูกเซ็ตเป็น '0' (ทำให้ the IO2 line low). ในกรณีนี้ the upper two bits ของ the nibble ที่จะถูกส่งถูกวางใน bits 4:3 ของ ALTERNATE ในขณะที่ the lower two bits จะถูกวางใน bits 1 and 0. ตัวอย่างเช่น, ถ้า the nibble 2 (0010) จะถูกส่งบน IO0/IO1, ดังนั้น ALTERNATE ควรถูกเซ็ตเป็น 0x8A (1000_1010).