2021-04-13 11:50 PM
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?