Has anyone knowledge of how to cancel a multi-block transfer than is in process to/from an SD card using the SDHC controller.
The basic transfer itself is not a problem (eg. multi-block write):
- the number of blocks to be transfered is set in the SDHC_BLKATTR register
- the CMD25 is sent to the SD card to set it to the multi-block mode (it doesn't need to know how any blocks will arrive)
- When the number of data blocks have been transfered the CMD12 is sent (either manually or automatically by the SDHC controller)
However there are various applications accessing the SD card and so there are instances when the transfer has to be terminated before the block count has been reached, and then continued later. This not a problem for the SD card since it just needs to receive the CMD12 after any number of blocks but how does the SDHC handle this?
There are (at least) two possible solutions - both of which are presently causing difficulties:
1. If not using automatic CMD12 it would be possible to simply send a multiple number of single blocks and simply send the CMD12 when the transmission needs to be terminate (either at end or prematurely). The problem is that the SDHC controller is not allowing this without first sending a command before each single block. It disables the data transmission after one single block. (SDHC_PRSSTAT_BWEN in SDHC_PRSSTAT remains at '0')
2. Set the block count for transmission and simply send the CMD12 manually in case the transmission needs to be terminated early. The difficulty with this is that the SDHC controller doesn't allow the command to be send before the complete data transmission has terminated without resetting the data unit. Furthermore it is not easy to be sure that the complete block presently in progress has really been completely sent out (transmission complete flag is not set since the SDHC is expecting more blocks). After resetting the data unit the CMD12 is possible but there are some otherside effects that cause other problems (at the moment) so doesn't seen be a good solution.
Is there a "correct" way to do this that is foreseen in the controller?