Electoday 2025

ไมโครคอนโทรลเลอร์ => ARM Processors => Topic started by: tha on March 09, 2022, 08:34:02 AM

Title: STM32F1 SDIO
Post by: tha on March 09, 2022, 08:34:02 AM
22 Secure digital input/output interface (SDIO)

Low-density devices are STM32F101xx, STM32F102xx and STM32F103xx
microcontrollers ที่ the Flash memory density ย่านระหว่าง 16 and 32 Kbytes.

Medium-density devices are STM32F101xx, STM32F102xx and STM32F103xx
microcontrollers ที่ the Flash memory density ย่านระหว่าง 64 and 128 Kbytes.

High-density devices are STM32F101xx and STM32F103xx microcontrollers ที่ the
Flash memory density ย่านระหว่าง 256 and 512 Kbytes.

XL-density devices are STM32F101xx and STM32F103xx microcontrollers ที่ the
Flash memory density ย่านระหว่าง 768 Kbytes and 1 Mbyte.

Connectivity line devices are STM32F105xx and STM32F107xx microcontrollers.

ส่วนนี้ประยุกต์ใช้กับ high-density and XL-density performance line devices เท่านั้น.
Title: Re: STM32F1 SDIO
Post by: tha on March 09, 2022, 09:37:05 AM
22.1 SDIO main features

The SD/SDIO MMC card host interface (SDIO) จัดให้มี an interface ระหว่าง the AHB peripheral bus และ MultiMediaCards (MMCs), SD memory cards, SDIO cards and CE-ATA devices.

The MultiMediaCard system specifications มีให้ใช้ประโยชน์ผ่านทาง the MultiMediaCard Association website ที่ www.mmca.org, จัดพิมพ์โดย the MMCA technical committee.

SD memory card and SD I/O card system specifications มีให้ใช้ประโยชน์ผ่านทาง the SD card Association website ที่ www.sdcard.org.

CE-ATA system specifications มีให้ใช้ประโยชน์ผ่านทาง the CE-ATA workgroup website ที่ www.ce-ata.org.

คุณสมบัติของ SDIO มีดังต่อไปนี้ :
•    เป็นไปตามอย่างสมบูรณ์กับ MultiMediaCard System Specification Version 4.2. Card รองรับสำหรับ three different
      databus modes: 1-bit (default), 4-bit and 8-bit
•    เข้ากันได้อย่างสมบูรณ์กับเวอร์ชั่นก่อนหน้าของ MultiMediaCards (ความเข้ากันได้แบบไปข้างหน้า)
•    เป็นไปตามอย่างสมบูรณ์กับ SD Memory Card Specifications Version 2.0
•    เป็นไปตามอย่างสมบูรณ์กับ SD I/O Card Specification Version 2.0: card รองรับสำหรับ two different databus modes: 1-
      bit (default) and 4-bit
•    การรองรับอย่างสมบูรณ์ของ the CE-ATA features (เป็นไปตามอย่างสมบูรณ์กับ CE-ATA digital protocol Rev1.1)
•    Data transfer สูงถึง 48 MHz สำหรับ the 8 bit mode
•    Data และ command output enable signals เพื่อควบคุม external bidirectional drivers.

Note: The SDIO ไม่มี an SPI-compatible communication mode.

The SD memory card protocol เป็น a superset ของ the MultiMediaCard protocol ตามที่กำหนดใน the MultiMediaCard system specification V2.11. หลายคำสั่งที่ต้องการสำหรับ SD memory devices ไม่ถูกรองรับโดยอย่างใดอย่างหนึ่ง SD I/O-only cards หรือ the I/O portion ของ combo cards. บางส่วนของคำสั่งเหล่านี้ไม่ได้ใช้ใน SD I/O devices, อย่างเช่น erase commands, และดังนั้นไม่ถูกรองรับใน the SDIO. นอกจากนี้, หลายคำสั่งที่แตกต่างกันระหว่าง SD memory cards และ SD I/O cards และดังนั้นไม่ถูกรองรับใน the SDIO. สำหรับรายละเอียดอ้างอิงถึง SD I/O card Specification Version 1.0. CE-ATA ถูกรองรับครอบคลุม the MMC electrical interface โดยใช้ a protocol ที่ใช้ the existing MMC access primitives. The interface electrical and signaling definition เป็นไปตามที่กำหนดใน the MMC reference.


The MultiMediaCard/SD bus เชื่อมต่อ cards เข้ากับ the controller.

เวอร์ชั่นปัจจุบันของ the SDIO รองรับ SD/SDIO/MMC4.2 card ได้ครั้งละหนึ่งการ์ดเท่านั้นและสแตกค์เดียวของ MMC4.1 หรือก่อนหน้า.
Title: Re: STM32F1 SDIO
Post by: tha on March 10, 2022, 08:26:15 AM
22.2 SDIO bus topology

Communication ผ่าน the bus จะขึ้นอยู่กับ command and data transfers.

การติดต่อกันพื้นฐานบน the MultiMediaCard/SD/SD I/O bus คือ the command/response transaction. ชนิดเหล่านี้ของ bus transaction ส่งถ่าย information ของพวกมันโดยตรงภายใน the command หรือ response structure. นอกจากนี้ การดำเนินการบางอย่างมี a data token.

Data transfers ถึง/จาก SD/SDIO memory cards ถูกทำใน data blocks. Data transfers ถึง/จาก MMC ถูกทำใน data blocks หรือ streams. Data transfers ถึง/จาก the CE-ATA Devices ถูกทำใน data blocks.

(https://i.imgur.com/H4Detp0.png)

(https://i.imgur.com/GpSuJ2d.png)
Note: The SDIO จะไม่ส่ง data ใดๆตราบเท่าที่ the Busy signal ถูกยืนยัน(ถือสิทธิ์) (SDIO_D0 pulled low).

(https://i.imgur.com/LFLI3FO.png)
(https://i.imgur.com/lDuRtzN.png)
Title: Re: STM32F1 SDIO
Post by: tha on March 22, 2022, 07:10:19 AM
22.3 SDIO functional description

The SDIO ประกอบด้วยสองส่วน:
•      The SDIO adapter block จัดให้มีฟังชั่นทั้งหมดเฉพาะกับ the MMC/SD/SD I/O card อย่างเช่น the clock generation unit,
        command and data transfer.
•      The AHB interface เข้าถึง the SDIO adapter registers, และสร้าง interrupt และ DMA request signals.

(https://i.imgur.com/1yn0Xj7.png)

โดยค่าเริ่มต้น SDIO_D0 ถูกใช้สำหรับ data transfer. หลังจากเริ่มต้น, the host สามารถเปลี่ยน the databus width.

ถ้า a MultiMediaCard ถูกเชื่อมต่อถึง the bus, SDIO_D0, SDIO_D[3:0] or SDIO_D[7:0] สามารถถูกใช้สำหรับ data transfer. MMC V3.31 หรือก่อนหน้า, รองรับเพียง 1 bit ของ data ดังนั้นมีเพียง SDIO_D0 สามารถถูกใช้.

ถ้า an SD or SD I/O card ถูกเชื่อมต่อถึง the bus, data transfer สามารถถูกกำหนดค่าโดย the host เพื่อใช้ SDIO_D0 or SDIO_D[3:0]. data lines ทั้งหมดจะทำงานใน push-pull mode.

SDIO_CMD มีสอง operational modes:
•      Open-drain สำหรับการเริ่มต้น (เฉพาะสำหรับ MMCV3.31 หรือก่อนหน้า)
•      Push-pull สำหรับ command transfer (SD/SD I/O card MMC4.2 ใช้ push-pull drivers ด้วยสำหรับการเริ่มต้น)

SDIO_CK คือ the clock ไปยัง the card: one bit ถูกส่งถ่ายบนทั้ง command and data lines ด้วยแต่ละ clock cycle. The clock frequency สามารถเปลี่ยนแปลงได้ระหว่าง 0 MHz and 20 MHz (สำหรับ a MultiMediaCard V3.31), ระหว่าง 0 and 48 MHz สำหรับ a MultiMediaCard V4.0/4.2, หรือระหว่าง 0 and 25 MHz (สำหรับ an SD/SD I/O card).

The SDIO ใช้สอง clock signals:
•      SDIO adapter clock (SDIOCLK = HCLK)
•      AHB bus clock (HCLK/2)

PCLK2 and SDIO_CK clock frequencies ต้องเป็นไปตามเงื่อนไขต่อไปนี้:

(https://i.imgur.com/M5ULpMo.png)

The signals ที่แสดงใน Table 137 ถูกใช้บน the MultiMediaCard/SD/SD I/O card bus.

(https://i.imgur.com/t4BxvhP.png)
Title: Re: STM32F1 SDIO
Post by: tha on March 25, 2022, 06:30:32 AM
22.3.1 SDIO adapter

Figure 213 แสดง a simplified block diagram ของ an SDIO adapter.

(https://i.imgur.com/rwuKB2X.png)

The SDIO adapter คือ a multimedia/secure digital memory card bus master ที่จัดให้มี an interface ไปยัง a multimedia card stack หรือไปยัง a secure digital memory card. มันประกอบด้วยห้าหน่วยย่อย:

•      Adapter register block
•      Control unit
•      Command path
•      Data path
•      Data FIFO

Note: The adapter registers and FIFO ใช้ the AHB bus clock domain (HCLK/2). The control unit, command path and data path ใช้ the SDIO adapter clock domain (SDIOCLK).
Title: Re: STM32F1 SDIO
Post by: tha on March 25, 2022, 07:15:32 AM
Adapter register block

The adapter register block บรรจุ system registers ทั้งหมด. block นี้สร้าง the signals ที่เคลียร์ the static flags ใน the multimedia card ด้วย. The clear signals ถูกสร้างเมื่อ 1 ถูกเขียนลงในตำแหน่งบิตที่ตรงกันใน the SDIO Clear register.
Title: Re: STM32F1 SDIO
Post by: tha on March 26, 2022, 08:58:41 AM
Control unit

The control unit บรรจุ the power management functions และ the clock divider สำหรับ the memory card clock.

มีสาม power phases:
•     power-off
•     power-up
•     power-on

(https://i.imgur.com/LVRE9Kz.png)

The control unit ถูกแสดงใน Figure 214. มันประกอบด้วย a power management sub-unit และ a clock management sub-unit.

The power management subunit จะปิดการใช้งาน the card bus output signals ในระหว่าง the power-off และ power-up phases.

The clock management subunit สร้างและควบคุม the SDIO_CK signal. The SDIO_CK output สามารถใช้อย่างใดอย่างหนึ่ง the clock divide หรือ the clock bypass mode. The clock output จะไม่ทำงานเมื่อ:

•     หลังจาก reset
•     ในระหว่าง the power-off หรือ power-up phases
•     ถ้า the power saving mode ถูกเปิดการใช้งานและ the card bus อยู่ใน the Idle state (แปด clock periods หลังจากทั้ง the
       command และ data path subunits เข้าสู่ the Idle phase)
Title: Re: STM32F1 SDIO
Post by: tha on March 26, 2022, 09:50:02 AM
Command path

The command path unit ส่ง commands ไปยังและรับ responses จาก the cards.

(https://i.imgur.com/ecNgoq2.png)

•     Command path state machine (CPSM)
       –   เมื่อ the command register ถูกเขียนถึงและ the enable bit ถูกเซ็ต, command transfer จะสตาร์ท. เมื่อ the
            command ถูกส่งแล้ว, the command path state machine (CPSM) จะเซ็ต the status flags และเข้าสู่ the Idle state
            ถ้า a response ไม่ถูกต้องการ. ถ้า a response ถูกต้องการ, มันจะรอสำหรับ the response (ดู Figure 216). เมื่อ the
            response ถูกรับ, the received CRC code และ the internally generated code จะถูกเปรียบเทียบกัน, และ the
            appropriate status flags จะถูกเซ็ต.
Title: Re: STM32F1 SDIO
Post by: tha on March 26, 2022, 01:53:08 PM
(https://i.imgur.com/cZogU69.png)

เมื่อ 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.
Title: Re: STM32F1 SDIO
Post by: tha on March 27, 2022, 09:02:25 AM
(https://i.imgur.com/LqrV5CY.png)

•    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.

(https://i.imgur.com/zKhdmEK.png)
Title: Re: STM32F1 SDIO
Post by: tha on March 27, 2022, 09:54:33 AM
    –   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.

(https://i.imgur.com/oUVNpxX.png)
Title: Re: STM32F1 SDIO
Post by: tha on March 27, 2022, 10:44:31 AM
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:

(https://i.imgur.com/j8OmJba.png)
Title: Re: STM32F1 SDIO
Post by: tha on March 27, 2022, 10:58:22 AM
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.

(https://i.imgur.com/8HeqT1e.png)
Title: Re: STM32F1 SDIO
Post by: tha on March 28, 2022, 06:51:24 AM
Data path

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

(https://i.imgur.com/tie3lpW.png)

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.
Title: Re: STM32F1 SDIO
Post by: tha on March 28, 2022, 08:32:30 AM
Data path state machine (DPSM)

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

(https://i.imgur.com/nF5Y8hV.png)

•    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.
Title: Re: STM32F1 SDIO
Post by: tha on March 29, 2022, 07:00:37 AM
•    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.
Title: Re: STM32F1 SDIO
Post by: tha on March 29, 2022, 07:32:34 AM
•    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:
Title: Re: STM32F1 SDIO
Post by: tha on March 29, 2022, 08:07:52 AM
•    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.
Title: Re: STM32F1 SDIO
Post by: tha on March 29, 2022, 08:30:10 AM
•    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:
Title: Re: STM32F1 SDIO
Post by: tha on March 29, 2022, 09:27:15 AM
•    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.
Title: Re: STM32F1 SDIO
Post by: tha on March 29, 2022, 09:46:03 AM
•    Data: data สามารถถูกส่งถ่าย the card ไปยัง the host หรือในทางกลับกัน. Data ถูกส่งถ่ายผ่านทาง the data lines. พวกมันถูกเก็บ
     ใน a FIFO of 32 words, แต่ละ word เป็น 32 bits wide.

(https://i.imgur.com/xgRQsxi.png)
Title: Re: STM32F1 SDIO
Post by: tha on March 30, 2022, 06:59:41 AM
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 ถูกยืนยัน
Title: Re: STM32F1 SDIO
Post by: tha on March 30, 2022, 08:51:08 AM
•    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.

(https://i.imgur.com/Sjd2MCD.png)
Title: Re: STM32F1 SDIO
Post by: tha on March 30, 2022, 09:58:43 AM
•    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.

(https://i.imgur.com/F0N55tN.png)
Title: Re: STM32F1 SDIO
Post by: tha on March 31, 2022, 07:13:09 AM
22.3.2 SDIO AHB interface

The AHB interface สร้าง the interrupt and DMA requests, และเข้าถึง the SDIO adapter registers และ the data FIFO. มันประกอบด้วย a data path, register decoder, และ interrupt/DMA logic.

SDIO interrupts

The interrupt logic สร้าง an interrupt request signal ที่ถูกยืนยันเมื่ออย่างน้อยหนึ่งของ the selected status flags เป็น high. A mask register ถูกจัดให้มีเพื่อให้สามารถเลือกเงื่อนไขที่จะสร้าง an interrupt. A status flag สร้าง the interrupt request ถ้า a corresponding mask flag ถูกเซ็ต.

SDIO/DMA interface: ขั้นตอนสำหรับ data transfers ระหว่าง the SDIO and memory

ในตัวอย่างที่แสดง, การส่งถ่ายจาก the SDIO host controller ไปยัง an MMC (512 bytes โดยใช้ CMD24 (WRITE_BLOCK). The SDIO FIFO ถูกเติมด้วย data ที่เก็บใน a memory โดยใช้ the DMA controller.
Title: Re: STM32F1 SDIO
Post by: tha on March 31, 2022, 08:48:29 AM
1.    กระทำ the card identification process
2.    เพิ่ม the SDIO_CK frequency
3.    เลือก the card โดยการส่ง CMD7
4.    กำหนดค่า the DMA2 ดังต่อไปนี้ :
      a)   เปิดการใช้งาน DMA2 controller และเคลียร์ interrupts ใดๆที่ค้างอยู่
      b)   โปรแกรม the DMA2_Channel4 source address register ด้วย the memory location's base address และ
            DMA2_Channel4 destination address register ด้วย the SDIO_FIFO register address
      c)   โปรแกรม DMA2_Channel4 control register (memory เพิ่ม, peripheral ไม่เพิ่ม, peripheral and source width เป็น
            word size)
      d)   เปิดการใช้งาน DMA2_Channel4
Title: Re: STM32F1 SDIO
Post by: tha on March 31, 2022, 09:34:45 AM
5.    ส่ง CMD24 (WRITE_BLOCK) ดังต่อไปนี้ :
      a)   โปรแกรม the SDIO data length register (SDIO data timer register ควรถูกโปรแกรมแล้วก่อน the card
            identification process)
      b)   โปรแกรม the SDIO argument register ด้วย the address location of the card ที่ data จะถูกส่งถ่าย
      c)   โปรแกรม the SDIO command register: CmdIndex ด้วย 24 (WRITE_BLOCK); WaitResp ด้วย '1' (SDIO card
            host รอสำหรับ a response); CPSMEN ด้วย '1' (SDIO card host ถูกเปิดการใช้งานเพื่อส่ง a command). ส่วนฟิลด์อื่นๆ
            อยู่ที่ค่ารีเซ็ตของพวกมัน.
      d)   รอสำหรับ SDIO_STA[6] = CMDREND interrupt, จากนั้นโปรแกรม the SDIO data control register: DTEN ด้วย '1'
            (SDIO card host ถูกเปิดการใช้งานเพื่อส่ง data); DTDIR ด้วย '0' (จาก controller ไปยัง card); DTMODE ด้วย '0'
            (block data transfer); DMAEN ด้วย '1' (DMA ถูกเปิดการใช้งาน); DBLOCKSIZE ด้วย 0x9 (512 bytes). ส่วนฟิลด์อื่นๆ
            ไม่ต้องสนใจ.
      e)   รอสำหรับ SDIO_STA[10] = DBCKEND
6. เช็คว่าไม่มี channels ใดยังคงถูกเปิดการใช้งานอยู่โดยการวนตรวจสอบ the DMA Enabled Channel Status register.
Title: Re: STM32F1 SDIO
Post by: tha on April 01, 2022, 08:08:58 AM
22.4 Card functional description

22.4.1 Card identification mode

ขณะอยู่ใน card identification mode, the host รีเซ็ต cards ทั้งหมด, ตรวจสอบความถูกต้อง the operation voltage range, แยกแยะ cards และเซ็ต a relative card address (RCA) สำหรับแต่ละ card บน the bus. All data communications ใน the card identification mode ใช้ the command line (CMD) เท่านั้น.
Title: Re: STM32F1 SDIO
Post by: tha on April 01, 2022, 08:17:46 AM
22.4.2 Card reset

The GO_IDLE_STATE command (CMD0) คือ the software reset command และมันผลัก the MultiMediaCard and SD memory ลงใน the Idle state. The IO_RW_DIRECT command (CMD52) รีเซ็ต the SD I/O card. หลังจาก power-up หรือ CMD0, all cards output bus drivers อยู่ใน the highimpedance state และ the cards ถูกเริ่มต้นด้วย a default relative card address (RCA=0x0001) และด้วย a default driver stage register setting (ความเร็วต่ำสุด, highest driving current capability).
Title: Re: STM32F1 SDIO
Post by: tha on April 01, 2022, 09:36:50 AM
22.4.3 Operating voltage range validation

All cards สามารถสื่อสารกับ the SDIO card host โดยใช้ any operating voltage ภายใน the specification range. The supported minimum and maximum VDD values ถูกกำหนดใน the operation conditions register (OCR) บน the card.

Cards ที่เก็บ the card identification number (CID) และ card specific data (CSD) ใน the payload memory สามารถสื่อสาร information นี้ได้เฉพาะภายใต้ data-transfer VDD conditions. เมื่อ the SDIO card host module และ the card มีย่าน VDD ที่เข้ากันไม่ได้, the card ไม่สามารถเสร็จสมบูรณ์ the identification cycle และไม่สามารถส่ง CSD data. สำหรับจุดมุ่งหมายนี้, the special commands, SEND_OP_COND (CMD1), SD_APP_OP_COND (ACMD41 สำหรับ SD Memory), และ IO_SEND_OP_COND (CMD5 สำหรับ SD I/O), ถูกออกแบบเพื่อจัดให้มีกลไกเพื่อแยกแยะและทิ้ง cards ที่ไม่ตรงกับ the VDD range ที่ต้องการโดย the SDIO card host. The SDIO card host ส่ง the required VDD voltage window เป็น the operand ของคำสั่งเหล่านี้. Cards ที่ไม่สามารถดำเนินการ data transfer ใน the specified range จะตัดออกจาก the bus และไปยัง the inactive state.

โดยการใช้ commands เหล่านี้โดยไม่มีการรวม(include) the voltage range เป็น the operand, the SDIO card host สามารถสอบถามแต่ละcard และกำหนด the common voltage range ก่อนการวาง out of-range cards ลงใน the inactive state. การสอบถามนี้ถูกใช้เมื่อ the SDIO card host สามารถเลือก a common voltage range หรือเมื่อผู้ใช้ต้องการการแจ้งให้ทราบว่า cards ไม่สามารถใช้ได้.
Title: Re: STM32F1 SDIO
Post by: tha on April 02, 2022, 08:31:59 AM
22.4.4 Card identification process

The card identification process แตกต่างกันสำหรับ MultiMediaCards และ SD cards. สำหรับ MultiMediaCard cards, the identification process สตาร์ทที่ clock rate Fod. The SDIO_CMD line output drivers เป็น open-drain และยอมให้ parallel card operation ในระหว่างขบวนการนี้. The registration process ถูกทำให้สำเร็จได้ดังต่อไปนี้:
Title: Re: STM32F1 SDIO
Post by: tha on April 02, 2022, 08:41:55 AM
1.   The bus ถูกเปิดใช้งาน.
2.   The SDIO card host ออกอากาศ(broadcasts) SEND_OP_COND (CMD1) เพื่อรับ operation conditions.
3.   The response คือ the wired AND operation ของ the operation condition registers จากทุก cards.
4.   Incompatible cards ถูกวางลงใน the inactive state.
5.   The SDIO card host ออกอากาศ(broadcasts) ALL_SEND_CID (CMD2) ไปยังทุก active cards.
Title: Re: STM32F1 SDIO
Post by: tha on April 02, 2022, 09:15:01 AM
6.   The active cards ส่งพร้อมกัน their CID numbers แบบอนุกรม. Cards ที่มี outgoing CID bits ที่ไม่ตรงกับ the bits บน the
      command line จะหยุดการส่งและต้องรอสำหรับ the next identification cycle. เมื่อ card ส่งเสร็จ a full CID ไปยัง the SDIO
      card host และเข้าสู่ the Identification state
7.   The SDIO card host ปล่อยออก SET_RELATIVE_ADDR (CMD3) ไปยัง card นั้น. address ใหม่นี้ถูกเรียกว่า the relative card
      address (RCA); มันสั้นกว่า the CID และแอดเดรส the card. The assigned card เปลี่ยนไปยัง the Standby state, มันจะไม่
      ตอบสนองต่อ identification cycles ต่อไป, และ output ของมันจะสวิทช์จาก open-drain ไปเป็น push-pull.
8.   The SDIO card host ทำซ้ำขั้นตอน 5 ถึง 7 จนกว่ามันรับ a timeout condition.
Title: Re: STM32F1 SDIO
Post by: tha on April 02, 2022, 10:27:54 AM
สำหรับ the SD card, the identification process สตาร์ทที่ clock rate Fod, และ the SDIO_CMD line output drives เป็น push-pull drivers แทน open-drain. The registration process ถูกทำให้สำเร็จได้ดังต่อไปนี้:

1.   The bus ถูกเปิดใช้งาน.
2.   The SDIO card host ออกอากาศ(broadcasts) SD_APP_OP_COND (ACMD41).
3.   The cards ตอบสนองด้วยสิ่งที่บรรจุอยู่ภายในของ their operation condition registers.
4.   Incompatible cards ถูกวางลงใน the inactive state.
5.   The SDIO card host ออกอากาศ(broadcasts) ALL_SEND_CID (CMD2) ไปยังทุก active cards.
Title: Re: STM32F1 SDIO
Post by: tha on April 02, 2022, 10:38:27 AM
6.   The cards ส่งกลับ their unique card identification numbers (CIDs) และเข้าสู่ the Identification state.
7.   The SDIO card host ปล่อยออก SET_RELATIVE_ADDR (CMD3) ไปยัง an active card พร้อมกับ an address. address ใหม่
      นี้ถูกเรียกว่า the relative card address (RCA); มันสั้นกว่า the CID และแอดเดรส the card. The assigned card เปลี่ยนไปยัง
      the Standby state. The SDIO card host สามารถปล่อยออกซ้ำคำสั่งนี้เพื่อเปลี่ยน the RCA. The RCA of the card เป็นค่าที่
      กำหนดล่าสุด
8.   The SDIO card host ทำซ้ำขั้นตอน 5 ถึง 7 กับทุก active cards.
Title: Re: STM32F1 SDIO
Post by: tha on April 02, 2022, 10:47:04 AM
สำหรับ the SD I/O card, the registration process ถูกทำให้สำเร็จได้ดังต่อไปนี้:

1.   The bus ถูกเปิดใช้งาน.
2.   The SDIO card host ส่ง IO_SEND_OP_COND (CMD5).
3.   The cards ตอบสนองด้วยสิ่งที่บรรจุอยู่ภายในของ their operation condition registers.
4.   Incompatible cards ถูกเซ็ตไปยัง the inactive state.
5.   The SDIO card host ปล่อยออก SET_RELATIVE_ADDR (CMD3) ไปยัง an active card พร้อมกับ an address. address
      ใหม่นี้ถูกเรียกว่า the relative card address (RCA); มันสั้นกว่า the CID และแอดเดรส the card. The assigned card เปลี่ยน
      ไปยัง the Standby state. The SDIO card host สามารถปล่อยออกซ้ำคำสั่งนี้เพื่อเปลี่ยน the RCA. The RCA of the card เป็น
      ค่าที่กำหนดล่าสุด
Title: Re: STM32F1 SDIO
Post by: tha on April 03, 2022, 09:29:30 AM
22.4.5 Block write

ในระหว่าง block write (CMD24 - 27) อย่างน้อยหนึ่ง blocks of data ถูกส่งถ่ายจาก the host ไปยัง the card พร้อมกับ a CRC ต่อท้าย the end ของแต่ละ block โดย the host. A card supporting block write สามารถยอมรับ a block of data ที่กำหนดโดย WRITE_BL_LEN เสมอ. ถ้า the CRC ล้มเหลว, the card แสดงให้เห็น the failure บน the SDIO_D line และ the transferred data ถูกละทิ้งและไม่ถูกเขียน, และ blocks ที่จะส่งต่อไปทั้งหมด (ใน multiple(หลาย) block write mode) ถูกละเว้น.
Title: Re: STM32F1 SDIO
Post by: tha on April 03, 2022, 10:40:44 AM
ถ้า the host ใช้ partial blocks ที่ความยาวสะสมไม่เป็น block aligned และ, block misalignment ไม่ถูกอนุญาติ (CSD parameter WRITE_BLK_MISALIGN ไม่ถูกเซ็ต), the card จะตรวจพบ the block misalignment error ก่อนการเริ่มต้นของ the first misaligned block. (ADDRESS_ERROR error bit ถูกเซ็ตใน the status register). The write operation จะถูกยกเลิกด้วยถ้า the host พยายามเขียนบน a write-protected area. ในกรณีนี้, อย่างไรก็ตาม, the card จะเซ็ต the WP_VIOLATION bit.
Title: Re: STM32F1 SDIO
Post by: tha on April 03, 2022, 11:18:40 AM
การโปรแกรมของ the CID and CSD registers ไม่ต้องการ a previous block length setting. The transferred data เป็น CRC protected ด้วย. ถ้าส่วนหนึ่งของ the CSD or CID register ถูกเก็บใน ROM, ดังนั้น unchangeable part นี้ต้องตรงกับ the corresponding part of the receive buffer. ถ้าการตรงกันนี้ล้มเหลว, ดังนั้น the card รายงาน an error และไม่เปลี่ยน any register contents. Some cards อาจต้องการเวลาที่ยาวและไม่สามารถคาดเดาได้เพื่อเขียน a block of data. หลังจากการรับ a block of data และเสร็จ the CRC check, the card เริ่มการเขียนและยึด the SDIO_D line ต่ำ(low) ถ้า write buffer ของมันเต็มและไม่สามารถยอมรับ new data จาก a new WRITE_BLOCK command. The host อาจวนตรวจสอบ the status of the card ด้วย a SEND_STATUS command (CMD13) ที่เวลาใดๆ, และ the card จะตอบสนองด้วย status ของมัน. The READY_FOR_DATA status bit แสดงให้เห็นว่า the card สามารถยอมรับ new data ได้หรือไม่หรือว่า the write process กำลังดำเนินการอยู่หรือไม่. The host อาจยกเลิกการเลือก the card โดยการปล่อยออก CMD7 (เพื่อเลือกการ์ดอื่น), ซึ่งจะวาง the card ใน the Disconnect state และปลดปล่อย the SDIO_D line(s) โดยปราศจากการขัดจังหวะ the write operation. เมื่อเลือก the card ซ้ำ, มันจะเปิดใช้งานการบ่งชี้ว่าไม่ว่างอีกครั้งโดยการดึง SDIO_D เป็น low ถ้าการโปรแกรมกำลังดำเนินการอยู่และ the write buffer ไม่พร้อมใช้งาน.
Title: Re: STM32F1 SDIO
Post by: tha on April 04, 2022, 06:29:17 AM
22.4.6 Block read

ใน Block read mode หน่วยพื้นฐานของ data transfer คือ a block ที่ maximum size ถูกกำหนดใน the CSD (READ_BL_LEN). ถ้า READ_BL_PARTIAL ถูกเซ็ต, smaller blocks ที่ start and end addresses ถูกบรรจุทั้งหมดภายใน one physical block (ตามที่กำหนดโดย READ_BL_LEN) อาจถูกส่งด้วย. A CRC ถูกต่อท้ายไปยัง the end ของแต่ละ block, เพื่อให้แน่ใจว่า data transfer integrity. CMD17 (READ_SINGLE_BLOCK) เริ่มต้น a block read และหลังจากเสร็จสมบูรณ์ the transfer, the card คืนกลับไปยัง the Transfer state.

CMD18 (READ_MULTIPLE_BLOCK) สตาร์ท a transfer ของ several consecutive blocks.
Title: Re: STM32F1 SDIO
Post by: tha on April 04, 2022, 07:18:08 AM
The host สามารถยกเลิกการอ่านได้ทุกเมื่อ, ภายใน a multiple block operation, โดยไม่คำนึงถึงชนิดของมัน. Transaction abort ถูกทำโดยการส่ง the stop transmission command.

ถ้า the card ตรวจพบ an error (ตัวอย่างเช่น, out of range, address misalignment หรือ internal error) ในระหว่าง a multiple block read operation (ทั้งสองชนิด) มันหยุด the data transmission และยังคงอยู่ใน the data state. The host ต้องยกเลิก the operation โดยการส่ง the stop transmission command. The read error ถูกรายงานในการตอบสนองต่อ the stop transmission command.
Title: Re: STM32F1 SDIO
Post by: tha on April 04, 2022, 07:48:34 AM
ถ้า the host ส่ง a stop transmission command หลังจาก the card ส่ง the last block ของ a multiple block operation ที่มีจำนวนที่กำหนดไว้ล่วงหน้าของ blocks, มันถูกตอบสนองถึงว่าเป็น an illegal command, เนื่องจาก the card ไม่อยู่ใน the data state อีกต่อไป. ถ้า the host ใช้ partial blocks ที่ accumulated length ไม่เป็น block-aligned และ block misalignment ไม่ถูกอนุญาติ, the card ตรวจพบ a block misalignment error condition ที่จุดเริ่มต้นของ the first misaligned block
(ADDRESS_ERROR error bit ถูกเซ็ตใน the status register).
Title: Re: STM32F1 SDIO
Post by: tha on April 05, 2022, 07:23:44 AM
22.4.7 Stream access, stream write and stream read (MultiMediaCard only)

ใน stream mode, data ถูกส่งถ่ายเป็น bytes และไม่มี CRC ถูกต่อท้ายที่ the end ของแต่ละ block.

Stream write (MultiMediaCard only)

WRITE_DAT_UNTIL_STOP (CMD20) สตาร์ท the data transfer จาก the SDIO card host ไปยัง the card, เริ่มต้นที่ the specified address และต่อเนื่องจนกระทั่ง the SDIO card host ปล่อยออก a stop command. เมื่อ partial blocks ถูกอนุญาติ (CSD parameter WRITE_BL_PARTIAL ถูกเซ็ต), the data stream สามารถ start and stop ที่ any address ภายใน the card address space, มิฉะนั้นมันสามารถ start and stop ได้เฉพาะที่ block boundaries. เนื่องจากจำนวนของ data ที่จะถูกส่งถ่ายไม่ได้ถูกกำหนดไว้ล่วงหน้า, a CRC ไม่สามารถถูกใช้. เมื่อ the end of the memory range ถูกถึงในขณะการส่ง data และไม่มี stop command ถูกส่งโดย the SD card host, any additional transferred data จะถูกละทิ้ง.
Title: Re: STM32F1 SDIO
Post by: tha on April 05, 2022, 07:55:02 AM
The maximum clock frequency สำหรับ a stream write operation ถูกให้โดยฟิลด์สมการต่อไปนี้ของ the card-specific data register:

(https://i.imgur.com/URR87pP.png)

•     Maximumspeed = maximum write frequency
•     TRANSPEED = maximum data transfer rate
•     writebllen = maximum write data block length
•     NSAC = data read access time 2 in CLK cycles
•     TAAC = data read access time 1
•     R2WFACTOR = write speed factor

ถ้า the host พยายามใช้ a higher frequency, the card อาจไม่สามารถประมวลผล the data และหยุดการเขียนโปรแกรม, เซ็ต the OVERRUN error bit ใน the status register, และในขณะที่เพิกเฉย data transfer ต่อไปทั้งหมด, รอ (ใน the receive data state) สำหรับ a stop command. The write operation ถูกยกเลิกด้วยถ้า the host พยายามเขียนบน a write-protected area. ในกรณีนี้, อย่างไรก็ตาม, the card เซ็ต the WP_VIOLATION bit.
Title: Re: STM32F1 SDIO
Post by: tha on April 05, 2022, 09:21:58 AM
Stream read (MultiMediaCard only)

READ_DAT_UNTIL_STOP (CMD11) ควบคุม a stream-oriented data transfer.

command นี้สั่งให้ the card ส่ง data ของมัน, สตาร์ทที่ a specified address, จนกระทั่ง the SDIO card host ส่ง STOP_TRANSMISSION (CMD12). The stop command มี an execution delay เนื่องจาก the serial command transmission และ the data transfer หยุดหลังจาก the end bit ของ the stop command. เมื่อ the end ของ the memory range ถูกถึงในขณะการส่ง data และไม่มี stop command ถูกส่งโดย the SDIO card host, any subsequent data sent ถูกพิจารณาว่าไม่ได้กำหนด.
Title: Re: STM32F1 SDIO
Post by: tha on April 05, 2022, 09:32:42 AM
The maximum clock frequency สำหรับ a stream read operation ถูกให้โดยสมการต่อไปนี้และใช้ฟิลด์ของ the card specific data register.

(https://i.imgur.com/wDQE3AT.png)

•     Maximumspeed = maximum read frequency
•     TRANSPEED = maximum data transfer rate
•     readbllen = maximum read data block length
•     writebllen = maximum write data block length
•     NSAC = data read access time 2 in CLK cycles
•     TAAC = data read access time 1
•     R2WFACTOR = write speed factor

ถ้า the host พยายามใช้ a higher frequency, the card ไม่สามารถประคับประคอง data transfer. ถ้าสิ่งนี้เกิดขึ้น, the card เซ็ต the UNDERRUN error bit ใน the status register, ยกเลิก the transmission และรอใน the data state สำหรับ a stop command.
Title: Re: STM32F1 SDIO
Post by: tha on April 06, 2022, 05:43:03 AM
22.4.8 Erase: group erase and sector erase

The erasable unit of the MultiMediaCard คือ the erase group. The erase group ถูกวัดเป็น write blocks, ซึ่งเป็น the basic writable units of the card. The size of the erase group เป็น a card-specific parameter และถูกกำหนดใน the CSD.

The host สามารถลบช่วงที่ต่อเนื่องกันของ Erase Groups. การสตาร์ท the erase process คือลำดับสามขั้นตอน.

ขั้นแรก the host กำหนด the start address of the range โดยใช้ the ERASE_GROUP_START (CMD35) command, ถัดไปมันกำหนด the last address of the range โดยใช้ the ERASE_GROUP_END (CMD36) command และ, สุดท้าย, มันสตาร์ท the erase process โดยการปล่อยออก the ERASE (CMD38) command. The address field ใน the erase commands คือ an Erase Group address เป็น byte units. The card เพิกเฉย all LSBs ที่อยุ่ใต้ the Erase Group size, ปัดเศษ the address อย่างมีประสิทธิภาพลงไปยัง the Erase Group boundary.
Title: Re: STM32F1 SDIO
Post by: tha on April 06, 2022, 06:12:34 AM
ถ้า an erase command ถูกรับไม่เป็นลำดับ, the card เซ็ต the ERASE_SEQ_ERROR bit ใน the status register และรีเซ็ตลำดับทั้งหมด.

ถ้า an out-of-sequence (ไม่ใช่ทั้งสองอย่างของ the erase commands, ยกเว้น SEND_STATUS) command ที่รับ, the card เซ็ต the ERASE_RESET status bit ใน the status register, รัเซ็ต the erase sequence และปฏิบัติ the last command.

ถ้า the erase range รวม write protected blocks อยู่, พวกมันจะถูกทิ้งไว้ไม่ถูกแตะต้องและมีเพียง nonprotected blocks เท่านั้นที่ถูกลบ. The WP_ERASE_SKIP status bit ใน the status register ถูกเซ็ต.

The card แสดงให้เห็นว่า an erase กำลังดำเนินการอยู่โดยการยึด SDIO_D low. The actual erase time อาจค่อนข้างนาน, และ the host อาจปล่อยออก CMD7 เพื่อยกเลิกการเลือก the card.
Title: Re: STM32F1 SDIO
Post by: tha on April 06, 2022, 07:46:40 AM
22.4.9 Wide bus selection or deselection

Wide bus (4-bit bus width) operation mode ถูกเลือกหรือถูกยกเลิกการเลือกโดยใช้ SET_BUS_WIDTH (ACMD6). The default bus width หลังจาก power-up หรือ GO_IDLE_STATE (CMD0) คือ 1 bit. SET_BUS_WIDTH (ACMD6) ใช้ได้เฉพาะใน a transfer state, ซึ่งหมายความว่า the bus width สามารถถูกเปลี่ยนได้เฉพาะหลังจาก a card ถูกเลือกโดย SELECT/DESELECT_CARD (CMD7).
Title: Re: STM32F1 SDIO
Post by: tha on April 07, 2022, 06:12:01 AM
22.4.10 Protection management

Three write protection methods สำหรับ the cards ถูกรองรับใน the SDIO card host module:
1.    internal card write protection (card responsibility)
2.    mechanical write protection switch (SDIO card host module responsibility only)
3.    password-protected card lock operation

Internal card write protection

Card data สามารถถูกป้องกันต่อต้านการเขียนหรือการลบ. โดยการเซ็ตถาวรหรือชั่วคราว write-protect bits ใน the CSD, the entire card สามารถป้องกันการเขียนอย่างถาวรโดยผู้ผลิตหรือผู้ให้บริการเนื้อหา. สำหรับ cards ที่รองรับ write protection ของ groups ของ sectors โดยการเซ็ต the WP_GRP_ENABLE bit ใน the CSD, ส่วนของ the data สามารถถูกป้องกัน, และ the write protection สามารถถูกเปลี่ยนโดย the application. The write protection อยู่ในหน่วยของ WP_GRP_SIZE sectors ตามที่ระบุใน the CSD. The SET_WRITE_PROT and CLR_WRITE_PROT commands ควบคุม the protection of the addressed group. The SEND_WRITE_PROT command คล้ายกับ a single block read command. The card ส่ง a data block บรรจุ 32 write protection bits (หมายถึง 32 write protect groups เริ่มต้นที่ the specified address) ตามด้วย 16 CRC bits. The address field ใน the write protect commands คือ a group address เป็น byte units.

The card จะละเลย LSBs ทั้งหมดข้างล่าง the group size.
Title: Re: STM32F1 SDIO
Post by: tha on April 07, 2022, 07:02:39 AM
Mechanical write protect switch

A mechanical sliding tab บนด้านข้างของ the card ยอมให้ the user เซ็ตหรือเคลียร์ the write protection บน a card. เมื่อ the sliding tab ถูกวางตำแหน่งที่ the window open, the card ถูกป้องกันการเขียน, และ when the window ถูกปิด, the card contents สามารถถูกเปลี่ยนได้. A matched switch บน the socket side แสดงให้เห็นไปยัง the SDIO card host module ว่า the card ถูกป้องกันการเขียน. The SDIO card host module รับผิดชอบสำหรับการป้องกัน the card. The position of the write protect switch ไม่ถูกรับรู้ไปยังวงจรภายในของ the card.
Title: Re: STM32F1 SDIO
Post by: tha on April 07, 2022, 08:13:01 AM
Password protect

The password protection feature เปิดการใช้งาน the SDIO card host module เพื่อล็อคและปลดล็อค a card ด้วย a password. The password ถูกเก็บใน the 128-bit PWD register และขนาดของมันถูกเซ็ตใน  the 8-bit PWD_LEN register. registers เหล่านี้เป็น nonvolatile ดังนั้น a power cycle ไม่ลบพวกมัน. การ์ดที่ล็อคไว้จะตอบสนองและดำเนินการคำสั่งบางอย่าง. หมายความว่า the SDIO card host module ได้รับอนุญาตให้รีเซ็ต, เริ่มต้น, เลือก, และสอบถามสำหรับ status, however it is not allowed to access data on the card. อย่างไรก็ตาม มันไม่ถูกอนุญาตให้เข้าถึง data บน the card. เมื่อ the password ถูกเซ็ต (ตามที่แสดงให้เห็นโดยค่าที่ไม่เป็นศูนย์ของ PWD_LEN), the card ถูกล็อคโดยอัจโนมัติหลังจาก power-up. เช่นเดียวกับ the CSD and CID register write commands, the lock/unlock commands มีให้ใช้ประโยชน์ใน the transfer state เท่านั้น. ในสถานะนี้, the command ไม่มี(include) an address argument และ the card ต้องถูกเลือกก่อนการใช้มัน. The card lock/unlock commands มี the structure and bus transaction types ของ a regular single-block write command. The transferred data block รวมทั้งหมดของ the required information สำหรับ the command (the password setting mode, the PWD ของมันเอง, และ card lock/unlock). The command data block size ถูกกำหนดโดย the SDIO card host module ก่อนมันส่ง the card lock/unlock command, และมี the structure ที่แสดงใน Table 158.
Title: Re: STM32F1 SDIO
Post by: tha on April 07, 2022, 08:32:09 AM
The bit settings เป็นดังต่อไปนี้ :
•    ERASE: การเซ็ตมันบังคับ an erase operation. บิตอื่นทั้งหมดต้องเป็นศูนย์, และเฉพาะ the command byte ถูกส่ง
•    LOCK_UNLOCK: การเซ็ตมันล็อค the card. LOCK_UNLOCK สามารถถูกเซ็ตพร้อมกันกับ SET_PWD, อย่างไรก็ตามไม่กับ
      CLR_PWD
•    CLR_PWD: การเซ็ตมันเคลียร์ the password data
•    SET_PWD: การเซ็ตมันบันทึก the password data ไปยัง memory
•    PWD_LEN: มันกำหนดความยาวของ the password เป็น bytes
•    PWD: the password (ใหม่หรือปัจจุบันที่ใช้, ขึ้นอยู่กับ the command)
Title: Re: STM32F1 SDIO
Post by: tha on April 07, 2022, 09:44:20 AM
Setting the password

1.    เลือก a card (SELECT/DESELECT_CARD, CMD7), ถ้าไม่มีอะไรถูกเลือกอยู่.
2.    กำหนด the block length (SET_BLOCKLEN, CMD16) ที่จะส่ง, ที่ให้โดย the 8-bit card lock/unlock mode, the 8-bit
       PWD_LEN, และจำนวนของ bytes ของ the new password. เมื่อ a password replacement ถูกทำ, the block size ต้อง
       คำนึงถึงว่าทั้ง the old and the new passwords ถูกส่งพร้อมกับ the command.
3.    ส่ง LOCK/UNLOCK (CMD42) พร้อมกับ the appropriate data block size บน the data line รวม the 16-bit CRC. The
       data block แสดงให้เห็น the mode (SET_PWD = 1), the length (PWD_LEN), และ the password (PWD) มันเอง. เมื่อ
       a password replacement ถูกทำ, the length value (PWD_LEN) รวมความยาวของทั้งสอง passwords, ของเก่าและของใหม่,
       และ the PWD field รวม the old password (ที่ใช้ปัจจุบัน) ตามด้วย the new password.
4.    เมื่อ the password ตรงกัน, the new password and its size ถูกบันทึกลงใน the PWD and PWD_LEN fields, ตามลำดับ.
       เมื่อ the old password sent ไม่ตรงกัน (ในขนาดและ/หรือสิ่งที่บรรจุอยู่ภายใน) กับ the expected password, the
       LOCK_UNLOCK_FAILED error bit ถูกเซ็ตใน the card status register, และ the password ไม่ถูกเปลี่ยน.

The password length field (PWD_LEN) แสดงให้เห็นว่า a password ถูกเซ็ตไว้ปัจจุบันหรือไม่. เมื่อ field นี้ไม่เป็นศูนย์, มี a password set และ the card ล็อคตัวเองหลังจาก power-up. มันเป็นไปได้ที่จะล็อค the card ทันทีใน the current power session โดยการเซ็ต the LOCK_UNLOCK bit (ขณะตั้ง the password) หรือส่ง an additional command สำหรับ card locking.
Title: Re: STM32F1 SDIO
Post by: tha on April 07, 2022, 10:15:37 AM
Resetting the password

1.    เลือก a card (SELECT/DESELECT_CARD, CMD7), ถ้าไม่มีอะไรถูกเลือกอยู่.
2.    กำหนด the block length (SET_BLOCKLEN, CMD16) ที่จะส่ง, ที่ให้โดย the 8-bit card lock/unlock mode, the 8-bit
       PWD_LEN, และจำนวนของ bytes ใน the currently used password.
3.    ส่ง LOCK/UNLOCK (CMD42) พร้อมกับ the appropriate data block size บน the data line รวม the 16-bit CRC. The
       data block แสดงให้เห็น the mode (CLR_PWD = 1), the length (PWD_LEN), และ the password (PWD) มันเอง. The
       LOCK_UNLOCK bit ถูกละเลย.
4.    เมื่อ the password ตรงกัน, the PWD field ถูกเคลียร์และ PWD_LEN ถูกเซ็ตเป็น. เมื่อ the password sent ไม่ตรงกัน (ในขนาด
       และ/หรือสิ่งที่บรรจุอยู่ภายใน) กับ the expected password, the LOCK_UNLOCK_FAILED error bit ถูกเซ็ตใน the card
       status register, และ the password ไม่ถูกเปลี่ยน.
Title: Re: STM32F1 SDIO
Post by: tha on April 08, 2022, 06:31:20 AM
Locking a card

1.    เลือก a card (SELECT/DESELECT_CARD, CMD7), ถ้าไม่มีอะไรถูกเลือกอยู่.
2.    กำหนด the block length (SET_BLOCKLEN, CMD16) ที่จะส่ง, ที่ให้โดย the 8-bit card lock/unlock mode(byte 0 ใน
       Table 158), the 8-bit PWD_LEN, และจำนวนของ bytes ใน the current password.
3.    ส่ง LOCK/UNLOCK (CMD42) พร้อมกับ the appropriate data block size บน the data line รวม the 16-bit CRC. The
       data block แสดงให้เห็น the mode (LOCK_UNLOCK = 1), the length (PWD_LEN), และ the password (PWD) มันเอง.
4.    เมื่อ the password ตรงกัน,  the card ถูกล็อคและ the CARD_IS_LOCKED status bit ถูกเซ็ตใน the card status
       register. เมื่อ the password sent ไม่ตรงกัน (ในขนาดและ/หรือสิ่งที่บรรจุอยู่ภายใน) กับ the expected password, the
       LOCK_UNLOCK_FAILED error bit ถูกเซ็ตใน the card status register, และ the lock ล้มเหลว.

มันเป็นไปได้ที่จะเซ็ต the password และล็อค the card ใน the same sequence. ในกรณีนี้, the SDIO card host module  กระทำขั้นตอนที่จำเป็นทั้งหมดสำหรับการตั้งค่า the password (ดู Setting the password), อย่างไรก็ตาม จำเป็นต้องเซ็ต the LOCK_UNLOCK bit ใน Step 3 เมื่อ the new password command ถูกส่ง

เมื่อ the password ถูกเซ็ตไว้ก่อนหน้านี้ (PWD_LEN ไม่เป็น 0), the card ถูกล็อคโดยอัตโนมัติหลังจาก power on reset. ความพยายามเพื่อล็อค a locked card หรือเพื่อล็อค a card ที่ไม่มี a password จะล้มเหลวและ the LOCK_UNLOCK_FAILED error bit ถูกเซ็ตใน the card status register.
Title: Re: STM32F1 SDIO
Post by: tha on April 08, 2022, 08:30:56 AM
Unlocking the card

1.    เลือก a card (SELECT/DESELECT_CARD, CMD7), ถ้าไม่มีอะไรถูกเลือกอยู่.
2.    กำหนด the block length (SET_BLOCKLEN, CMD16) ที่จะส่ง, ที่ให้โดย the 8-bit card lock/unlock mode(byte 0 ใน
       Table 158), the 8-bit PWD_LEN, และจำนวนของ bytes ใน the current password.
3.    ส่ง LOCK/UNLOCK (CMD42) พร้อมกับ the appropriate data block size บน the data line รวม the 16-bit CRC. The
       data block แสดงให้เห็น the mode (LOCK_UNLOCK = 0), the length (PWD_LEN), และ the password (PWD) มันเอง.
4.    เมื่อ the password ตรงกัน,  the card ถูกปลดล็อคและ the CARD_IS_LOCKED status bit ถูกเคลียร์ใน the card status
       register. เมื่อ the password sent ไม่ถูกต้องในขนาดและ/หรือสิ่งที่บรรจุอยู่ภายใน และไม่ตรงกันกับ the expected password,
       the LOCK_UNLOCK_FAILED error bit ถูกเซ็ตใน the card status register, และ  the card ยังคงถูกล็อค

The unlocking function ใช้ได้เฉพาะสำหรับ the current power session. เมื่อ the PWD field ไม่ถูกเคลียร์, the card ถูกล็อคโดยอัตโนมัติบน the next power-up.

ความพยายามปลดล็อค an unlocked card จะล้มเหลวและ the LOCK_UNLOCK_FAILED error bit ถูกเซ็ตใน the card status register.
Title: Re: STM32F1 SDIO
Post by: tha on April 08, 2022, 09:42:45 AM
Forcing erase

ถ้าผู้ใช้ลืม the password (PWD content), มันสามารถเป็นได้ที่จะเข้าถึง the card หลังจากการเคลียร์ the data ทั้งหมดบน the card. forced erase operation นี้จะลบ all card data และ all password data.

1.    เลือก a card (SELECT/DESELECT_CARD, CMD7), ถ้าไม่มีอะไรถูกเลือกอยู่.
2.    เซ็ต the block length (SET_BLOCKLEN, CMD16) เป็น 1 byte. เฉพาะ the 8-bit card lock/unlock byte (byte 0 ใน
       Table 158) ถูกส่ง.
3.    ส่ง LOCK/UNLOCK (CMD42) พร้อมกับ the appropriate data block size บน the data line รวม the 16-bit CRC. The
       data block แสดงให้เห็น the mode (ERASE = 1). บิตอื่นๆทั้งหมดต้องเป็นศูนย์.
4.    เมื่อ the ERASE bit เพียงบิตเดียวที่ถูกเซ็ตใน the data field, all card contents จะถูกลบ, รวมถึง the PWD and PWD_LEN
       fields, และ the card ไม่ถูกล็อคอีกต่อไป. เมื่อบิตอื่นใดๆถูกเซ็ต, the LOCK_UNLOCK_FAILED error bit ถูกเซ็ตใน the card
       status register และ the card จะรักษา data ของมันทั้งหมดไว้, และยังคงถูกล็อค.

ความพยายามใช้ a force erase บน an unlocked card จะล้มเหลวและ the LOCK_UNLOCK_FAILED error bit ถูกเซ็ตใน the card status register.
Title: Re: STM32F1 SDIO
Post by: tha on April 09, 2022, 06:18:14 AM
22.4.11 Card status register

The response format R1 บรรจุ a 32-bit field ชื่อ card status. ฟิลด์นี้มีวัตถุประสงค์เพื่อส่ง the card status information (ซึ่งอาจถูกเก็บใน a local status register) ไปยัง the host. หากไม่ได้ระบุไว้เป็นอย่างอื่น, รายการสถานะจะเกี่ยวข้องกับ the previously issued command เสมอ.

Table 145 กำหนดรายการต่าง ๆ ของ the status. The type and clear condition fields ใน the table ถูกย่อดังต่อไปนี้:

Type:
•    E: error bit
•    S: status bit
•    R: ที่ตรวจพบและเซ็ตสำหรับ the actual command response
•    X: ที่ตรวจพบและเซ็ตในระหว่าง command execution. The SDIO card host ต้องวนตรวจสอบ the card โดยการปล่อยออก
          the status command เพื่ออ่านบิตเหล่านี้.

Clear condition:
•    A: สอดคล้องกับ the card current state
•    B: เกี่ยวข้องกับ the previous command เสมอ. การรับ a valid command จะเคลียร์มัน (ที่มี a delay of one command)
•    C: เคลียร์โดยอ่าน

                       (https://i.imgur.com/fuswAwk.png)

                       (https://i.imgur.com/XJ3liGy.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 11, 2022, 06:13:39 AM
                   (https://i.imgur.com/SECeoJo.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 11, 2022, 06:32:56 AM
22.4.12 SD status register

The SD status บรรจุ status bits ที่เกี่ยวข้องกับ the SD memory card proprietary features และอาจถูกใช้สำหรับ future application-specific usage. The size of the SD Status คือ one data block of 512 bits. สิ่งที่บรรจุอยู่ภายในของ register นี้ถูกส่งไปยัง the SDIO card host ถ้า ACMD13 ถูกส่ง (CMD55 ตามด้วย CMD13). ACMD13 สามารถถูกส่งไปยัง a card ใน transfer state เท่านั้น (card ถูกเลือก).

Table 146 กำหนดรายการต่าง ๆ ของ the SD status register. The type and clear condition fields ใน the table ถูกย่อดังต่อไปนี้:

Type:
•    E: error bit
•    S: status bit
•    R: ที่ตรวจพบและเซ็ตสำหรับ the actual command response
•    X: ที่ตรวจพบและเซ็ตในระหว่าง command execution. The SDIO card host ต้องวนตรวจสอบ the card โดยการปล่อยออก the
          status command เพื่ออ่านบิตเหล่านี้.

Clear condition:
•    A: สอดคล้องกับ the card current state
•    B: เกี่ยวข้องกับ the previous command เสมอ. การรับ a valid command จะเคลียร์มัน (ที่มี a delay of one command)
•    C: เคลียร์โดยอ่าน

              (https://i.imgur.com/sic2uXJ.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 11, 2022, 06:59:01 AM
SIZE_OF_PROTECTED_AREA

การเซ็ตฟิลด์นี้แตกต่างกันระหว่าง standard- และ high-capacity cards. ในกรณีของ a standard-capacity card, the capacity of protected area ถูกคำนวณดังต่อไปนี้:
          Protected area = SIZE_OF_PROTECTED_AREA_* MULT * BLOCK_LEN.
          SIZE_OF_PROTECTED_AREA ถูกระบุโดยหน่วยเป็น MULT*BLOCK_LEN.

ในกรณีของ a high-capacity card, the capacity of protected area ถูกระบุในฟิลด์นี้:
          Protected area = SIZE_OF_PROTECTED_AREA
          SIZE_OF_PROTECTED_AREA ถูกระบุโดยหน่วยเป็น bytes.
Title: Re: STM32F1 SDIO
Post by: tha on April 21, 2022, 05:40:22 AM
SPEED_CLASS

This 8-bit field แสดงให้เห็น the speed class และ the value ที่สามารถถูกคำนวณโดย Pw/2 (ที่ Pw คือ the write performance).
(https://i.imgur.com/7L9N8Xg.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 21, 2022, 05:44:50 AM
PERFORMANCE_MOVE

This 8-bit field แสดงให้เห็น Pm (performance move) และ the value สามารถถูกเซ็ตได้ 1 [MB/sec] ขั้น. ถ้า the card ไม่ย้ายโดยใช้ RUs (recording units), Pm ควรถูกพิจารณาว่าเป็นอนันต์. การเซ็ต the field เป็น FFh จะหมายถึงอนันต์.
(https://i.imgur.com/7mpsJjG.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 21, 2022, 05:54:48 AM
AU_SIZE

This 4-bit field แสดงให้เห็น the AU size และ the value สามารถถูกเลือกเป็นกำลังของ 2 (the power of 2) ฐานตั้งแต่ 16 KB.
(https://i.imgur.com/xizZm61.png)

The maximum AU size, ซึ่งขึ้นอยู่กับ the card capacity, ถูกกำหนดใน Table 150. The card สามารถถูกเซ็ตเป็น any AU size ระหว่าง RU size และ maximum AU size.
(https://i.imgur.com/FlUaI4Q.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 21, 2022, 06:30:38 AM
ERASE_SIZE

This 16-bit field แสดงให้เห็น NERASE. เมื่อ NERASE numbers of AUs ถูกลบ, the timeout value ถูกระบุโดย ERASE_TIMEOUT (อ้างอิงถึง ERASE_TIMEOUT). The host ควรกำหนด the proper number of AUs ที่จะถูกลบใน one operation ดังนั้น the host สามารถแสดง the progress of the erase operation. ถ้า field นี้ถูกเซ็ตเป็น 0, the erase timeout calculation จะไม่ถูกรองรับ.
(https://i.imgur.com/smmiD9a.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 21, 2022, 06:34:35 AM
ERASE_TIMEOUT

This 6-bit field แสดงให้เห็น TERASE และ the value แสดงให้เห็น the erase timeout จาก offset เมื่อหลาย AUs กำลังถูกลบตามที่ระบุโดย ERASE_SIZE. The range of ERASE_TIMEOUT สามารถถูกกำหนดได้ถึง 63 seconds และ the card manufacturer สามารถเลือกการผสมกันใดๆของ ERASE_SIZE และ ERASE_TIMEOUT ขึ้นอยู่กับการนำไปใช้. การกำหนด ERASE_TIMEOUT กำหนด the ERASE_SIZE.
(https://i.imgur.com/D9sxX4Z.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 21, 2022, 06:35:52 AM
ERASE_OFFSET

This 2-bit field แสดงให้เห็น TOFFSET และหนึ่งในสี่ค่าสามารถถูกเลือก. ฟิลด์นี้จะไม่มีความหมายหากตั้งค่าฟิลด์ ERASE_SIZE และ ERASE_TIMEOUT เป็น 0.
(https://i.imgur.com/frkmcOs.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 21, 2022, 10:06:18 AM
22.4.13 SD I/O mode

SD I/O interrupts

เพื่อยอมให้ the SD I/O card อินเตอร์รัพท์ the MultiMediaCard/SD module, an interrupt function มีให้ใช้ประโยชน์บน a pin บน the SD interface. Pin 8, ที่ใช้เป็น SDIO_D1 เมื่อทำงานใน the 4-bit SD mode,  ส่งสัญญาณ the cards อินเตอร์รัพท์ไปยัง the MultiMediaCard/SD module. การใช้ของ the interrupt เป็นทางเลือกสำหรับแต่ละ card หรือ function ภายใน a card. The SD I/O interrupt เป็น level-sensitive, ซึ่งหมายความว่า the interrupt line ต้องถูกยึด active (low) จนกระทั่งมันอย่างใดอย่างหนึ่ง ได้รับการยอมรับและถูกดำเนินการโดย the MultiMediaCard/SD module หรือยกเลิกการยืนยันเนื่องจาก the end of the interrupt period. หลังจาก the MultiMediaCard/SD module ได้ให้บริการ the interrupt, the interrupt status bit ถูกเคลียร์โดยทาง an I/O เขียนไปยัง the appropriate bit ใน the SD I/O card's internal registers. The interrupt output ของ all SD I/O cards จะ active low และ the application ต้องจัดให้มี pull-up resistors ภายนอกบน all data lines (SDIO_D[3:0]). The MultiMediaCard/SD module สุ่มตรวจ the level of pin 8 (SDIO_D/IRQ) ลงใน the interrupt detector เฉพาะในระหว่าง the interrupt period. ที่เวลาอื่นทั้งหมด, the MultiMediaCard/SD module จะละเว้นค่านี้.

The interrupt period ใช้ได้สำหรับทั้ง memory และ I/O operations. The definition of the interrupt period สำหรับการทำงานกับ single blocks มีความแตกต่างจาก the definition สำหรับ multiple-block data transfers.
Title: Re: STM32F1 SDIO
Post by: tha on April 21, 2022, 12:15:26 PM
SD I/O suspend and resume(ค้างเอาไว้/กลับมาทำงานต่อ)

ภายใน a multifunction SD I/O หรือ a card ที่มีทั้ง I/O และ memory functions, มี multiple devices (I/O and memory) ที่แชร์การเข้าถึงไปยัง the MMC/SD bus. เพื่อแชร์การเข้าถึงไปยัง the MMC/SD module ในหมู่ multiple(หลาย) devices, SD I/O และ combo cards จัดให้มีใช้เป็นทางเลือกแนวคิดของการค้างเอาไว้/การกลับมาทำงานต่อ. เมื่อ a card รองรับ suspend/resume, the MMC/SD module สามารถหยุด a data transfer operation ไปยัง one function or memory(suspend) ชั่วคราวเพื่อปล่อยฟรี the bus สำหรับ a higher-priority transfer ไปยัง a different(อื่น) function or memory. หลังจาก higher-priority transfer นี้เสร็จสมบูณร์, การส่งถ่ายเดิมถูกกลับมาทำงานต่อ (สตาร์ทใหม่) ที่มันเหลือไว้. การรองรับของ suspend/resume เป็นทางเลือกบน a per-card basis. เพื่อดำเนินการ the suspend/resume operation บน the MMC/SD bus, the MMC/SD module ดำเนินการขั้นตอนต่อไปนี้ :

1.   กำหนด the function โดยใช้ปัจจุบัน the SDIO_D [3:0] line(s)
2.   ร้องขอ the lower-priority or slower transaction เพื่อค้างเอาไว้
3.   รอสำหรับ the transaction suspension เสร็จสมบูณร์
4.   เริ่ม the higher-priority transaction
5.   รอสำหรับการเสร็จสมบูณร์ของ the higher priority transaction
6.   กู้คืน the suspended transaction
Title: Re: STM32F1 SDIO
Post by: tha on April 21, 2022, 12:33:52 PM
SD I/O ReadWait

The optional ReadWait (RW) operation ถูกกำหนดเฉพาะสำหรับ the SD 1-bit and 4-bit modes. The ReadWait operation ยอมให้ the MMC/SD module ให้สัญญาน a card ที่มันกำลังอ่าน multiple(หลาย) registers (IO_RW_EXTENDED, CMD53) เพื่อหยุด the data transfer ไว้ชั่วคราวในขณะที่ยอมให้ the MMC/SD module ส่งคำสั่งไปยัง function ใดๆภายใน the SD I/O device. เพื่อกำหนดเมื่อ a card รองรับ the ReadWait protocol, the MMC/SD module ต้องทดสอบ capability bits ใน the internal card registers. The timing สำหรับ ReadWait ขึ้นอยู่กับ the interrupt period.
Title: Re: STM32F1 SDIO
Post by: tha on April 22, 2022, 05:52:46 AM
22.4.14 Commands and responses

Application-specific and general commands

The SD card host module system ถูกออกแบบเเพื่อจัดให้มี a standard interface สำหรับความหลากหลายของ applications types.  ในสภาพแวดล้อมนี้, มีความจำเป็นสำหรับ specific customer/application features. ในการใช้งานคุณลักษณะเหล่านี้, สองชนิดของ generic commands ถูกกำหนดใน the standard: application-specific commands (ACMD) และ general commands (GEN_CMD).

เมื่อ the card รับ the APP_CMD (CMD55) command, the card คาดว่า the next command จะเป็น an application-specific command. ACMDs มี the same structure เหมือนกับ regular MultiMediaCard commands และสามารถมี the same CMD number. The card รับรู้ว่ามันเป็น ACMD เนื่องจากมันปรากฎหลังจาก APP_CMD (CMD55). เมื่อ the command ที่ตาม the APP_CMD (CMD55) ทันทีไม่ใช่ a defined application-specific command, the standard command จะถูกใช้. ตัวอย่างเช่น, เมื่อ the card มีการกำหนดสำหรับ SD_STATUS (ACMD13), และรับ CMD13 ที่ตาม APP_CMD (CMD55) ทันที, สิ่งนี้ถูกตีความว่าเป็น SD_STATUS (ACMD13). อย่างไรก็ตาม, เมื่อ the card รับ CMD7 ที่ตาม APP_CMD (CMD55) ทันทีและ the card ไม่มีการกำหนดสำหรับ ACMD7, สิ่งนี้ถูกตีความว่าเป็น the standard (SELECT/DESELECT_CARD) CMD7.
Title: Re: STM32F1 SDIO
Post by: tha on April 22, 2022, 06:24:06 AM
เพื่อใช้หนึ่งของ the manufacturer-specific ACMDs the SD card Host ต้องดำเนินการขั้นตอนต่อไปนี้:

1.   ส่ง APP_CMD (CMD55)
      The card ตอบสนองต่อ the MultiMediaCard/SD module, แสดงให้เห็นว่า the APP_CMD bit ถูกเซ็ตและ an ACMD ถูกคาด
      ว่าจะมีตอนนี้.

2.   ส่ง the required ACMD
      The card ตอบสนองต่อ the MultiMediaCard/SD module, แสดงให้เห็นว่า the APP_CMD bit ถูกเซ็ตและ the accepted
      command นั้นถูกตีความว่าเป็น an ACMD. เมื่อ a nonACMD ถูกส่ง, มันถูกจัดการโดย the card ดั่ง a normal MultiMediaCard
      command และ the APP_CMD bit ใน the card status register จะเคลียร์ค้างอยู่.
Title: Re: STM32F1 SDIO
Post by: tha on April 22, 2022, 06:46:14 AM
เมื่อ an invalid command ถูกส่ง (ไม่ใช่ทั้ง ACMD หรือ CMD) มันถูกจัดการเป็น a standard MultiMediaCard illegal command error.

The bus transaction สำหรับ a GEN_CMD เป็นอย่างเดียวกับ the single-block read หรือ write commands (WRITE_BLOCK, CMD24 หรือ READ_SINGLE_BLOCK,CMD17). ในกรณีนี้, the argument ใช้แสดงทิศทางของ the data transfer แทนที่จะเป็น the address, และ the data block มีรูปแบบและความหมายเฉพาะของผู้ขาย.

The card ต้องถูกเลือก (ใน transfer state) ก่อนการส่ง GEN_CMD (CMD56). The data block size ถูกกำหนดโดย SET_BLOCKLEN (CMD16). การตอบสนองต่อ GEN_CMD (CMD56) อยู่ใน R1b format.
Title: Re: STM32F1 SDIO
Post by: tha on April 22, 2022, 03:33:51 PM
Command types

ทั้ง application-specific และ general commands ถูกแบ่งออกเป็นสี่ประเภทต่อไปนี้ :
•   broadcast command (BC): ส่งถึง all cards; ไม่มีการตอบกลับ
•   broadcast command with response (BCR): ส่งถึง all cards; การตอบที่รับจาก all cards พร้อมกัน
•   addressed (point-to-point) command (AC): ส่งถึง the card ที่ถูกเลือก; ไม่รวม a data transfer บน the SDIO_D line(s)
•   addressed (point-to-point) data transfer command (ADTC): ส่งถึง the card ที่ถูกเลือก; รวม a data transfer บน the
    SDIO_D line(s).

Command formats

ดู Table 138 สำหรับ command formats.

Commands for the MultiMediaCard/SD module

(https://i.imgur.com/daQZr6f.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 22, 2022, 03:56:44 PM
(https://i.imgur.com/UyC0GXR.png)
(https://i.imgur.com/a7zoxoF.png)
(https://i.imgur.com/GgHmQzu.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 22, 2022, 04:02:39 PM
(https://i.imgur.com/nnBIkRS.png)
(https://i.imgur.com/0k3Fzxw.png)
(https://i.imgur.com/D5SeGwB.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 23, 2022, 06:43:15 AM
22.5 Response formats

All responses ถูกส่งโดยทาง the MCCMD command line SDIO_CMD. The response transmission สตาร์ทด้วย the left bit of the bit string ที่ตรงกับ the response code word เสมอ. The code length ขึ้นอยู่กับ the response type.

A response สตาร์ทด้วย a start bit (0 เสมอ) เสมอ, ถูกตามด้วย the bit ที่แสดง the direction of transmission (card = 0). A value ที่แทนด้วย x ในตารางข้างล่างแสดง a variable entry. All responses, ยกเว้นสำหรับ the R3 response type, ถูกป้องกันโดย a CRC. Every command code word ถูกสิ้นสุดด้วย the end bit (1 เสมอ).

มีห้าชนิดของ responses. รูปแบบของพวกมันถูกกำหนดดังต่อไปนี้:
Title: Re: STM32F1 SDIO
Post by: tha on April 23, 2022, 06:56:44 AM
22.5.1 R1 (normal response command)

Code length = 48 bits. The 45:40 bits แสดง the index of the command ที่จะถูกตอบกลับ, ค่านี้ถูกตีความว่าเป็น a binary-coded number (ระหว่าง 0 and 63). The status of the card ถูกโค้ดใน 32 bits.

(https://i.imgur.com/LXfdOI7.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 23, 2022, 08:54:37 AM
22.5.2 R1b

มันเหมือนกันกับ R1 ที่มี an optional busy signal ที่ส่งบน the data line. The card อาจกลายมาเป็น busy หลังจากได้รับคำสั่งเหล่านี้ขึ้นอยู่กับสถานะของมันก่อน the command reception.
Title: Re: STM32F1 SDIO
Post by: tha on April 23, 2022, 09:17:57 AM
22.5.3 R2 (CID, CSD register)

Code length = 136 bits. สิ่งที่บรรจุอยู่ภายในของ the CID register ถูกส่งเป็นการตอบสนองต่อ the CMD2 and CMD10 commands. The contents of the CSD register ถูกส่งเป็นการตอบสนองต่อ CMD9. เฉพาะ the bits [127...1] of the CID and CSD ถูกส่งถ่าย, the reserved bit [ 0 ] ของ these registers ถูกแทนที่ด้วย the end bit of the response. The card แสดงให้เห็นว่า an erase กำลังดำเนินการโดยการยึด MCDAT low. The actual erase time อาจจะนานทีเดียว, และ the host อาจปล่อยออก CMD7 เพื่อยกเลิกการเลือก the card.

(https://i.imgur.com/BVpFwrQ.png)
(https://i.imgur.com/RcPuBcS.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 23, 2022, 09:41:43 AM
22.5.4 R3 (OCR register)

Code length: 48 bits. The contents of the OCR register ถูกส่งเป็นการตอบสนองต่อ CMD1. The level coding เป็นดังต่อไปนี้: restricted voltage windows = low, card busy = low.

(https://i.imgur.com/mdF2nxf.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 23, 2022, 09:50:23 AM
22.5.5 R4 (Fast I/O)

Code length: 48 bits. The argument field บรรจุ the RCA of the addressed card, the register address ที่ถูกอ่านออกหรือถูกเขียนถึง, และ content ของมัน.

(https://i.imgur.com/c3VgRy1.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 25, 2022, 05:54:09 AM
22.5.6 R4b

สำหรับ SD I/O เท่านั้น: an SDIO card ที่ได้รับ the CMD5 จะตอบสนองด้วย a unique SDIO response R4. The format คือ:

(https://i.imgur.com/5PXpm43.png)

เมื่อ an SD I/O card ได้รับ a CMD5, the I/O portion อขง card นั้นจะถูกเปิดการใช้งานเพื่อตอบสนองต่อคำสั่งต่อไปทั้งหมดตามปกติ. I/O enable ของ the function ภายใน the I/O card นี้จะยังคงเซ็ตจนกระทั่ง a reset, power cycle หรือ CMD52 ที่มีการเขียนถึง I/O reset ถูกได้รับโดย the card. โปรดทราบว่า an SD memory-only card อาจตอบสนองต่อ a CMD5. The proper response สำหรับ a memory-only card จะเป็น Present memory = 1 และ Number of I/O functions = 0. A memory-only card ถูกสร้างเพื่อให้ตรงตาม the SD Memory Card specification version 1.0 จะตรวจพบ the CMD5 เป็น an illegal command และไม่ตอบสนอง. The I/O aware host จะส่ง CMD5. ถ้า the card ตอบสนองด้วย response R4, the host กำหนด the card's configuration ขึ้นอยู่กับ the data ที่บรรจุอยู่ภายใน the R4 response.
Title: Re: STM32F1 SDIO
Post by: tha on April 25, 2022, 06:40:45 AM
22.5.7 R5 (interrupt request)

เฉพาะสำหรับ MultiMediaCard. Code length: 48 bits. ถ้า the response ถูกสร้างโดย the host, the RCA field ใน the argument จะเป็น 0x0.

(https://i.imgur.com/jZfvtVA.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 25, 2022, 06:54:21 AM
22.5.8 R6

เฉพาะสำหรับ SD I/O. The normal response ต่อ CMD3 โดย a memory device. มันถูกแสดงใน Table 166.

(https://i.imgur.com/9b3f09n.png)

The card [23:8] status bits ถูกเปลี่ยนเมื่อ CMD3 ถูกส่งไปยัง an I/O-only card. ในกรณีนี้, the 16 bits of response คือ the SD I/O-only values:
•   Bit [15] COM_CRC_ERROR
•   Bit [14] ILLEGAL_COMMAND
•   Bit [13] ERROR
•   Bits [12:0] Reserved
Title: Re: STM32F1 SDIO
Post by: tha on April 25, 2022, 08:50:29 AM
22.6 SDIO I/O card-specific operations

คุณลักษณะต่อไปนี้เป็น SD I/O-specific operations:
•   SDIO read wait operation โดยการส่งสัญญาน SDIO_D2
•   SDIO read wait operation โดยการหยุด the clock
•   SDIO suspend/resume operation (write and read suspend)
•   SDIO interrupts

The SDIO รองรับการทำงานเหล่านี้เฉพาะถ้า the SDIO_DCTRL[11] bit ถูกเซ็ต, ยกเว้นสำหรับ read suspend ที่ไม่ต้องการ specific hardware implementation.
Title: Re: STM32F1 SDIO
Post by: tha on April 25, 2022, 10:08:57 AM
22.6.1 SDIO I/O read wait operation by SDIO_D2 signalling

มันเป็นไปได้ที่จะสตาร์ท the readwait interval ก่อน the first block ถูกรับ: เมื่อ the data path ถูกเปิดการใช้งาน (SDIO_DCTRL[0] bit set), the SDIO-specific operation ถูกเปิดการใช้งาน (SDIO_DCTRL[11] bit set), read wait สตาร์ท (SDI0_DCTRL[10] =0 and SDI_DCTRL[8] =1) และ data direction คือจาก card ไปยัง SDIO (SDIO_DCTRL[1] = 1), the DPSM ย้ายโดยตรงจาก Idle ไปยัง Readwait. ใน Readwait the DPSM ขับ SDIO_D2 เป็น 0 หลังจาก 2 SDIO_CK clock cycles. ในสถานะนี้, เมื่อคุณเซ็ต the RWSTOP bit (SDIO_DCTRL[9]), the DPSM ยังคงอยู่ใน Wait เป็นเวลาอีกสอง SDIO_CK clock cycles เพื่อขับ SDIO_D2 เป็น 1 เป็นเวลา one clock cycle (สอดคล้องกันกับ SDIO specification). The DPSM จะสตาร์ทการรออีกครั้งจนกระทั่งมันได้รับ data จาก the card. The DPSM จะไม่สตาร์ท a readwait interval ในขณะที่รับ a block even ถ้า read wait start ถูกเซ็ต: the readwait interval จะสตาร์ทหลังจาก the CRC ถูกรับ. The RWSTOP bit ต้องถูกเคลียร์เพื่อสตาร์ท a new read wait operation. ในระหว่าง the readwait interval, the SDIO สามารถตรวจจับ SDIO interrupts บน SDIO_D1.
Title: Re: STM32F1 SDIO
Post by: tha on April 25, 2022, 10:36:26 AM
22.6.2 SDIO read wait operation by stopping SDIO_CK

ถ้า the SDIO card ไม่รองรับ the previous read wait method, the SDIO สามารถดำเนินการ a read wait โดยการหยุด SDIO_CK (SDIO_DCTRL ถูกเซ็ตเหมือนใน the method ที่แสดงใน Section 22.6.1, แต่ SDIO_DCTRL[10] =1): DSPM หยุด the clock สอง SDIO_CK cycles หลังจาก the end bit of the current received block และสตาร์ท the clock อีกครั้งหลังจาก the read wait start bit ถูกเซ็ต.

เมื่อ SDIO_CK ถูกหยุด, any command สามารถถูกปล่อยออกไปยัง the card. ในระหว่าง a read/wait interval, the SDIO สามารถตรวจจับ SDIO interrupts บน SDIO_D1.
Title: Re: STM32F1 SDIO
Post by: tha on April 25, 2022, 11:05:34 AM
22.6.3 SDIO suspend/resume operation

ในขณะที่ส่ง data ไปยัง the card, the SDIO สามารถค้าง the write operation ไว้. the SDIO_CMD[11] bit ถูกเซ็ตและแสดงไปยัง the CPSM ว่า the current command คือ a suspend command. The CPSM วิเคราะห์ the response และเมื่อ the ACK ถูกได้รับจาก the card (suspend ถูกยอมรับ), มันรับทราบ(ตอบรับ) the DPSM ที่ไป Idle หลังจากการรับ the CRC token of the current block.

The hardware ไม่บันทึก the number of the remaining block ที่จะถูกส่งเพื่อเสร็จสมบูรณ์ the suspended operation (resume).

The write operation สามารถถูก suspend โดย software, เพียงโดยการปิดการใช้งาน the DPSM (SDIO_DCTRL[0] =0) เมื่อ the ACK of the suspend command ถูกได้รับจาก the card. The DPSM จะเข้าสู่ the Idle state.

เพื่อค้าง a read: the DPSM รอใน the Wait_r state เนื่องจาก the function ที่ถูกค้างส่ง a complete packet เมื่อก่อนการหยุด the data transaction. The application อ่าน RxFIFO อย่างต่อเนื่องจนกระทั่ง the FIF0 ว่างเปล่า, และ the DPSM ไป Idle โดยอัตโนมัติ.
Title: Re: STM32F1 SDIO
Post by: tha on April 25, 2022, 11:06:17 AM
22.6.4 SDIO interrupts

SDIO interrupts ถูกตรวจจับบน the SDIO_D1 line เมื่อ the SDIO_DCTRL[11] bit ถูกเซ็ต.
Title: Re: STM32F1 SDIO
Post by: tha on April 26, 2022, 05:35:46 AM
22.7 CE-ATA specific operations

คุณลักษณะต่อไปนี้เป็น CE-ATA specific operations:
•   ส่ง the command completion signal disable ไปยัง the CE-ATA device
•   รับ the command completion signal จาก the CE-ATA device
•   ส่งสัญญาน the completion of the CE-ATA command ไปยัง the CPU, โดยใช้ the status bit และ/หรือ interrupt.

The SDIO รองรับการทำงานเหล่านี้เฉพาะสำหรับ the CE-ATA CMD61 command, นั่นคือ, ถ้า SDIO_CMD[14] ถูกเซ็ต.
Title: Re: STM32F1 SDIO
Post by: tha on April 26, 2022, 06:08:20 AM
22.7.1 Command completion signal disable

Command completion signal disable คือการส่ง 8 bit cycles หลังจาก the reception of a short response ถ้า the 'enable CMD completion' bit, SDIO_CMD[12], ไม่ถูกเซ็ตและ the 'not interrupt Enable' bit, SDIO_CMD[13], ถูกเซ็ต.

The CPSM เข้าสู่ the Pend state, การโหลด the command shift register ด้วย the disable sequence "00001" และ, the command counter ด้วย 43. Eight cycles หลังจาก, a trigger ย้าย the CPSM ไปยัง the Send state. เมื่อ the command counter ถึง 48, the CPSM กลายมาเป็น Idle เนื่องจากไม่มี response ถูกรอ.
Title: Re: STM32F1 SDIO
Post by: tha on April 26, 2022, 07:18:57 AM
22.7.2 Command completion signal enable

ถ้า the 'enable CMD completion' bit SDIO_CMD[12] ถูกเซ็ตและ the 'not interrupt Enable' bit SDIO_CMD[13] ถูกเซ็ต, the CPSM รอสำหรับ the command completion signal ใน the Waitcpl state.

เมื่อ '0' ถูกรับบน the CMD line, the CPSM เข้าสู่ the Idle state. ไม่มี new command สามารถถูกส่งเป็นเวลา 7 bit cycles. ดังนั้น, สำหรับ the last 5 cycles (จาก the 7) the CMD line ถูกขับเป็น '1' ใน push-pull mode.
Title: Re: STM32F1 SDIO
Post by: tha on April 26, 2022, 07:28:41 AM
22.7.3 CE-ATA interrupt

The command completion ถูกส่งสัญญานไปยัง the CPU โดย the status bit SDIO_STA[23]. This static bit สามารถถูกเคลียร์ด้วย the clear bit SDIO_ICR[23].

The SDIO_STA[23] status bit สามารถสร้าง an interrupt บนแต่ละ interrupt line, ขึ้นอยู่กับ the mask bit SDIO_MASKx[23].
Title: Re: STM32F1 SDIO
Post by: tha on April 26, 2022, 08:16:07 AM
22.7.4 Aborting CMD61

ถ้า the command completion disable signal ยังไม่ถูกส่งและ CMD61 จำเป็นต้องยกเลิก, the command state machine ต้องถูกปิดการใช้งาน. มันจากนั้นกลายมาเป็น Idle, และ the CMD12 command สามารถถูกส่ง. ไม่มี command completion disable signal ถูกส่งในระหว่าง the operation.
Title: Re: STM32F1 SDIO
Post by: tha on April 26, 2022, 08:41:11 AM
22.8 HW flow control

The HW flow control functionality ถูกใช้เพื่อหลีกเลี่ยง FIFO underrun (TX mode) และ overrun (RX mode) errors.

ลักษณะการทำงานคือหยุด SDIO_CK และแช่แข็ง SDIO state machines. The data transfer ถูกทำให้หยุดชะงักในขณะที่ the FIFO ไม่สามารถที่จะส่งหรือรับ data. มีเพียง state machines ที่ให้สัญญานนาฬิกาโดย SDIOCLK ถูกแช่แข็ง, the AHB interface ยังคงมีชีวิตอยู่. The FIFO จึงสามารถถูกเติมหรือทำให้ว่างเปล่าได้ถึงแม้ว่า flow control ถูกทำให้ทำงาน.

เพื่อเปิดการใช้งาน HW flow control, the SDIO_CLKCR[14] register bit ต้องถูกเซ็ตเป็น 1. หลีงจากการรีเซ็ต Flow Control จะถูกปิดการใช้งาน.
Title: Re: STM32F1 SDIO
Post by: tha on April 27, 2022, 06:09:34 AM
22.9 SDIO registers

The device สื่อสารถึง the system โดยทาง 32-bit-wide control registers เข้าถึงได้โดยทาง AHB.

The peripheral registers ต้องถูกเข้าถึงด้วย words (32-bit).

22.9.1 SDIO power control register (SDIO_POWER)

Address offset: 0x00
Reset value: 0x0000 0000

(https://i.imgur.com/pslmaLL.png)

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

[1:0] PWRCTRL: Power supply control bits.
บิตเหล่านี้ถูกใช้เพื่อกำหนด the current functional state of the card clock:
     00: Power-off: the clock ไปยัง card ถูกหยุด.
     01: Reserved
     10: Reserved power-up
     11: Power-on: the card ถูกให้สัญญานนาฬิกา.

Note: อย่างน้อย seven HCLK clock periods ถูกต้องการระหว่าง two write เข้าถึงไปยัง register นี้.
Title: Re: STM32F1 SDIO
Post by: tha on April 27, 2022, 07:32:46 AM
22.9.2 SDI clock control register (SDIO_CLKCR)

Address offset: 0x04
Reset value: 0x0000 0000
The SDIO_CLKCR register ควบคุม the SDIO_CK output clock.

(https://i.imgur.com/trqjXaR.png)

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

Bit 14 HWFC_EN: HW Flow Control enable
     0b: HW Flow Control ถูกปิดการใช้งาน
     1b: HW Flow Control ถูกเปิดการใช้งาน
เมื่อ HW Flow Control ถูกเปิดการใช้งาน, ความหมายของ the TXFIFOE and RXFIFOF interrupt signals, ดู SDIO Status register definition ใน Section 22.9.11.

Bit 13 NEGEDGE:SDIO_CK dephasing selection bit
     0b: SDIO_CK ถูกสร้างบน the rising edge of the master clock SDIOCLK
     1b: SDIO_CK ถูกสร้างบน the falling edge of the master clock SDIOCLK

Bits 12:11 WIDBUS: Wide bus mode enable bit
     00: Default bus mode: SDIO_D0 ถูกใช้
     01: 4-wide bus mode: SDIO_D[3:0] ถูกใช้
     10: 8-wide bus mode: SDIO_D[7:0] ถูกใช้
Title: Re: STM32F1 SDIO
Post by: tha on April 27, 2022, 08:05:32 AM
Bit 10 BYPASS: Clock divider bypass enable bit
     0: Disable bypass: SDIOCLK ถูกหารสอดคล้องกันกับ the CLKDIV value ก่อนการขับ the SDIO_CK output signal.
     1: Enable bypass: SDIOCLK ขับโดยตรง the SDIO_CK output signal.

Bit 9 PWRSAV: Power saving configuration bit
เพื่อ power saving, the SDIO_CK clock output สามารถถูกปิดการใช้งานเมื่อ the bus is idle โดยการเซ็ต PWRSAV:
     0: SDIO_CK clock ถูกเปิดการใช้งานเสมอ
     1: SDIO_CK ถูกเปิดการใช้งานเฉพาะเมื่อ the bus is active
Title: Re: STM32F1 SDIO
Post by: tha on April 27, 2022, 08:39:26 AM
Bit 8 CLKEN: Clock enable bit
     0: SDIO_CK ถูกปิดการใช้งาน
     1: SDIO_CK ถูกเปิดการใช้งาน

Bits 7:0 CLKDIV: Clock divide factor
ฟิลด์นี้กำหนด the divide factor ระหว่าง the input clock (SDIOCLK) และ the output clock (SDIO_CK):
SDIO_CK frequency = SDIOCLK / [CLKDIV + 2].

Note: ในขณะที่ the SD/SDIO card หรือ MultiMediaCard อยู่ใน identification mode, the SDIO_CK frequency ต้องน้อยกว่า
         400 kHz.

         The clock frequency สามารถถูกเปลี่ยนเป็น the maximum card bus frequency เมื่อ relative card addresses ถูก
         กำหนดไปยัง all cards.

         อย่างน้อย seven HCLK clock periods ถูกต้องการระหว่าง two write เข้าถึงไปยัง register นี้. SDIO_CK สามารถถูกหยุดใน
         ระหว่าง the read wait interval สำหรับ SD I/O cards อีกด้วย: ในกรณีนี้ the SDIO_CLKCR register ไม่ควบคุม
         SDIO_CK.
Title: Re: STM32F1 SDIO
Post by: tha on April 28, 2022, 05:54:59 AM
22.9.3 SDIO argument register (SDIO_ARG)

Address offset: 0x08
Reset value: 0x0000 0000
The SDIO_ARG register บรรจุ a 32-bit command argument, ซึ่งถูกไปยัง a card เป็นส่วนหนึ่งของ a command message.

(https://i.imgur.com/8qQt7qP.png)

Bits 31:0 CMDARG: Command argument
Command argument ส่งไปยัง a card เป็นส่วนหนึ่งของ a command message. ถ้า a command บรรจุ an argument, มันต้องถูกโหลดลงใน register นี้ก่อนการเขียน a command ไปยัง the command register.
Title: Re: STM32F1 SDIO
Post by: tha on April 29, 2022, 06:44:29 AM
22.9.4 SDIO command register (SDIO_CMD)

Address offset: 0x0C
Reset value: 0x0000 0000

The SDIO_CMD register บรรจุ the command index และ command type bits. The command index ถูกส่งไปยัง a card เป็นส่วนหนึ่งของ a command message. The command type bits ควบคุม the command path state machine (CPSM).

(https://i.imgur.com/HOoZ6ru.png)
Title: Re: STM32F1 SDIO
Post by: tha on April 29, 2022, 07:04:55 AM
Bits 31:15 สงวนไว้, ต้องถูกเก็บที่ reset value.

Bit 14 ATACMD: CE-ATA command
     ถ้า ATACMD ถูกเซ็ต, the CPSM ส่งถ่าย CMD61.

Bit 13 nIEN: not Interrupt Enable
     ถ้า this bit เป็น 0, interrupts ใน the CE-ATA device ถูกเปิดการใช้งาน.

Bit 12 ENCMDcompl: Enable CMD completion
     ถ้าบิตนี้ถูกเซ็ต, the command completion signal ถูกเปิดการใช้งาน.

Bit 11 SDIOSuspend: SD I/O suspend command
     ถ้าบิตนี้ถูกเซ็ต, the command ที่ถูกส่งคือ a suspend command (ถูกใช้เฉพาะกับ SDIO card).

Bit 10 CPSMEN: Command path state machine (CPSM) Enable bit
     ถ้าบิตนี้ถูกเซ็ต, the CPSM ถูกเปิดการใช้งาน.

Bit 9 WAITPEND: CPSM Waits for ends of data transfer (CmdPend internal signal).
     ถ้าบิตนี้ถูกเซ็ต, the CPSM รอสำหรับ the end of data transfer ก่อนมันสตาร์ทการส่ง a command.

Bit 8 WAITINT: CPSM waits for interrupt request
     ถ้าบิตนี้ถูกเซ็ต, the CPSM ปิดการใช้งาน command timeout และรอสำหรับ an interrupt request.
Title: Re: STM32F1 SDIO
Post by: tha on April 29, 2022, 08:21:16 AM
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.
Title: Re: STM32F1 SDIO
Post by: tha on April 30, 2022, 06:35:39 AM
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).

(https://i.imgur.com/G6v6NEz.png)

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

Bits 5:0 RESPCMD: Response command index
     Read-only bit field. บรรจุ the command index ของ the last command response received(ที่รับ).
Title: Re: STM32F1 SDIO
Post by: tha on April 30, 2022, 07:00:25 AM
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.
(https://i.imgur.com/jeLwVpN.png)
Bits 31:0 CARDSTATUSx: ดู Table 167.

The Card Status size คือ 32 หรือ 127 bits, ขึ้นอยู่กับ the response type.
(https://i.imgur.com/3zENxhZ.png)
The most significant bit of the card status ถูกรับก่อน. The SDIO_RESP3 register LSB เป็น 0b เสมอ.
Title: Re: STM32F1 SDIO
Post by: tha on May 01, 2022, 08:15:22 AM
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 จะถูกเซ็ต.

(https://i.imgur.com/svDaXg3.png)

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.
Title: Re: STM32F1 SDIO
Post by: tha on May 01, 2022, 08:34:39 AM
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 สตาร์ท.

(https://i.imgur.com/oh5syhM.png)

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.
Title: Re: STM32F1 SDIO
Post by: tha on May 02, 2022, 06:39:25 AM
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).

(https://i.imgur.com/nM5QkFh.png)

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 ถูกเปิดการใช้งาน.
Title: Re: STM32F1 SDIO
Post by: tha on May 02, 2022, 07:18:52 AM
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 นี้.
Title: Re: STM32F1 SDIO
Post by: tha on May 02, 2022, 08:02:21 AM
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, ถูกเซ็ต.

(https://i.imgur.com/RGSIPiW.png)

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 เสร็จสมบูรณ์.
Title: Re: STM32F1 SDIO
Post by: tha on May 03, 2022, 05:47:35 AM
22.9.11 SDIO status register (SDIO_STA)

Address offset: 0x34
Reset value: 0x0000 0000

The SDIO_STA register เป็น a read-only register. มันบรรจุ two types of flag:
•   Static flags (bits [23:22,10:0]): บิตเหล่านี้ยังคงยืนยันจนกระทั่งพวกมันถูกเคลียร์โดยการเขียนไปยัง the SDIO Interrupt Clear
     register (see SDIO_ICR)
•   Dynamic flags (bits [21:11]): บิตเหล่านี้เปลี่ยนสถานะขึ้นอยู่กับ the state of the underlying logic (ตัวอย่างเช่น, FIFO full
     and empty flags ถูกยืนยันและถูกยกเลิกการยืนยันตาม data ขณะเขียนไปยัง the FIFO)

(https://i.imgur.com/jL5RGsU.png)
Title: Re: STM32F1 SDIO
Post by: tha on May 03, 2022, 06:42:00 AM
Bits 31:24 Reserved, must be kept at reset value.
Bit 23 CEATAEND: CE-ATA command completion signal ที่รับสำหรับ CMD61
Bit 22 SDIOIT: SDIO interrupt ที่รับ
Bit 21 RXDAVL: Data มีให้ใช้ใน receive FIFO
Bit 20 TXDAVL: Data มีให้ใช้ใน transmit FIFO
Bit 19 RXFIFOE: Receive FIFO ว่างเปล่า
Bit 18 TXFIFOE: Transmit FIFO ว่างเปล่า
     เมื่อ HW Flow Control ถูกเปิดการใช้งาน, TXFIFOE signals กลายมาเป็น activated เมื่อ the FIFO บรรจุ 2 words.
Bit 17 RXFIFOF: Receive FIFO เต็ม
     เมื่อ HW Flow Control ถูกเปิดการใช้งาน, RXFIFOF signals กลายมาเป็น activated 2 words ก่อน the FIFO จะเต็ม.
Bit 16 TXFIFOF: Transmit FIFO เต็ม
Title: Re: STM32F1 SDIO
Post by: tha on May 03, 2022, 06:48:38 AM
Bit 15 RXFIFOHF: Receive FIFO half full: มีอย่างน้อย 8 words ใน the FIFO
Bit 14 TXFIFOHE: Transmit FIFO half empty: อย่างน้อย 8 words สามารถถูกเขียนลงใน the FIFO
Bit 13 RXACT: Data receive กำลังดำเนินการ
Bit 12 TXACT: Data transmit กำลังดำเนินการ
Bit 11 CMDACT: Command transfer กำลังดำเนินการ
Title: Re: STM32F1 SDIO
Post by: tha on May 03, 2022, 06:53:48 AM
Bit 10 DBCKEND: Data block ที่ส่ง/ที่รับ (CRC check ผ่าน)
Bit 9 STBITERR: Start bit ไม่ถูกตรวจพบบน all data signals ใน wide bus mode
Bit 8 DATAEND: Data end (data counter, SDIDCOUNT, เป็นศูนย์)
Bit 7 CMDSENT: Command sent (no response ถูกต้องการ)
Bit 6 CMDREND: Command response ที่รับ (CRC check ผ่าน)
Bit 5 RXOVERR: Received FIFO overrun error
Title: Re: STM32F1 SDIO
Post by: tha on May 03, 2022, 06:58:06 AM
Bit 4 TXUNDERR: Transmit FIFO underrun error
Bit 3 DTIMEOUT: Data timeout
Bit 2 CTIMEOUT: Command response timeout
     The Command TimeOut period มีค่าคงที่ 64 SDIO_CK clock periods.
Bit 1 DCRCFAIL: Data block ที่ส่ง/ที่รับ (CRC check ล้มเหลว)
Bit 0 CCRCFAIL: Command response ที่รับ (CRC check ล้มเหลว)
Title: Re: STM32F1 SDIO
Post by: tha on May 04, 2022, 06:52:21 AM
22.9.12 SDIO interrupt clear register (SDIO_ICR)

Address offset: 0x38
Reset value: 0x0000 0000

The SDIO_ICR register เป็น a write-only register. การเขียน a bit ด้วย 1b จะเคลียร์บิตที่ตรงกันใน the SDIO_STA Status register.

(https://i.imgur.com/m57POjn.png)

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

Bit 23 CEATAENDC: CEATAEND flag clear bit
     เซ็ตโดย software เพื่อเคลียร์ the CEATAEND flag.
     0: CEATAEND ไม่ถูกเคลียร์
     1: CEATAEND ถูกเคลียร์

Bit 22 SDIOITC: SDIOIT flag clear bit
     Set by software to clear the SDIOIT flag.
     0: SDIOIT not cleared
     1: SDIOIT cleared

Bits 21:11 Reserved, must be kept at reset value.

Bit 10 DBCKENDC: DBCKEND flag clear bit
     Set by software to clear the DBCKEND flag.
     0: DBCKEND not cleared
     1: DBCKEND cleared

Bit 9 STBITERRC: STBITERR flag clear bit
     Set by software to clear the STBITERR flag.
     0: STBITERR not cleared
     1: STBITERR cleared

Bit 8 DATAENDC: DATAEND flag clear bit
     Set by software to clear the DATAEND flag.
     0: DATAEND not cleared
     1: DATAEND cleared

Bit 7 CMDSENTC: CMDSENT flag clear bit
     Set by software to clear the CMDSENT flag.
     0: CMDSENT not cleared
     1: CMDSENT cleared

Bit 6 CMDRENDC: CMDREND flag clear bit
     Set by software to clear the CMDREND flag.
     0: CMDREND not cleared
     1: CMDREND cleared

Bit 5 RXOVERRC: RXOVERR flag clear bit
     Set by software to clear the RXOVERR flag.
     0: RXOVERR not cleared
     1: RXOVERR cleared

Bit 4 TXUNDERRC: TXUNDERR flag clear bit
     Set by software to clear TXUNDERR flag.
     0: TXUNDERR not cleared
     1: TXUNDERR cleared

Bit 3 DTIMEOUTC: DTIMEOUT flag clear bit
     Set by software to clear the DTIMEOUT flag.
     0: DTIMEOUT not cleared
     1: DTIMEOUT cleared

Bit 2 CTIMEOUTC: CTIMEOUT flag clear bit
     Set by software to clear the CTIMEOUT flag.
     0: CTIMEOUT not cleared
     1: CTIMEOUT cleared

Bit 1 DCRCFAILC: DCRCFAIL flag clear bit
     Set by software to clear the DCRCFAIL flag.
     0: DCRCFAIL not cleared
     1: DCRCFAIL cleared

Bit 0 CCRCFAILC: CCRCFAIL flag clear bit
     Set by software to clear the CCRCFAIL flag.
     0: CCRCFAIL not cleared
     1: CCRCFAIL cleared
Title: Re: STM32F1 SDIO
Post by: tha on May 05, 2022, 05:47:58 AM
22.9.13 SDIO mask register (SDIO_MASK)

Address offset: 0x3C
Reset value: 0x0000 0000

The interrupt mask register กำหนดว่า status flags ใดสร้าง an interrupt request โดยการเซ็ตบิตที่ตรงกันเป็น 1b.

(https://i.imgur.com/jJAkOJJ.png)

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

Bit 23 CEATAENDIE: CE-ATA command completion signal received interrupt enable
      เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่สร้างขึ้นเมื่อรับ the CE-ATA command
      completion signal.
     0: CE-ATA command completion signal received interrupt ถูกปิดการใช้งาน
     1: CE-ATA command completion signal received interrupt ถูกเปิดการใช้งาน

Bit 22 SDIOITIE: SDIO mode interrupt received interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่สร้างขึ้นเมื่อรับ the SDIO mode interrupt.
     0: SDIO Mode Interrupt Received interrupt ถูกปิดการใช้งาน
     1: SDIO Mode Interrupt Received interrupt ถูกเปิดการใช้งาน

Bit 21 RXDAVLIE: Data available in Rx FIFO interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่สร้างขึ้นโดยการมีอยู่ของ data มีให้ใช้ใน Rx FIFO.
     0: Data available in Rx FIFO interrupt ถูกปิดการใช้งาน
     1: Data available in Rx FIFO interrupt ถูกเปิดการใช้งาน

Bit 20 TXDAVLIE: Data available in Tx FIFO interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่สร้างขึ้นโดยการมีอยู่ของ data มีให้ใช้ใน Tx FIFO.
     0: Data available in Tx FIFO interrupt ถูกปิดการใช้งาน
     1: Data available in Tx FIFO interrupt ถูกเปิดการใช้งาน

Bit 19 RXFIFOEIE: Rx FIFO empty interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่เหตุจาก Rx FIFO empty.
     0: Rx FIFO empty interrupt disabled
     1: Rx FIFO empty interrupt enabled

Bit 18 TXFIFOEIE: Tx FIFO empty interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่เหตุจาก Tx FIFO empty.
     0: Tx FIFO empty interrupt disabled
     1: Tx FIFO empty interrupt enabled

Bit 17 RXFIFOFIE: Rx FIFO full interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่เหตุจาก Rx FIFO full.
     0: Rx FIFO full interrupt disabled
     1: Rx FIFO full interrupt enabled
Title: Re: STM32F1 SDIO
Post by: tha on May 05, 2022, 06:18:53 AM
Bit 16 TXFIFOFIE: Tx FIFO full interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่เหตุจาก Tx FIFO full.
     0: Tx FIFO full interrupt disabled
     1: Tx FIFO full interrupt enabled

Bit 15 RXFIFOHFIE: Rx FIFO half full interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่เหตุจาก Rx FIFO half full.
     0: Rx FIFO half full interrupt disabled
     1: Rx FIFO half full interrupt enabled

Bit 14 TXFIFOHEIE: Tx FIFO half empty interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่เหตุจาก Tx FIFO half empty.
     0: Tx FIFO half empty interrupt disabled
     1: Tx FIFO half empty interrupt enabled

Bit 13 RXACTIE: Data receive acting interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่เหตุจาก data กำลังถูกรับ (data receive acting).
     0: Data receive acting interrupt disabled
     1: Data receive acting interrupt enabled

Bit 12 TXACTIE: Data transmit acting interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่เหตุจาก data กำลังถูกส่งถ่าย (data transmit
     acting).
     0: Data transmit acting interrupt disabled
     1: Data transmit acting interrupt enabled

Bit 11 CMDACTIE: Command acting interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่เหตุจาก a command กำลังถูกส่งถ่าย (command
     acting).
     0: Command acting interrupt disabled
     1: Command acting interrupt enabled

Bit 10 DBCKENDIE: Data block end interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่เหตุจาก data block end.
     0: Data block end interrupt disabled
     1: Data block end interrupt enabled

Bit 9 STBITERRIE: Start bit error interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่เหตุจาก start bit error.
     0: Start bit error interrupt disabled
     1: Start bit error interrupt enabled

Bit 8 DATAENDIE: Data end interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่เหตุจาก data end.
     0: Data end interrupt disabled
     1: Data end interrupt enabled

Bit 7 CMDSENTIE: Command sent interrupt enable
     เซ็ตและเคลียร์โดย software เพื่อ เปิดการใช้งาน/ปิดการใช้งาน the interrupt ที่เหตุจาก sending command.
     0: Command sent interrupt disabled
     1: Command sent interrupt enabled
Title: Re: STM32F1 SDIO
Post by: tha on May 05, 2022, 06:23:12 AM
Bit 6 CMDRENDIE: Command response received interrupt enable
     Set and cleared by software to enable/disable interrupt caused by receiving command response.
     0: Command response received interrupt disabled
     1: command Response Received interrupt enabled

Bit 5 RXOVERRIE: Rx FIFO overrun error interrupt enable
     Set and cleared by software to enable/disable interrupt caused by Rx FIFO overrun error.
     0: Rx FIFO overrun error interrupt disabled
     1: Rx FIFO overrun error interrupt enabled

Bit 4 TXUNDERRIE: Tx FIFO underrun error interrupt enable
     Set and cleared by software to enable/disable interrupt caused by Tx FIFO underrun error.
     0: Tx FIFO underrun error interrupt disabled
     1: Tx FIFO underrun error interrupt enabled

Bit 3 DTIMEOUTIE: Data timeout interrupt enable
     Set and cleared by software to enable/disable interrupt caused by data timeout.
     0: Data timeout interrupt disabled
     1: Data timeout interrupt enabled

Bit 2 CTIMEOUTIE: Command timeout interrupt enable
     Set and cleared by software to enable/disable interrupt caused by command timeout.
     0: Command timeout interrupt disabled
     1: Command timeout interrupt enabled

Bit 1 DCRCFAILIE: Data CRC fail interrupt enable
     Set and cleared by software to enable/disable interrupt caused by data CRC failure.
     0: Data CRC fail interrupt disabled
     1: Data CRC fail interrupt enabled

Bit 0 CCRCFAILIE: Command CRC fail interrupt enable
     Set and cleared by software to enable/disable interrupt caused by command CRC failure.
     0: Command CRC fail interrupt disabled
     1: Command CRC fail interrupt enabled
Title: Re: STM32F1 SDIO
Post by: tha on May 05, 2022, 06:36:15 AM
22.9.14 SDIO FIFO counter register (SDIO_FIFOCNT)

Address offset: 0x48
Reset value: 0x0000 0000

The SDIO_FIFOCNT register บรรจุจำนวนที่เหลืออยู่ของ words ที่จะถูกเขียนไปยังหรืออ่านจาก the FIFO. The FIFO counter โหลด the value จาก the data length register (ดู SDIO_DLEN) เมื่อ the data transfer enable bit, DTEN, ถูกเซ็ตใน the data control register (SDIO_DCTRL register) และ the DPSM อยู่ที่ the Idle state. ถ้า the data length ไม่ถูก wordaligned(ผลคูณของ 4), ที่เหลือ 1 ถึง 3 bytes จะถูกถือว่าเป็น a word.

(https://i.imgur.com/MW0TeYu.png)

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

Bits 23:0 FIFOCOUNT: จำนวนที่เหลืออยู่ของ words ที่จะถูกเขียนไปยังหรืออ่านจาก the FIFO.
Title: Re: STM32F1 SDIO
Post by: tha on May 05, 2022, 07:28:05 AM
22.9.15 SDIO data FIFO register (SDIO_FIFO)

Address offset: 0x80
Reset value: 0x0000 0000

The receive and transmit FIFOs สามารถถูกอ่านหรือถูกเขียนเป็น 32-bit wide registers. The FIFOs บรรจุ 32 entries บน 32 sequential addresses. นี้ยอมให้ the CPU ใช้ load and store multiple(หลาย) operands เพื่ออ่านจาก/เขียนถึง the FIFO.

(https://i.imgur.com/bm7bB2Y.png)

bits 31:0 FIFOData: Receive and transmit FIFO data
     The FIFO data ครอบครอง 32 entries ของ 32-bit words, จาก address:
     SDIO base + 0x080 ถึง SDIO base + 0xFC.
Title: Re: STM32F1 SDIO
Post by: tha on May 05, 2022, 07:31:49 AM
(https://i.imgur.com/VJHwToC.png)