Datasheet
The flowchart, W
rite Functional Flow Diagram, shows how to write a single block with or without use of DMA facilities.
Polling or interrupt method can be used to wait for the end of write according to the contents of the HSMCI Interrupt
Mask Register (HSMCI_IMR).
Figure 40-9. Write Functional Flow Diagram
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
Note: 1. It is assumed that this command has been correctly sent (see Command/Response Functional Flow
Diagram).
The flowchart in Read and W
rite Multiple Block shows how to manage read multiple block and write multiple block
transfers with the DMA Controller. Polling or interrupt method can be used to wait for the end of write according to the
contents of the HSMCI_IMR.
SAM E70/S70/V70/V71 Family
High-Speed Multimedia Card Interface (HSMCI)
© 2019 Microchip T
echnology Inc.
Datasheet
DS60001527D-page 936










