STM32F7 8 Direct memory access controller (DMA)

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

Previous topic - Next topic

tha

8.4 DMA interrupts

สำหรับแต่ละ DMA stream, an interrupt สมารถถูกสร้างบน the following events:
•   Half-transfer reached
•   Transfer complete
•   Transfer error
•   FIFO error (overrun, underrun or FIFO level error)
•   Direct mode error

Separate(แยกต่างหาก) interrupt enable control bits มีให้ใช้งานเพื่อความยืดหยุ่นดังแสดงใน Table 33.



Note: ก่อนการเซ็ต an enable control bit EN = 1, the corresponding event flag ต้องถูกเคลียร์, มิฉะนั้น an interrupt จะถูก
          สร้างโดยทันที.

tha

8.5 DMA registers

The DMA registers ต้องถูกเข้าถึงโดย words (32 bits).

8.5.1 DMA low interrupt status register (DMA_LISR)

Address offset: 0x00
Reset value: 0x0000 0000



Bits 31:28, 15:12 Reserved, must be kept at reset value.

Bits 27, 21, 11, 5 TCIF[3:0]: stream x transfer complete interrupt flag (x = 3..0)
     บิตนี้ถูกเซ็ตโดย hardware. มันถูกเคลียร์โดย software โดยเขียน 1 ไปยังบิตที่ตรงกันใน the
     DMA_LIFCR register.
     0:  ไม่มี transfer complete event บน stream x
     1:   a transfer complete event เกิดขึ้นบน stream x

Bits 26, 20, 10, 4 HTIF[3:0]: stream x half transfer interrupt flag (x = 3..0)
     This bit is set by hardware. It is cleared by software writing 1 to the corresponding bit in the
     DMA_LIFCR register.
     0: no half transfer event on stream x
     1: a half transfer event occurred on stream x

Bits 25, 19, 9, 3 TEIF[3:0]: stream x transfer error interrupt flag (x = 3..0)
     This bit is set by hardware. It is cleared by software writing 1 to the corresponding bit in the
     DMA_LIFCR register.
     0: no transfer error on stream x
     1: a transfer error occurred on stream x

Bits 24, 18, 8, 2 DMEIF[3:0]: stream x direct mode error interrupt flag (x = 3..0)
     This bit is set by hardware. It is cleared by software writing 1 to the corresponding bit in the
     DMA_LIFCR register.
     0: No direct mode error on stream x
     1: a direct mode error occurred on stream x

Bits 23, 17, 7, 1 Reserved, must be kept at reset value.

Bits 22, 16, 6, 0 FEIF[3:0]: stream x FIFO error interrupt flag (x = 3..0)
     This bit is set by hardware. It is cleared by software writing 1 to the corresponding bit in the
     DMA_LIFCR register.
     0: no FIFO error event on stream x
     1: a FIFO error event occurred on stream x

tha

8.5.2 DMA high interrupt status register (DMA_HISR)

Address offset: 0x04
Reset value: 0x0000 0000



Bits 31:28, 15:12 Reserved, must be kept at reset value.

Bits 27, 21, 11, 5 TCIF[7:4]: stream x transfer complete interrupt flag (x = 7..4)
     บิตนี้ถูกเซ็ตโดย hardware. มันถูกเคลียร์โดย software โดยเขียน 1 ไปยังบิตที่ตรงกันใน the
     DMA_HIFCR register.
     0: ไม่มี transfer complete event บน stream x
     1: a transfer complete event เกิดขึ้นบน stream x

Bits 26, 20, 10, 4 HTIF[7:4]: stream x half transfer interrupt flag (x = 7..4)
     This bit is set by hardware. It is cleared by software writing 1 to the corresponding bit in the
     DMA_HIFCR register.
     0: no half transfer event on stream x
     1: a half transfer event occurred on stream x

Bits 25, 19, 9, 3 TEIF[7:4]: stream x transfer error interrupt flag (x = 7..4)
     This bit is set by hardware. It is cleared by software writing 1 to the corresponding bit in the
     DMA_HIFCR register.
     0: no transfer error on stream x
     1: a transfer error occurred on stream x

Bits 24, 18, 8, 2 DMEIF[7:4]: stream x direct mode error interrupt flag (x = 7..4)
     This bit is set by hardware. It is cleared by software writing 1 to the corresponding bit in the
     DMA_HIFCR register.
     0: no direct mode error on stream x
     1: a direct mode error occurred on stream x

Bits 23, 17, 7, 1 Reserved, must be kept at reset value.

Bits 22, 16, 6, 0 FEIF[7:4]: stream x FIFO error interrupt flag (x = 7..4)
     This bit is set by hardware. It is cleared by software writing 1 to the corresponding bit in the
     DMA_HIFCR register.
     0: no FIFO error event on stream x
     1: a FIFO error event occurred on stream x


tha

8.5.3 DMA low interrupt flag clear register (DMA_LIFCR)

Address offset: 0x08
Reset value: 0x0000 0000



Bits 31:28, 15:12 Reserved, must be kept at reset value.

Bits 27, 21, 11, 5 CTCIF[3:0]: stream x clear transfer complete interrupt flag (x = 3..0)
     การเขียน 1 ไปยังบิตนี้จะเคลียร์ the corresponding TCIFx flag in the DMA_LISR register.

Bits 26, 20, 10, 4 CHTIF[3:0]: stream x clear half transfer interrupt flag (x = 3..0)
     Writing 1 to this bit clears the corresponding HTIFx flag in the DMA_LISR register

Bits 25, 19, 9, 3 CTEIF[3:0]: Stream x clear transfer error interrupt flag (x = 3..0)
     Writing 1 to this bit clears the corresponding TEIFx flag in the DMA_LISR register.

Bits 24, 18, 8, 2 CDMEIF[3:0]: stream x clear direct mode error interrupt flag (x = 3..0)
     Writing 1 to this bit clears the corresponding DMEIFx flag in the DMA_LISR register.

Bits 23, 17, 7, 1 Reserved, must be kept at reset value.

Bits 22, 16, 6, 0 CFEIF[3:0]: stream x clear FIFO error interrupt flag (x = 3..0)
     Writing 1 to this bit clears the corresponding CFEIFx flag in the DMA_LISR register.

tha

8.5.4 DMA high interrupt flag clear register (DMA_HIFCR)

Address offset: 0x0C
Reset value: 0x0000 0000



Bits 31:28, 15:12 Reserved, must be kept at reset value.

Bits 27, 21, 11, 5 CTCIF[7:4]: stream x clear transfer complete interrupt flag (x = 7..4)
     การเขียน 1 ไปยังบิตนี้จะเคลียร์ the corresponding TCIFx flag in the DMA_HISR register.

Bits 26, 20, 10, 4 CHTIF[7:4]: stream x clear half transfer interrupt flag (x = 7..4)
     Writing 1 to this bit clears the corresponding HTIFx flag in the DMA_HISR register.

Bits 25, 19, 9, 3 CTEIF[7:4]: stream x clear transfer error interrupt flag (x = 7..4)
     Writing 1 to this bit clears the corresponding TEIFx flag in the DMA_HISR register.

Bits 24, 18, 8, 2 CDMEIF[7:4]: stream x clear direct mode error interrupt flag (x = 7..4)
     Writing 1 to this bit clears the corresponding DMEIFx flag in the DMA_HISR register.

Bits 23, 17, 7, 1 Reserved, must be kept at reset value.

Bits 22, 16, 6, 0 CFEIF[7:4]: stream x clear FIFO error interrupt flag (x = 7..4)
     Writing 1 to this bit clears the corresponding CFEIFx flag in the DMA_HISR register.

tha

8.5.5 DMA stream x configuration register (DMA_SxCR)

register นี้ถูกใช้เพื่อกำหนดค่า the concerned stream.
Address offset: 0x10 + 0x18 * x, (x = 0 to 7)
Reset value: 0x0000 0000



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

Bits 27:25 CHSEL[2:0]: channel selection
     บิตเหล่านี้ถูกเซ็ตและถูกเคลียร์โดย software.
     000: channel 0 ถูกเลือก
     001: channel 1 selected
     010: channel 2 selected
     011: channel 3 selected
     100: channel 4 selected
     101: channel 5 selected
     110: channel 6 selected
     111: channel 7 selected
     บิตเหล่านี้ถูกป้องกันและสามารถถูกเขียนเฉพาะถ้า EN เป็น '0'.

Bits 24:23 MBURST[1:0]: memory burst transfer configuration
     บิตเหล่านี้ถูกเซ็ตและถูกเคลียร์โดย software.
     00: single transfer
     01: INCR4 (ส่งเป็นชุดอย่างเร็วเพิ่มทีละ 4 beats)
     10: INCR8 (incremental burst of 8 beats)
     11: INCR16 (incremental burst of 16 beats)
     บิตเหล่านี้ถูกป้องกันและสามารถถูกเขียนเฉพาะถ้า EN เป็น '0'.
     ใน direct mode, บิตเหล่านี้ถูกบังคับเป็น 0x0 โดย hardware ทันทีที่ bit EN= '1'.

Bits 22:21 PBURST[1:0]: peripheral burst transfer configuration
     บิตเหล่านี้ถูกเซ็ตและถูกเคลียร์โดย software.
     00: single transfer
     01: INCR4 (ส่งเป็นชุดอย่างเร็วเพิ่มทีละ 4 beats)
     10: INCR8 (incremental burst of 8 beats)
     11: INCR16 (incremental burst of 16 beats)
      บิตเหล่านี้ถูกป้องกันและสามารถถูกเขียนเฉพาะถ้า EN เป็น '0'.
     ใน direct mode, บิตเหล่านี้ถูกบังคับเป็น 0x0 โดย hardware.

Bit 20 Reserved, must be kept at reset value

tha

Bit 19 CT: current target (only in double-buffer mode)
     บิตนี้ถูกเซ็ตและถูกเคลียร์โดย hardware. มันสามารถถูกเขียนโดย software ได้ด้วย.
     0: current target memory คือ Memory 0 (ระบุที่อยู่โดย the DMA_SxM0AR pointer)
     1: current target memory คือ Memory 1 (ระบุที่อยู่โดย the DMA_SxM1AR pointer)
     บิตนี้สามารถถูกเขียนเฉพาะถ้า EN เป็น '0' เพื่อระบุ the target memory area ของ the first transfer.
     ทันทีที่ the stream ถูกเปิดใช้งาน, บิตนี้จะทำงานเป็น a status flag ที่แสดงให้เห็นว่า memory area ไหนเป็น the current
     target.

Bit 18 DBM: double-buffer mode
     บิตนี้ถูกเซ็ตและถูกเคลียร์โดย software.
     0: ไม่มี buffer ถูกสลับที่ the end of transfer
     1: memory target  ถูกสลับที่ the end of the DMA transfer
      บิตนี้ถูกป้องกันและสามารถถูกเขียนเฉพาะถ้า EN เป็น '0'.

Bits 17:16 PL[1:0]: priority level
     บิตเหล่านี้ถูกเซ็ตและถูกเคลียร์โดย software.
     00: low
     01: medium
     10: high
     11: very high
     บิตนี้ถูกป้องกันและสามารถถูกเขียนเฉพาะถ้า EN เป็น '0'.

tha

Bit 15 PINCOS: peripheral increment offset size
     บิตนี้ถูกเซ็ตและถูกเคลียร์โดย software.
     0: The offset size สำหรับ the peripheral address calculation ถูกเชื่อมโยงเข้ากับ the PSIZE
     1: The offset size สำหรับ the peripheral address calculation ถูกคงที่เป็น 4 (32-bit alignment).
     บิตนี้ไม่มีความหมายถ้า bit PINC = '0'.
     บิตนี้ถูกป้องกันและสามารถถูกเขียนเฉพาะถ้า EN = '0'.
     บิตนี้ถูกบังคับ low โดย hardware เมื่อ the stream ถูกเปิดใช้งาน (bit EN = '1') ถ้า the direct mode ถูกเลือกหรือถ้า PBURST
     แตกต่างจาก "00".

Bits 14:13 MSIZE[1:0]: memory data size
     บิตเหล่านี้ถูกเซ็ตและถูกเคลียร์โดย software.
     00: byte (8-bit)
     01: half-word (16-bit)
     10: word (32-bit)
     11: reserved
     บิตเหล่านี้ถูกป้องกันและสามารถถูกเขียนเฉพาะถ้า EN เป็น '0'.
     ใน direct mode, MSIZE ถูกบังคับโดย hardware ไปเป็นค่าเดียวกันกับ PSIZE ทันทีที่ bit EN = '1'.

Bits 12:11 PSIZE[1:0]: peripheral data size
     บิตเหล่านี้ถูกเซ็ตและถูกเคลียร์โดย software.
     00: byte (8-bit)
     01: half-word (16-bit)
     10: word (32-bit)
     11: reserved
     บิตเหล่านี้ถูกป้องกันและสามารถถูกเขียนเฉพาะถ้า EN เป็น '0'.

Bit 10 MINC: memory increment mode
     บิตนี้ถูกเซ็ตและถูกเคลียร์โดย software.
     0: memory address pointer ถูกคงที่
     1: memory address pointer ถูกเพิ่มขึ้นหลังจากแต่ละ data transfer (การเพิ่มถูกทำสอดคล้องกับ MSIZE)
          บิตนี้ถูกป้องกันและสามารถถูกเขียนเฉพาะถ้า EN เป็น '0'.

Bit 9 PINC: peripheral increment mode
     บิตนี้ถูกเซ็ตและถูกเคลียร์โดย software.
     0: peripheral address pointer is fixed
     1: peripheral address pointer ถูกเพิ่มขึ้นหลังจากแต่ละ data transfer (การเพิ่มถูกทำสอดคล้องกับ PSIZE)
     บิตนี้ถูกป้องกันและสามารถถูกเขียนเฉพาะถ้า EN เป็น '0'.

Bit 8 CIRC: circular mode
     บิตนี้ถูกเซ็ตและถูกเคลียร์โดย software และสามารถถูกเคลียร์โดย hardware.
     0: circular mode ถูกปิดใช้งาน
     1: circular mode ถูกเปิดใช้งาน
     เมื่อ the peripheral เป็น the flow controller (bit PFCTRL = 1) และ the stream ถูกเปิดใช้งาน (bit EN = 1), จากนั้นบิตนี้จะ
     ถูกบังคับโดยอัตโนมัติโดย hardware ไปเป็น 0. มันถูกบังคับโดยอัตโนมัติโดย hardware ไปเป็น 1 ถ้า the DBM bit ถูกเซ็ต, ทันทีที่
     the stream ถูกเปิดใช้งาน (bit EN ='1').