Datasheet

2017 Microchip Technology Inc. DS60001516A-page 575
SAM9G20
Figure 34-10: Read Functional Flow Diagram
Note 1: It is assumed that this command has been correctly sent (see Figure 34-9).
2: This field is also accessible in the MCI Block Register (MCI_BLKR).
Read status register MCI_SR
Send SELECT/DESELECT_CARD
command
(1)
to select the card
Send SET_BLOCKLEN command
(1)
Read with PDC
Reset the PDCMODE bit
MCI_MR &= ~PDCMODE
Set the block length (in bytes)
MCI_MR |= (BlockLenght <<16)
(2)
Set the block count (if necessary)
MCI_BLKR |= (BlockCount << 0)
Number of words to read = 0 ?
Poll the bit
RXRDY = 0?
Read data = MCI_RDR
Number of words to read =
Number of words to read -1
Send READ_SINGLE_BLOCK
command
(1)
Ye s
Set the PDCMODE bit
MCI_MR |= PDCMODE
Set the block length (in bytes)
MCI_BLKR |= (BlockLength << 16)
(2)
Configure the PDC channel
MCI_RPR = Data Buffer Address
MCI_RCR = BlockLength/4
MCI_PTCR = RXTEN
Send READ_SINGLE_BLOCK
command
(1)
Read status register MCI_SR
Poll the bit
ENDRX = 0?
Ye s
RETURN
RETURN
Ye sNo
No
No
Ye s
No
Number of words to read = BlockLength/4