STM32F1 SDIO

Started by tha, March 09, 2022, 08:34:02 AM

Previous topic - Next topic

tha

Bits 7:6 WAITRESP: Wait for response bits
     พวกมันถูกใช้เพื่อกำหนดค่าว่า the CPSM จะรอสำหรับ a response หรือไม่, และถ้าใช่, ชนิดอะไรของ response.
     00: No response, คาดว่า CMDSENT flag
     01: Short response, คาดว่า CMDREND or CCRCFAIL flag
     10: No response, คาดว่า CMDSENT flag
     11: Long response, คาดว่า CMDREND or CCRCFAIL flag

Bit 5:0 CMDINDEX: Command index
     The command index ถูกส่งไปยัง the card เป็นส่วนหนึ่งของ a command message.

Note: อย่างน้อย seven HCLK clock periods ถูกต้องการระหว่าง two write เข้าถึงไปยัง register นี้. MultiMediaCards สามารถส่ง
         two kinds of response: short responses, 48 bits long, หรือ long responses,136 bits long. SD card and SD I/O
         card สามารถส่งได้เฉพาะ short responses, the argument สามารถต่างกันไปตาม the type of response: the software
         จะแยกแยะ the type of response สอดคล้องกับ the sent command. CE-ATA devices ส่งได้เฉพาะ short responses.

tha

22.9.5 SDIO command response register (SDIO_RESPCMD)

Address offset: 0x10
Reset value: 0x0000 0000

The SDIO_RESPCMD register บรรจุ the command index field ของ the last command response received(ที่รับ). ถ้า the command response transmission ไม่บรรจุ the command index field (long or OCR response), the RESPCMD field ถูกไม่รู้จัก, แม้ว่ามันต้องบรรจุ 111111b (ค่าของ the reserved field จาก the response).



Bits 31:6 สงวนไว้, ต้องถูกเก็บที่ reset value.

Bits 5:0 RESPCMD: Response command index
     Read-only bit field. บรรจุ the command index ของ the last command response received(ที่รับ).

tha

22.9.6 SDIO response 1..4 register (SDIO_RESPx)

Address offset: (0x10 + (4 × x)); x = 1..4
Reset value: 0x0000 0000

The SDIO_RESP1/2/3/4 registers บรรจุ the status of a card, ซึ่งเป็นส่วนหนึ่งของ the received response.

Bits 31:0 CARDSTATUSx: ดู Table 167.

The Card Status size คือ 32 หรือ 127 bits, ขึ้นอยู่กับ the response type.

The most significant bit of the card status ถูกรับก่อน. The SDIO_RESP3 register LSB เป็น 0b เสมอ.


tha

22.9.7 SDIO data timer register (SDIO_DTIMER)

Address offset: 0x24
Reset value: 0x0000 0000

The SDIO_DTIMER register บรรจุ the data timeout period, in(ในหน่วย) card bus clock periods.

A counter โหลดค่าจาก the SDIO_DTIMER register, และสตาร์ทการลดเมื่อ the data path state machine (DPSM) เข้าสู่ the Wait_R หรือ Busy state. ถ้า the timer ถึง 0 ในขณะที่ the DPSM อยู่ในอย่างใดอย่างหนึ่งของสถานะเหล่านี้, the timeout status flag จะถูกเซ็ต.



Bits 31:0 DATATIME: Data timeout period
     Data timeout period ที่แสดงใน card bus clock periods.

Note: A data transfer ต้องถูกเขียนไปยัง the data timer register และ the data length register ก่อนการถูกเขียนไปยัง the data
         control register.

tha

22.9.8 SDIO data length register (SDIO_DLEN)

Address offset: 0x28
Reset value: 0x0000 0000

The SDIO_DLEN register บรรจุ the number of data bytes ที่จะถูกส่งถ่าย. The value ถูกโหลดลงใน the data counter เมื่อ data transfer สตาร์ท.



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

Bits 24:0 DATALENGTH: Data length value
     Number of data bytes ที่จะถูกส่งถ่าย.

Note: สำหรับ a block data transfer, the value ใน the data length register ต้องเป็นตัวคูณของ the block size (ดู
          SDIO_DCTRL). A data transfer ต้องถูกเขียนไปยัง the data timer register และ the data length register ก่อนการถูก
          เขียนไปยัง the data control register.

tha

22.9.9 SDIO data control register (SDIO_DCTRL)

Address offset: 0x2C
Reset value: 0x0000 0000

The SDIO_DCTRL register ควบคุม the data path state machine (DPSM).



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

Bit 11 SDIOEN: SD I/O enable functions
     ถ้าบิตนี้ถูกเซ็ต, the DPSM กระทำ an SD I/O-card-specific operation.

Bit 10 RWMOD: Read wait mode
     0: Read Wait ควบคุมโดยหยุด SDIO_D2
     1: Read Wait ควบคุมโดยใช้ SDIO_CK

Bit 9 RWSTOP: Read wait stop
     0: Read wait กำลังดำเนินการอยู่ถ้า RWSTART bit ถูกเซ็ต
     1: เปิดการใช้งานสำหรับ read wait stop ถ้า RWSTART bit ถูกเซ็ต

Bit 8 RWSTART: Read wait start
     ถ้าบิตนี้ถูกเซ็ต, read wait operation สตาร์ท.

Bits 7:4 DBLOCKSIZE: Data block size
   กำหนด the data block length เมื่อ the block data transfer mode ถูกเลือก:
     0000: (0 decimal) lock length = 20 = 1 byte
     0001: (1 decimal) lock length = 21 = 2 bytes
     0010: (2 decimal) lock length = 22 = 4 bytes
     0011: (3 decimal) lock length = 23 = 8 bytes
     0100: (4 decimal) lock length = 24 = 16 bytes
     0101: (5 decimal) lock length = 25 = 32 bytes
     0110: (6 decimal) lock length = 26 = 64 bytes
     0111: (7 decimal) lock length = 27 = 128 bytes
     1000: (8 decimal) lock length = 28 = 256 bytes
     1001: (9 decimal) lock length = 29 = 512 bytes
     1010: (10 decimal) lock length = 210 = 1024 bytes
     1011: (11 decimal) lock length = 211 = 2048 bytes
     1100: (12 decimal) lock length = 212 = 4096 bytes
     1101: (13 decimal) lock length = 213 = 8192 bytes
     1110: (14 decimal) lock length = 214 = 16384 bytes
     1111: (15 decimal) reserved
   (lock length หรือ block length กันแน่ งงๆอยู่)

Bit 3 DMAEN: DMA enable bit
     0: DMA ถูกปิดการใช้งาน.
     1: DMA ถูกเปิดการใช้งาน.

tha

Bit 2 DTMODE: Data transfer mode selection 1: Stream or SDIO multibyte data transfer.
     0: Block data transfer
     1: Stream or SDIO multibyte data transfer บน STM32F10xxx XL-density devices.
     Stream data transfer บน STM32F10xxx high-density devices.

Bit 1 DTDIR: Data transfer direction selection
     0: จาก controller ไปยัง card.
     1: จาก card ไปยัง controller.

[ 0 ] DTEN: Data transfer enabled bit
     Data transfer สตาร์ทถ้า 1b ถูกเขียนไปยัง the DTEN bit. ขึ้นอยู่กับ the direction bit, DTDIR, the DPSM ย้ายไปยัง the
     Wait_S, Wait_R state หรือ Readwait ถ้า RW Start ถูกเซ็ตทันทีที่ the beginning of the transfer. มันไม่จำเป็นต้องเคลียร์
     the enable bit หลังจาก the end of a data transfer แต่ the SDIO_DCTRL ต้องถูกอัฟเดตเพื่อเปิดการใช้งาน a new data
     transfer

Note: อย่างน้อย seven HCLK clock periods ถูกต้องการระหว่าง two write เข้าถึงไปยัง register นี้.

tha

22.9.10 SDIO data counter register (SDIO_DCOUNT)

Address offset: 0x30
Reset value: 0x0000 0000

The SDIO_DCOUNT register โหลด the value จาก the data length register (ดู SDIO_DLEN) เมื่อ the DPSM ย้ายจาก the Idle state ไปยัง the Wait_R หรือ Wait_S state. ในขณะที่ data ถูกส่งถ่าย, the counter ลด the value ลงจนกระทั่งมันถึง 0. The DPSM จากนั้นย้ายไปยัง the Idle state และ the data status end flag, DATAEND, ถูกเซ็ต.



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

Bits 24:0 DATACOUNT: Data count value
     เมื่อบิตนี้ถูกอ่าน, the number of remaining data bytes ที่จะถูกส่งถ่ายถูกส่งคืนกลับ. การเขียนไม่มีผลอะไร.

Note: รีจีสเตอร์นี้ควรถูกอ่านเพียงอย่างเดียวเมื่อ the data transfer เสร็จสมบูรณ์.