8.3.9 Circular mode
The circular mode มีให้ใช้งานเพื่อจัดการ circular buffers และการไหลของดาต้าอย่างต่อเนื่อง (ตัวอย่างเช่น ADC scan mode). คุณลักษณะนี้สามารถถูกเปิดใช้งานโดยใช้ the CIRC bit ใน the DMA_SxCR register.
เมื่อ the circular mode ถูกทำให้ทำงาน, จำนวนของ data items ที่จะถูกส่งถ่ายจะถูกโหลดใหม่โดยอัตโนมัติด้วย the initial value ที่โปรแกรมในระหว่าง the stream configuration phase, และ the DMA requests ต่อเนื่องที่จะให้บริการ.
Note: ใน the circular mode, จำเป็นต้องปฏิบัติตามกฎต่อไปนี้ ในกรณีของ a burst mode ที่กำหนดค่าสำหรับ memory:
DMA_SxNDTR = ผลคูรของ ((Mburst beat) × (Msize)/(Psize)), โดยที่:
– (Mburst beat) = 4, 8 or 16 (ขึ้นอยู่กับ the MBURST bits ใน the DMA_SxCR register)
– ((Msize)/(Psize)) = 1, 2, 4, 1/2 or 1/4 (Msize and Psize แทน the MSIZE and PSIZE bits ใน
the DMA_SxCR register. พวกมันเป็น byte dependent)
– DMA_SxNDTR = จำนวนของ data items ที่จะส่งถ่ายบน the AHB peripheral port
ตัวอย่างเช่น: Mburst beat = 8 (INCR8), MSIZE = ‘00’ (byte) and PSIZE = ‘01’ (half-word), ในกรณีนี้:
DMA_SxNDTR ต้องเป็นผลคุณของ (8 × 1/2 = 4).
ถ้าสูตรนี้ไม่ถูกปฏิบัติตาม, the DMA behavior และ data integrity จะไม่ถูกรับประกัน.
NDTR ต้องเป็นผลคุณของ the Peripheral burst size ที่คูณโดย the peripheral data size, มิฉะนั้น อาจส่งผลให้เกิด a bad
DMA behavior