STM32F1 SDIO

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

Previous topic - Next topic

tha

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.

tha

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

tha

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.


tha

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) เท่านั้น.

tha

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

tha

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 ไม่สามารถใช้ได้.

tha

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 ถูกทำให้สำเร็จได้ดังต่อไปนี้:

tha

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.