Atmel SAM4S-XPLD Atmel ATSAM4S-XPLD ATSAM4S-XPLD Data Sheet

Product codes
ATSAM4S-XPLD
Page of 1125
 820
SAM4S [DATASHEET]
11100E–ATARM–24-Jul-13
Figure 37-9. Write Functional Flow Diagram 
Note:
The following flowchart (
) shows how to manage a multiple write block transfer with the PDC. Polling or
interrupt method can be used to wait for the end of write according to the contents of the Interrupt Mask Register
(HSMCI_IMR).
Send SELECT/DESELECT_CARD
command
(1)
to select the card
Send SET_BLOCKLEN command
(1)
Write using PDC
Reset the PDCMODE bit
HSMCI_MR
= PDCMODE
Set the block length
HSMCI_MR = (BlockLenght
16)
Send WRITE_SINGLE_BLOCK
command
(1)
Set the PDCMODE bit
HSMCI_MR = PDCMODE
Set the block length
HSMCI_MR = (BlockLength
16)
Configure the PDC channel
HSMCI_TPR = Data Buffer Address
HSMCI_TCR = BlockLength/4
Send WRITE_SINGLE_BLOCK
command
(1)
Read status register HSMCI_SR
Poll the bit
NOTBUSY= 0
Yes
RETURN
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
HSMCI_PTCR = TXTEN