STM32F1 SDIO

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

Previous topic - Next topic

tha

•    Receive: serial data ที่รับจาก a card ถูกแพ็คเป็น bytes และถูกเขียนไปยัง the data FIFO. ขึ้นอยู่กับ the transfer mode bit
     ใน the data control register, the data transfer mode สามารถเป็นอย่างใดอย่างหนึ่ง block หรือ stream:
     –   ใน block mode, เมื่อ the data block counter ถึงศูนย์, the DPSM รอจนกระทั่งมันรับ the CRC code. ถ้า the received
          code ตรงกับ the internally generated CRC code, the DPSM จะเคลื่อนไปยัง the Wait_R state. ถ้าไม่, the CRC fail
          status flag จะถูกเซ็ตและ the DPSM จะเคลื่อนไปยัง the Idle state.
     –   ใน stream mode, the DPSM รับ data ในขณะที่ the data counter ไม่เป็นศูนย์. เมื่อ the counter เป็นศูนย์, the
          remaining data ใน the shift register จะถูกเขียนไปยัง the data FIFO, และ the DPSM จะเคลื่อนไปยัง the Wait_R
          state.
     ถ้า a FIFO overrun error เกิดขึ้น, the DPSM เซ็ต the FIFO error flag และเคลื่อนไปยัง the Idle state:

tha

•    Wait_S: the DPSM เคลื่อนไปยัง the Idle state ถ้า the data counter เป็นศูนย์. ถ้าไม่, มันรอจนกระทั่ง the data FIFO empty
      flag ถูกยืนยัน, และเคลื่อนไปยัง the Send state.

Note: The DPSM ยังคงอยู่ใน the Wait_S state เป็นเวลาอย่างน้อย two clock periods เพื่อให้ตรงตาม the NWR timing requirements, ที่ NWR คือจำนวนของ clock cycles ระหว่างการรับของ the card response และการสตาร์ทของ the data transfer จาก the host.

tha

•    Send: the DPSM สตาร์ทการส่ง data ไปยัง a card. ขึ้นอยู่กับ the transfer mode bit ใน the data control register, the data
     transfer mode สามารถเป็นอย่างใดอย่างหนึ่ง block หรือ stream:
     –   In block mode,  เมื่อ the data block counter ถึงศูนย์,, the DPSM จะส่ง an internally generated CRC code และ end
          bit, และเคลื่อนไปยัง the Busy state.
     –   In stream mode, the DPSM ส่ง data ไปยัง a card ในขณะที่ the enable bit เป็น high และ the data counter ไม่เป็น
          ศูนย์. มันจากนั้นเคลื่อนไปยัง the Idle state.
     ถ้า a FIFO underrun error เกิดขึ้น, the DPSM เซ็ต the FIFO error flag และเคลื่อนไปยัง the Idle state:


tha

•    Busy: the DPSM รอสำหรับ the CRC status flag:
     –   ถ้ามันไม่ได้รับ a positive CRC status, มันจะเคลื่อนไปยัง the Idle state และเซ็ต the CRC fail status flag.
     –   ถ้ามันได้รับ a positive CRC status, มันจะเคลื่อนไปยัง the Wait_S state ถ้า SDIO_D0 ไม่เป็น low (the card ไม่ busy).
     ถ้า a timeout เกิดขึ้นในขณะที่ the DPSM อยู่ใน the Busy state, มันจะเซ็ต the data timeout flag และเคลื่อนไปยัง the Idle
     state.
     The data timer ถูกเปิดการใช้งานเมื่อ the DPSM อยู่ใน the Wait_R หรือ Busy state, และสร้าง the data timeout error:
     –   เมื่อกำลังส่ง data, the timeout เกิดขึ้นถ้า the DPSM อยู่ใน the Busy state เป็นเวลานานกว่า the programmed timeout
          period
     –   เมื่อกำลังรับ data, the timeout เกิดขึ้นถ้าตอนท้ายของ the data ไม่เป็นจริง, และถ้า the DPSM อยู่ใน the Wait_R state
          เป็นเวลานานกว่า the programmed timeout period.

tha

•    Data: data สามารถถูกส่งถ่าย the card ไปยัง the host หรือในทางกลับกัน. Data ถูกส่งถ่ายผ่านทาง the data lines. พวกมันถูกเก็บ
     ใน a FIFO of 32 words, แต่ละ word เป็น 32 bits wide.


tha

Data FIFO

The data FIFO (first-in-first-out) subunit เป็น a data buffer พร้อมกับ a transmit and receive unit.

The FIFO บรรจุ a 32-bit wide, 32-word deep data buffer, และ transmit and receive logic. เนื่องจาก the data FIFO ทำงานใน the AHB clock domain (HCLK/2), สัญญานทั้งหมดจาก the subunits ใน the SDIO clock domain (SDIOCLK) จะถูกซิงโครไนซ์ใหม่.

ขึ้นอยู่กับ the TXACT and RXACT flags, the FIFO สามารถถูกปิดการใช้งาน, transmit ถูกเปิดการใช้งาน, หรือ receive ถูกเปิดการใช้งาน. TXACT and RXACT ถูกขับโดย the data path subunit และไม่เกิดในเวลาเดียวกัน:
     –   The transmit FIFO หมายถึง the transmit logic and data buffer เมื่อ TXACT ถูกยืนยัน
     –   The receive FIFO หมายถึง the receive logic and data buffer เมื่อ RXACT ถูกยืนยัน

tha

•    Transmit FIFO:

     Data สามารถถูกเขียนไปยัง the transmit FIFO ผ่านทาง the AHB interface เมื่อ the SDIO ถูกเปิดการใช้งานสำหรับ
     transmission

     The transmit FIFO เข้าถึงได้โดยทาง 32 sequential addresses. The transmit FIFO บรรจุ a data output register ที่เก็บ
     the data word ที่ชี้ถึงโดย the read pointer. เมื่อ the data path subunit ได้โหลด shift register ของมันแล้ว, มันจะเพิ่ม the
     read pointer และขับ new data ออก.

     ถ้า the transmit FIFO ถูกปิดการใช้งาน, all status flags ถูกยกเลิกการยืนยัน. The data path subunit จะยืนยัน TXACT เมื่อมัน
     ส่ง data.


tha

•    Receive FIFO

     เมื่อ the data path subunit รับ a word of data, มันขับ the data ไปบน the write databus. The write pointer ถูกเพิ่มขึ้น
     หลังจาก the write operation เสร็จสมบูรณ์. บน the read side, สิ่งที่บรรจุอยู่ภายในของ the FIFO word ที่ชี้ถึงโดยค่าปัจจุบันของ
     the read pointer ถูกขับลงบน the read databus. ถ้า the receive FIFO ถูกปิดการใช้งาน, all status flags ถูกยกเลิกการ
     ยืนยัน, และ the read and write pointers ถูกรีเซ็ต. The data path subunit ยืนยัน RXACT เมื่อมันรับ data. Table 144 แสดง
     รายการ the receive FIFO status flags. The receive FIFO เข้าถึงได้โดยทาง 32 sequential addresses.