AnsweredAssumed Answered

Stange behaviour of the BF548 Secure Didital Host

Question asked by Chris on Aug 12, 2010
Latest reply on Aug 21, 2016 by enas

Hi,

 

I'm using the BF548 and its "Secure Digital Host" with a Sandisk SD HC 16GB  sd card.

 

I'm using custom code and not the "adi drivers"

 

The SDCARD Initialization is ok, I can write data in "block transfer" with DMA and read data with block transfer.

 

The problem occurs when using "Stream transfer" mode to send a single or multiple blocks (512 bytes).

 

I erase the first 1000 sectors of the SDCard,

 

I set up DMA to transfer 512 bytes (128 * int), this is the same as for the block transfer


I send a CMD16 to set blocksize to 512 bytes (not required for SDHC)


I send a CMD25 with start address 0x0000

 

I set up the SDH controller to send data using DMA Stream mode

 

Start SDH

 

DMA interrupt occurs, SDH_STATUS = 0x00000100 = DAT_END

 

CMD12 (Stop Streaming)

 

CMD13 (status) responds with 0x00000E00 = Programming state & not ready for data. According to the SD-standard Programming state indicates the transfer was OK and SD is writing data.

 

Wait()

 

CMD13 (status) responds with 0x00000900 = Transferstate & ready for data. Which is conform the state transition diagram of the SD Card standard.

 

Next I want to read the first sector (address 0x0000) and use the same command used to read after Single block mode write.

 

CMD17 with start address 0x0000 and data length 512 Bytes, -> RESPONSE SDH_STATUS = 0x00000200 =  Start_Bit_ERR ?

 

This time the Read command fails.

 

If I reboot the application and read the first sector again (SD is nog erased) the read is ok, however the data is 0x0000, like the data was never written.

 

I have tried a Sandisk 2GB as well, unfortunately with the same results.

 

What is going on here? is this a mismatch between SD-card and SDH controller, a hardware bug? or "user-error" ?

 

Best regards,

 

Chris

Outcomes