8.3.11 Programmable data width, packing/unpacking, endiannessจำนวนของ data items ที่จะถูกส่งถ่ายต้องถูกโปรแกรมลงใน DMA_SxNDTR (number of data items to transfer bit, NDT) ก่อนการเปิดใช้งาน the stream (ยกเว้นเมื่อ the flow controller เป็น the peripheral, PFCTRL bit ใน DMA_SxCR ถูกเซ็ต).
เมื่อใช้ the internal FIFO, the data widths ของ the source and destination data สามารถโปรแกรมได้ผ่านทาง the PSIZE and MSIZE bits ใน the DMA_SxCR register (สามารถเป็น 8-, 16- or 32-bit).
เมื่อ PSIZE and MSIZE ไม่เท่ากัน:
• The data width ของจำนวนของ data items ที่จะส่งถ่าย, ที่กำหนดค่าใน the DMA_SxNDTR register จะเท่ากับความกว้างของ
the peripheral bus (ที่กำหนดค่าโดย the PSIZE bits ใน the DMA_SxCR register). ตัวอย่างเช่น, ในกรณีของ peripheral-
to-memory, memory-to-peripheral หรือ memory-to-memory transfers และถ้า the PSIZE[1:0] bits ถูกกำหนดค่า
สำหรับ half-word, จำนวนของ bytes ที่จะถูกส่งถ่ายจะเท่ากับ 2 × NDT.
• The DMA controller จะจัดการเฉพาะกับ little-endian addressing เท่านั้นสำหรับทั้งต้นทางและปลายทาง. สิ่งนี้ถูกอธิบายใน Table
29: Packing/unpacking and endian behavior (bit PINC = MINC = 1).
packing/unpacking procedure นี้อาจมีความเสี่ยงของ data corruption เมื่อ the operation ถูกอินเตอ์รัพท์ก่อนที่ the data จะถูก packed/unpacked เสร็จสมบูรณ์. ดังนั้น, เพื่อให้แน่ใจว่า data ติดต่อกัน, the stream อาจถูกกำหนดค่าเพื่อสร้าง burst transfers: ในกรณีนี้, แต่ละ group of transfers เป้นของ a burst ที่จะแบ่งแยกไม่ได้ (ดูที่ Section 8.3.12: Single and burst transfers).
ใน direct mode (DMDIS = 0 ใน the DMA_SxFCR register), the packing/unpacking ของ data ไม่สามารถทำได้. ในกรณีนี้, ไม่อนุญาตให้มีความแตกต่าง source and destination transfer data widths: ทั้งคู่เท่ากันและถูกกำหนดโดย the PSIZE bits ใน the DMA_SxCR register. MSIZE bits ไม่เกี่ยวข้อง.
Note: Peripheral port อาจเป็น the source หรือ the destination (มันยังสามารถเป็น the memory source ในกรณีของ
memory-to-memory transfer ได้อีกด้วย).PSIZE, MSIZE and NDT[15:0] ต้องถูกกำหนดค่า ดังนั้นเพื่อให้แน่ใจว่า the last transfer จะไม่ไม่เสร็จสมบูรณ์. สิ่งนี้สามารถเกิดขึ้นเมื่อ the data width ของ the peripheral port (PSIZE bits) ต่ำกว่า the data width ของ the memory port (MSIZE bits). ข้อจำกัดนี้ถูกสรุปรวมใน Table 30.
