Datasheet
Figure 40-10. Read and Write Multiple Block
Send SELECT/DESELECT_CARD
command
(1)
to select the card
Send SET_BLOCKLEN command
(1)
Write using DMAC
Send WRITE_SINGLE_BLOCK
command
(1)
Configure the DMA channel X
DMAC_CDAx.DA = Data Address to write
DMAC_CUBCx.UBLEN = BlockLength/4
Send WRITE_SINGLE_BLOCK
command
(1)
Read status register HSMCI_SR
Poll the bit
XFRDONE = 0?
Y
es
No
Yes
No
Read status register HSMCI_SR
Number of words to write = 0 ?
Poll the bit
TXRDY = 0?
HSMCI_TDR = Data to write
Number of words to write =
Number of words to write -1
Yes
RETURN
No
Yes
No
Number of words to write = BlockLength/4
DMAC_GE.EN[X] = TRUE
Reset the DMAEN bit
HSMCI_DMA &= ~DMAEN
Set the block length (in bytes)
HSMCI_BLKR |= (BlockLength) <<16)
Set the block count (if necessary)
HSMCI_BLKR |= (BlockCount << 0)
Set the DMAEN bit
HSMCI_DMA |= DMAEN
Set the block length (in bytes)
HSMCI_BLKR |= (BlockLength << 16)
RETURN
Notes: 1. It is assumed that this command has been correctly sent (see Command/Response Functional Flow
Diagram).
2. Handle errors reported in HSMCI_SR.
40.8.5 WRITE_SINGLE_BLOCK/WRITE_MULTIPLE_BLOCK Operation using DMA Controller
1. Wait until the current command execution has successfully terminated.
a. Check that CMDRDY and NOTBUSY fields are asserted in HSMCI_SR
2.
Program the block length in the card. This value defines the value block_length.
SAM E70/S70/V70/V71 Family
High-Speed Multimedia Card Interface (HSMCI)
©
2019 Microchip Technology Inc.
Datasheet
DS60001527D-page 937










