Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
All support for Intel NUC 7 - 13 systems has transitioned to ASUS. Read latest update.
16512 Discussions

SD card CRC Ok response in DE4_SDCARD Demo when executing CMD24 Write block command

Altera_Forum
Honored Contributor II
1,248 Views

Hi everyone 

I am referring to the DE4_SDCARD demo by Altera provided with DE-4 board and working in 1-bit SD mode. 

When applying a block write operation using command CMD24 for example I am not getting SD card busy status so where after I can check CRC Ok response. 

I mean to say after applying STOP bit, I assume the card must go busy for writing the data physically but just after applying next clock I am getting high '1' on the DAT0 line which means card is never gone busy for writing. However to my luck the data is also written down successfully but I still want to monitor the response of CRC check after sending STOP bit which I cannot in current scenario. 

 

Please help me, the code snap is given below and problem is highlighted in line ////>>>>>>>>>>>>>>> 

 

 

// write data (512byte = 1 block) 

for(i=0;i<nDataLen;i++) 

Data8 = szDataWrite[i]; 

for(j=0;j<8;j++) 

SD_CLK_LOW; 

 

if (Data8 & 0x80) 

SD_DAT_HIGH; 

else 

SD_DAT_LOW; 

 

SD_CLK_HIGH; 

Data8 <<= 1; 

 

// send CRC 

j=0; 

for(i=0;i<16;i++){ 

SD_CLK_LOW; 

if (DataCrc16 & 0x8000) 

SD_DAT_HIGH; 

else 

SD_DAT_LOW; 

 

SD_CLK_HIGH; 

DataCrc16 <<= 1;  

 

// stop bits (value 'one') 

SD_CLK_LOW; 

SD_DAT_HIGH; 

SD_CLK_HIGH; 

 

////>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Just below code after STOP bit is already sent I am getting 0xff which means only 1's no zero indicating busy for sd card. 

 

//===== check busy bits (data0 only) 

SD_DAT_IN; 

for(i=0; i<8; i++) //wait for response 

SD_CLK_LOW; 

SD_CLK_HIGH; 

Response <<= 1; 

if(SD_TEST_DAT) Response|=0x01; 

printf("Response is: 0x%02x\n", Response); //Prints always 0xff 

 

 

Please help me come out from this problem so I can check the CRC ok response on DAT0 line after STOP bit
0 Kudos
0 Replies
Reply