Thanks for the comments Mark.
My application will be one application reading two files at the same time -- but interweaving the read process - so I don't have to "pause" a multi-block read.
I've spent the last 12 hours debugging multi-block reads -- here's what I found ... maybe someone can clarify.
CMD18 is set for AutoCmd12 and has block count set.
My code bails out of the read loop after I have read the specified number of blocks.
I've gone into a while(1) loop to debug SDHC register values after specific operations to see what is happening.
After acquiring the requested number of data blocks - the SDHC shows:
I am assuming that the SDHC has issued the AutoCMD12 as requested in the CMD18 command.
IRQSTAT - BRR (Buffer Read Ready) -- ok -- expected
PRSSTAT - RTA (Read Transfer Active), DLA (Data Line Active), CDIHB(Cmd Inhibit Data).
The PRSSTAT value suggests the block read is still active and the AutoCMD12 did not execute --- so I inserted my OWN CMD12 command --- results remain the same --- so I guess the AutoCMD12 DID execute and leaving the Card/SDHC in this state.
You are DEAD in this state as far any any more read/write operations go.
Investigating how to resolve this, I found the following:
From the K64 Reference Manual - Register XFERTYP - member CMDTYP:
Abort command (CMD12 or AutoCMD12) --- “After issuing the abort command, the host driver must issue a software reset (abort
transaction)."
Tried searching in the K64 manual for the definition of "software reset" and found none.
Researching the SD Card Interface specifications -- they state that after a CMD12 or AutoCMD12, that the software resets for Data and Cmd lines (found in SDHC Register SYSCTL) need to be activated.
So after I issue my own CMD12, I set the Data/Cmd software bits in SYSCTL.
IRQSTAT goes to 0
PRSSTAT now shows that the following clocks have been turned off as a result of the soft-reset: PEROFF (SDHC Clock), HCKOFF (System Clock), and IPGOFF (Bus Clock).
Still --- any READ attempt (CMD17) --- DEAD -- no IRQSTAT bits being set after the command is issued (IRQSTSTEN still has all the flags set -- so that's not he issue).
I suspected the issue may be that the clocks are off (the clocks are normally turned off depending on the state of the card/SDHC).
So I tested that theory ... I set flags PEREN, HCKEN, and IPGEN in register SYSCTL. This prevents the clocks from going off when the soft reset is applied.
Clocks are now ON -- Still DEAD on CMD17 read.
Tested clearing the flags PEREN, HCKEN, and IPGEN in register SYSCTL after the soft reset -- which puts me back where PRSSTAT shows clocks have been turned off again PEROFF (SDHC Clock), HCKOFF (System Clock), and IPGOFF (Bus Clock).
After all of this, the SD Card specifications suggest asking the card it's current state .. so I implemented CMD13.
CMD returns with the current state of the SD card as "tran" which is the "Tranfer State" -- so the card should be able to process my CMD17 command.
Again --- I issue a CMD17 and wait for IRQSTAT to show "Command Complete" or an error -- BUT -- IRQSTAT is always ZERO!!!!
There's the long and short of my investigation.
Can anyone share any insight as to why the SDHC will NOT set any IRQSTAT based on receiving CMD17 after I performed a soft reset as described above?
Thanks in advance for any HELP.
Joe