STM32F1 SDIO

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

Previous topic - Next topic

tha



เมื่อ the Wait state ถูกเข้าสู่, the command timer สตาร์ทการรัน. ถ้า the timeout ถูกถึงก่อน the CPSM เคลื่อนปยัง the Receive state, the timeout flag จะถูกเซ็ตและ the Idle state ถูกเข้าสู่.

Note: The command timeout มีค่าคงที่ 64 SDIO_CK clock periods.

ถ้า the interrupt bit ถูกเซ็ตใน the command register, the timer ถูกปิดการใช้งานและ the CPSM รอสำหรับ an interrupt request จากการ์ดใดการ์ดหนึ่ง. ถ้า a pending bit ถูกเซ็ตใน the command register, the CPSM เข้าสู่ the Pend state, และรอสำหรับ a CmdPend signal จาก the data path subunit. เมื่อ CmdPend ถูกตรวจพบ, the CPSM จะเคลื่อนไปยัง the Send state. นี้จะเปิดการใช้งาน the data counter เพื่อทริก the stop command transmission.

Note: The CPSM ยังคงอยู่ใน the Idle state เป้นเวลาอย่างน้อยแปด SDIO_CK periods เพื่อให้ตรงตาม the NCC and NRC timing constraints. NCC คือ the minimum delay ระหว่างสอง host commands, และ NRC คือ the minimum delay ระหว่าง the host command และ the card response.

tha



•    Command format

      –   Command: a command คือ a token ที่สตาร์ท an operation. Command ถูกส่งจาก the host อย่างใดอย่างหนึ่ง ไปยัง a
           single card (addressed command) หรือไปยัง cards ที่เชื่อมต่อทั้งหมด (broadcast command มีให้ใช้ประโยชน์สำหรับ
           MMC V3.31 หรือก่อนหน้า). Commands ถูกส่งถ่ายแบบอนุกรมบน the CMD line. commands มีความยาวคงที่ 48 bits. รูป
           แบบทั่วไปสำหรับ a command token สำหรับ MultiMediaCards, SD-Memory cards and SDIO-Cards ถูกแสดงใน
           Table 138. CE-ATA commands เป็นส่วนขยายของ MMC commands V4.2, และดังนั้นมีรูปแบบเดียวกัน.

           The command path ทำงานใน a half-duplex mode, ดังนั้น commands และ responses สามารถอย่างใดอย่างหนึ่ง ถูกส่ง
           หรือถูกรับ. ถ้า the CPSM ไม่อยู่ใน the Send state, the SDIO_CMD output จะอยู่ใน the Hi-Z state, ดังแสดงใน
           Figure 217. Data บน SDIO_CMD จะซิงโครไน้ส์กับขอบขาขึ้นของ SDIO_CK. Table 138 แสดง the command format.


tha

    –   Response: a response คือ a token ที่ถูกส่งจาก an addressed card (หรือซิงโครไน้ส์จาก cards ที่เชื่อมต่อทั้งหมดสำหรับ
         MMC V3.31 หรือก่อนหน้า), ไปยัง the host เป็นคำตอบสำหรับ a previously received command. Responses ถูกส่งถ่าย
         แบบอนุกรมบน the CMD line.

The SDIO รองรับสอง response types. ทั้งคู่ใช้ CRC error checking:
• 48-bit short response
• 136-bit long response

Note: ถ้า the response ไม่บรรจุ a CRC (CMD1 response), the device driver ต้องละเว้น the CRC failed status.



tha

The command register บรรจุ the command index (หก bits ที่ส่งถึง a card) และ the command type. เหล่านี้ตัดสินว่า the command ต้องการ a response หรือไม่, และว่า the response มีความยาว 48 หรือ 136 bits (ดู Section 22.9.4). The command path จัดให้มีใช้ the status flags ที่แสดงใน Table 141:



tha

The CRC generator คำนวณ the CRC checksum สำหรับ all bits ก่อน the CRC code. นี้รวม the start bit, transmitter bit, command index, และ command argument (หรือ card status). The CRC checksum ถูกคำนวณสำหรับ 120 bits แรกของ CID หรือ CSD สำหรับ the long response format. บันทึกไว้ว่า the start bit, transmitter bit และ the six reserved bits ไม่ถูกใช้ใน the CRC calculation.


tha

Data path

The data path subunit ส่งถ่าย data ไปยังและจาก cards. Figure 218 แสดง a block diagram ของ the data path.



The card databus width สามารถถูกโปรแกรมโดยใช้ the clock control register. ถ้า the 4-bit wide bus mode ถูกเปิดการใช้งาน, data ถูกส่งถ่ายที่ four bits ต่อ clock cycle ครอบคลุม all four data signals (SDIO_D[3:0]). ถ้า the 8-bit wide bus mode ถูกเปิดการใช้งาน, data ถูกส่งถ่ายที่ eight bits ต่อ clock cycle ครอบคลุม all eight data signals (SDIO_D[7:0]). ถ้า the wide bus mode ไม่ถูกเปิดการใช้งาน, มีเพียง one bit ต่อ clock cycle ถูกส่งถ่ายครอบคลุม SDIO_D0.

ขึ้นอยู่กับ the transfer direction (ส่งหรือรับ), the data path state machine (DPSM) เคลื่อนไปยัง the Wait_S หรือ Wait_R state เมื่อมันถูกเปิดการใช้งาน:
•    Send: the DPSM เคลื่อนไปยัง the Wait_S state. ถ้ามี data ใน the transmit FIFO, the DPSM เคลื่อนไปยัง the Send
      state, และ the data path subunit สตาร์ทการส่ง data ไปยัง a card.
•    Receive: the DPSM เคลื่อนไปยัง the Wait_R state และรอสำหรับ a start bit. เมื่อมันรับ a start bit, the DPSM เคลื่อนไปยัง
      the Receive state, และ the data path subunit สตาร์ทการรับ data จาก a card.

tha

Data path state machine (DPSM)

The DPSM ทำงานที่ SDIO_CK frequency. Data บน the card bus signals จะซิงโครไน้ส์กับขอบขาขึ้นของ SDIO_CK. The DPSM มี six states, ดังแสดงใน Figure 219.



•    Idle: the data path ไม่ทำงาน, และ the SDIO_D[7:0] outputs อยู่ใน Hi-Z. เมื่อ the data control register ถูกเขียนและ
      the enable bit ถูกเซ็ต, the DPSM จะโหลด the data counter ด้วยค่าใหม่และ, ขึ้นอยู่กับ the data direction bit, เคลื่อนไป
      ยังอย่างใดอย่างหนึ่ง the Wait_S หรือ the Wait_R state.

tha

•    Wait_R: ถ้า the data counter เท่ากับศูนย์, the DPSM จะเคลื่อนไปยัง the Idle state เมื่อ the receive FIFO ว่างเปล่า. ถ้า the
     data counter ไม่เป็นศูนย์, the DPSM จะรอสำหรับ a start bit บน SDIO_D. The DPSM เคลื่อนไปยัง the Receive state ถ้ามัน
     รับ a start bit ก่อน a timeout, และโหลด the data block counter. ถ้ามันถึง a timeout ก่อนมันตรวจพบ a start bit, หรือ a
     start bit error เกิดขึ้น, มันจะเคลื่อนไปยัง the Idle state และเซ็ต the timeout status flag.