STM32F7 8 Direct memory access controller (DMA)

Started by tha, September 16, 2022, 09:00:56 AM

Previous topic - Next topic

tha

Bits 7:6 DIR[1:0]: data transfer direction
     บิตเหล่านี้ถูกเซ็ตและถูกเคลียร์โดย software.
     00: peripheral-to-memory
     01: memory-to-peripheral
     10: memory-to-memory
     11: reserved
     บิตเหล่านี้ถูกป้องกันและสามารถถูกเขียนเฉพาะถ้า EN เป็น '0'.

Bit 5 PFCTRL: peripheral flow controller
     บิตนี้ถูกเซ็ตและถูกเคลียร์โดย software.
     0: DMA เป็น the flow controller
     1: The peripheral เป็น the flow controller
     บิตนี้ถูกป้องกันและสามารถถูกเขียนเฉพาะถ้า EN เป็น '0'.
     เมื่อ the memory-to-memory mode ถูกเลือก (bits DIR[1:0]=10), จากนั้นบิตนี้จะถูกบังคับโดยอัตโนมัติไปเป็น 0 โดย
     hardware.

Bit 4 TCIE: transfer complete interrupt enable
     บิตนี้ถูกเซ็ตและถูกเคลียร์โดย software.
     0: TC interrupt ถูกปิดใช้งาน
     1: TC interrupt ถูกเปิดใช้งาน

Bit 3 HTIE: half transfer interrupt enable
     บิตนี้ถูกเซ็ตและถูกเคลียร์โดย software.
     0: HT interrupt ถูกปิดใช้งาน
     1: HT interrupt ถูกเปิดใช้งาน

Bit 2 TEIE: transfer error interrupt enable
     บิตนี้ถูกเซ็ตและถูกเคลียร์โดย software.
     0: TE interrupt ถูกปิดใช้งาน
     1: TE interrupt ถูกเปิดใช้งาน

Bit 1 DMEIE: direct mode error interrupt enable
     บิตนี้ถูกเซ็ตและถูกเคลียร์โดย software.
     0: DME interrupt ถูกปิดใช้งาน
     1: DME interrupt ถูกเปิดใช้งาน

Bit 0 EN: stream enable / flag stream ready when read low
     บิตนี้ถูกเซ็ตและถูกเคลียร์โดย software.
     0: stream ถูกปิดใช้งาน
     1: stream ถูกเปิดใช้งาน
     บิตนี้อาจถูกเคลียร์โดย hardware:
        –   บน a DMA end of transfer (stream พร้อมที่จะถูกกำหนดค่า)
        –   ถ้า a transfer error เกิดขึ้นบน the AHB master buses
        –   เมื่อ the FIFO threshold บน memory AHB port ไม่เข้ากันได้กับขนาดของ the burst
     เมื่อบิตนี้ถูกอ่านเป็น 0, the software จะได้รับอนุญาตให้โปรแกรม the configuration และ FIFO bits registers. ห้ามเขียน
     registers เหล่านี้เมื่อ the EN bit ถูกอ่านเป็น 1.
  Note: ก่อนการเซ็ต EN bit เป็น '1' เพื่อสตาร์ท a new transfer, the event flags ที่ตรงกันกับ the stream ใน DMA_LISR or
            DMA_HISR register ต้องถูกเคลียร์.


tha

8.5.6 DMA stream x number of data register (DMA_SxNDTR)

Address offset: 0x14 + 0x18 * x, (x = 0 to 7)
Reset value: 0x0000 0000



Bits 31:16 Reserved, must be kept at reset value.

Bits 15:0 NDT[15:0]: number of data items to transfer (0 up to 65535)
     register นี้สามารถถูกเขียนได้เฉพาะเมื่อ the stream ถูกปิดใช้งาน. เมื่อ the stream ถูกเปิดใช้งาน, register นี้จะอ่านได้เพียงอย่าง
     เดียว, แสดงให้เห็น the remaining data items ที่จะถูกส่ง. register นี้จะลดลงหลังจากแต่ละ DMA transfer.
     เมื่อ the transfer เสร็จสมบูรณ์, register สามารถอย่างใดอย่างหนึ่ง อยู่ที่ศูนย์ (เมื่อ the stream อยู่ใน normal mode) หรือถูก
    โหลดใหม่โดยอัตโนมัติด้วยค่าที่โปรแกรมไว้ก่อนหน้านี้ในกรณีต่อไปนี้:
        –   เมื่อ the stream ถูกกำหนดค่าใน circular mode.
        –   เมื่อ the stream ถูกเปิดใช้งานอีกครั้งโดยการเซ็ต EN bit เป็น '1'.
     ถ้าค่าของ register นี้เป็นศูนย์, ไม่มี transaction ใดสามารถถูกบริการแม้ว่า the stream ถูกเปิดใช้งาน.

tha

8.5.7 DMA stream x peripheral address register (DMA_SxPAR)

Address offset: 0x18 + 0x18 * x, (x = 0 to 7)
Reset value: 0x0000 0000



Bits 31:0 PAR[31:0]: peripheral address
     Base address ของ the peripheral data register จาก/ถึง ซึ่ง the data จะถูกอ่าน/ถูกเขียน.
     บิตเหล่านี้ถูกป้องกันและสามารถถูกเขียนเฉพาะเมือ EN = '0' ใน the DMA_SxCR register


tha

8.5.8 DMA stream x memory 0 address register (DMA_SxM0AR)

Address offset: 0x1C + 0x18 * x, (x = 0 to 7)
Reset value: 0x0000 0000



Bits 31:0 M0A[31:0]: memory 0 address
     Base address of memory area 0 จาก/ถึง ซึ่ง the data จะถูกอ่าน/ถูกเขียน.
     บิตเหล่านี้ถูกป้องกันการเขียน. พวกมันสามารถถูกเขียนเฉพาะถ้า:
        –   the stream ถูกปิดใช้งาน (bit EN= '0' ใน the DMA_SxCR register) หรือ
        –   the stream ถูกเปิดใช้งาน (EN='1' ใน DMA_SxCR register) และ bit CT = '1' ใน the DMA_SxCR register (ใน
             double-buffer mode).

tha

8.5.9 DMA stream x memory 1 address register (DMA_SxM1AR)

Address offset: 0x20 + 0x18 * x, (x = 0 to 7)
Reset value: 0x0000 0000



Bits 31:0 M1A[31:0]: memory 1 address (ถูกใช้ในกรณีของ double-buffer mode)
     Base address of memory area 1 จาก/ถึง ซึ่ง the data จะถูกอ่าน/ถูกเขียน.
     register นี้ถูกใช้เฉพาะสำหรับ the double-buffer mode.
     บิตเหล่านี้ถูกป้องกันการเขียน. พวกมันสามารถถูกเขียนเฉพาะถ้า:
        –   the stream ถูกปิดใช้งาน (bit EN= '0' ใน the DMA_SxCR register) หรือ
        –   the stream ถูกเปิดใช้งาน (EN='1' ใน DMA_SxCR register) และ bit CT = '0' ใน the DMA_SxCR register.

tha

8.5.10 DMA stream x FIFO control register (DMA_SxFCR)

Address offset: 0x24 + 0x24 * x, (x = 0 to 7)
Reset value: 0x0000 0021



Bits 31:8 Reserved, must be kept at reset value.

Bit 7 FEIE: FIFO error interrupt enable
     บิตนี้ถูกเซ็ตและถูกเคลียร์โดย software.
     0: FE interrupt ถูกปิดใช้งาน
     1: FE interrupt ถูกเปิดใช้งาน

Bit 6 Reserved, must be kept at reset value.

Bits 5:3 FS[2:0]: FIFO status
     บิตเหล่านี้ถูกอ่านได้เพียงอย่างเดียว.
     000: 0 < fifo_level < 1/4
     001: 1/4 ≤ fifo_level < 1/2
     010: 1/2 ≤ fifo_level < 3/4
     011: 3/4 ≤ fifo_level < full
     100: FIFO ว่างเปล่า
     101: FIFO เต็ม
     อื่นๆ: ไม่มีความหมาย
     บิตเหล่านี้ไม่เกี่ยวข้องใน the direct mode (DMDIS bit เป็นศูนย์).

Bit 2 DMDIS: direct mode disable
     บิตนี้ถูกเซ็ตและถูกเคลียร์โดย software. มันสามารถถูกเซ็ตโดย hardware.
     0: direct mode ถูกเปิดใช้งาน
     1: direct mode ถูกปิดใช้งาน
     บิตนี้ถูกป้องกันและสามารถถูกเขียนเฉพาะถ้า EN เป็น '0'.
     บิตนี้ถูกเซ็ตโดย hardware ถ้า the memory-to-memory mode ถูกเลือก (DIR bit ใน DMA_SxCR เป็น "10") และ the EN
     bit ใน the DMA_SxCR register เป็น '1' เนื่องจาก the direct mode ไม่ได้รับอนุญาตใน the memory-to-memory
     configuration.

Bits 1:0 FTH[1:0]: FIFO threshold selection
     บิตเหล่านี้ถูกเซ็ตและถูกเคลียร์โดย software.
     00: 1/4 full FIFO
     01: 1/2 full FIFO
     10: 3/4 full FIFO
     11: full FIFO
     บิตเหล่านี้ไม่ถูกใช้ใน the direct mode เมื่อ the DMIS value เป็นศูนย์.
     บิตเหล่านี้ถูกป้องกันและสามารถถูกเขียนเฉพาะถ้า EN เป็น '0'.

tha

8.5.11 DMA register map

Table 34 สรุปรวม the DMA registers