cancel
Showing results for 
Search instead for 
Did you mean: 

SPI CMD24 Write Block issure

STai.2
Associate II

I am trying to write data into 16GB micro SD card(ADATA Premier microSDHC UHSI class10).

 initialization is O.K.

I am using an HAL_SPI_Transmit(&hspi1,wr_buf,6,100) command

Program is as follows:             

#define CMD24    (0x40+24)    /* WRITE_BLOCK */

uint8_t wr_buf[6]={CMD24,0x00,0x00,0x02,0x00,0xFF};

uint8_t rec_buf[6]={0x00,0x00,0x00,0x00,0x00,0x00};

do{

          HAL_SPI_Transmit(&hspi1,wr_buf, 6, 100);

          HAL_SPI_Receive_IT(&hspi1,rec_buf, 6);

           HAL_Delay(1);

          }while(rec_buf[0]!=0x00);

It is always responding 0x05. Why?

0 REPLIES 0