STM32F7 14 Quad-SPI interface (QUADSPI)

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

Previous topic - Next topic

tha

Status flag polling mode

The status flag polling mode ถูกเปิดใช้งานโดยการเซ็ต the FMODE field (QUADSPI_CCR[27:26]) เป็น 10. ในโหมดนี้, the programmed frame จะถูกส่งและ the data จะถูกดึงเป็นระยะๆ.

จำนวนสูงสุดของ data ที่อ่านในแต่ละ frame คือ 4 bytes. ถ้า data ที่มากกว่านี้ถูกร้องขอใน QUADSPI_DLR, มันจะถูดเพิกเฉยและเฉพาะ 4 bytes จะถูกอ่าน.

The periodicity ถูกระบุใน the QUADSPI_PISR register.

ทันทีที่ the status data ถูกดึงแล้ว, มันสามารถถูกประมวลผลภายในเพื่อ:
•   เซ็ต the status match flag และสร้าง an interrupt ถ้าถูกเปิดใช้งาน
•   หยุดโดยอัตโนมัติการดึงเป็นระยะๆของ the status bytes

The received value สามรถถูกบังด้วย the value ที่เก็บใน the QUADSPI_PSMKR และถูก OR หรือถูก AND ด้วย the value ที่เก็บใน the QUADSPI_PSMAR.

ในกรณีของคู่ที่เหมือนกัน, the status match flag จะถูกเซ็ตและ an interrupt จะถูกสร้างถ้าเปิดใช้งาน, และ the QUADSPI สามารถถูกหยุดโดยอัตโนมัติถ้า the AMPS bit ถูกเซ็ต.

ในกรณีใดๆ, the latest retrieved value จะมีให้ใช้ประโยชน์ใน the QUADSPI_DR.

tha

Memory-mapped mode

ใน memory-mapped mode, the external Flash memory จะถูกมองเป็น internal memory แต่มีเวลาแฝงในระหว่าง accesses. เฉพาะ read operations ถูกอนุญาตให้กับ the external Flash memory ในโหมดนี้.

Memory-mapped mode ถูกเข้าสู่โดยการเซ็ต the FMODE เป็น 11 ใน the QUADSPI_CCR register.

The programmed instruction และ frame จะถูกส่งเมื่อ a master กำลังเข้าถึง the memory mapped space.

The FIFO ถูกใช้เป็น a prefetch buffer เพื่อคาดการณ์ linear reads. การเข้าถึงใดๆไปยัง QUADSPI_DR ในโหมดนี้จะส่งคืนกลับศูนย์.

The data length register (QUADSPI_DLR) ไม่มีความหมายใน memory-mapped mode.

tha

14.3.12 Sending the instruction only once

บาง Flash memories (อย่างเช่น Winbound) อาจจัดให้มี a mode โดยที่ an instruction ต้องถูกส่งเฉพาะกับ the first command sequence, ในขณะที่ subsequent commands สตาร์ทโดยตรงกับ the address. เราสามารถใช้ประโยชน์จากคุณสมบัติดังกล่าวได้โดยใช้ the SIOO bit (QUADSPI_CCR[28]).

SIOO ใช้ได้สำหรับทุก functional modes (indirect, automatic polling, and memory-mapped). ถ้า the SIOO bit ถูกเซ็ต, the instruction จะถูกส่งเฉพาะสำหรับ the first command ที่ตาม a write ไปยัง QUADSPI_CCR. Subsequent command sequences จะข้าม the instruction phase, จนกว่าจะมีเขียนถึง QUADSPI_CCR.

SIOO จะไม่มีผลอะไรเมื่อ IMODE = 00 (ไม่มี instruction).


tha

14.3.13 QUADSPI error management

An error สามารถถูกสร้างในกรณีต่อไปนี้:
•   ใน indirect mode หรือ status flag polling mode เมื่อ a wrong address ถูกโปรแกรมแล้วใน the QUADSPI_AR (สอดคล้อง
     กับ the Flash memory size ที่กำหนดโดย FSIZE[4:0] ใน the QUADSPI_DCR): นี้จะเซ็ต the TEF และ an interrupt จะถูก
     สร้างถ้าถูกเปิดใช้งาน.
•   นอกจากนี้ใน indirect mode, ถ้า the address บวกกับ the data length เกิน the Flash memory size, TEF จะถูกเซ็ตทันทีที่
     the access ถูกทริก.
•   ใน memory-mapped mode, เมื่อการเข้าถึงนอกย่านถูกทำโดย a master หรือเมื่อ the QUADSPI ถูกปิดใช้งาน: นี้จะสร้าง a bus
     error เป็นการตอบสนองต่อ the faulty bus master request.
•   เมื่อ a master กำลังเข้าถึง the memory mapped space ในขณะที่ the memory mapped mode ถูกปิดใช้งาน: นี้จะสร้าง a
     bus error เป็นการตอบสนองต่อ the faulty bus master request.

tha

14.3.14 QUADSPI busy bit and abort functionality

ทันทีที่ the QUADSPI สตาร์ท an operation กับ the Flash memory, the BUSY bit จะถูกเซ็ตโดยอัตโนมัติใน the QUADSPI_SR.

ใน indirect mode, the BUSY bit จะถูกรีเซ็ตทันทีที่ the QUADSPI ได้เสร็จสิ้น the requested command sequence และ the FIFO ว่างเปล่า.

ใน automatic-polling mode, BUSY ไปเป็น low เฉพาะหลังจาก the last periodic access เสร็จสมบูรณ์, เนื่องจาก a match(คู่ที่เหมือนกัน) เมื่อ APMS = 1, หรือเนื่องจาก an abort.

หลังจาก the first access ใน memory-mapped mode, BUSY ไปเป็น low เฉพาะบน a timeout event หรือบน an abort.

operation ใดๆสามารถถูกยกเลิกได้โดยการเซ็ต the ABORT bit ใน the QUADSPI_CR. ทันทีที่ the abort เสร็จสมบูรณ์, the BUSY bit and the ABORT bit จะถูกรีเซ็ตโดยอัตโนมัติ, and the FIFO จะถูกล้าง.

Note:  บาง Flash memories อาจทำงานผิดปกติถ้า a write operation ไปยัง a status registers ถูกยกเลิก.

tha

14.3.15 nCS behavior

โดยค่าเริ่มต้น, nCS เป็น high, จะถอนการเลือก the external Flash memory. nCS จะตกก่อนการทำงานเริ่มและจะพุ่งขึ้นทันทีที่มันเสร็จงาน.

เมื่อ CKMODE = 0 ("mode0", โดยที่ CLK อยู่ low เมื่อไม่มี operation กำลังดำเนินการอยู่) nCS จะตก one CLK cycle ก่อน an operation first rising CLK edge, และ nCS จะพุ่งขึ้น one CLK cycle หลังจาก the operation final rising CLK edge, ดังแสดงใน Figure 66.


tha

เมื่อ CKMODE=1 ("mode3", โดยที่ CLK ไปเป็น high เมื่อไม่มี operation กำลังดำเนินการอยู่) และ DDRM=0 (SDR mode), nCS ยังคงตก one CLK cycle ก่อน an operation first rising CLK edge, และ nCS จะพุ่งขึ้น one CLK cycle หลังจาก the operation final rising CLK edge, ดังแสดงใน Figure 67.


tha

เมื่อ CKMODE = 1 ("mode3") และ DDRM = 1 (DDR mode), nCS จะตก one CLK cycle ก่อน an operation first rising CLK edge, และ nCS จะพุ่งขึ้น one CLK cycle หลังจาก the operation final active rising CLK edge, ดังแสดงใน Figure 68. เนื่องจาก DDR operations ต้องเสร็จงานด้วย a falling edge, CLK จะเป็น low เมื่อ nCS พุ่งขึ้น, and CLK จะพุ่งขึ้นค้ำชูครึ่งหนึ่งของ a CLK cycle หลังจากนั้น.