Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[ARM] how to erase the previous data in SD card(SPI communication) by using erase command in stm32f103c8(HAL library)

Status
Not open for further replies.

Mr smile

Newbie
Newbie level 3
Joined
Mar 15, 2023
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
7
in this condition using to continuously erase the data.

Code:
uint8_t erase_cmd[6]={0x20, 0x00, 0x00, 0x00, 0x00, 0x95};
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_RESET); // Chip select pin
HAL_SPI_Transmit(&hspi1, erase_cmd, sizeof(erase_cmd), HAL_MAX_DELAY);
HAL_SPI_Receive(&hspi1, &status, 1, HAL_MAX_DELAY);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_SET);
 

hello,
CMD32(0x20) its working for erase the data on continuously. but i need to the output for erase the previous data and store Current data to stored.
i'm using this function. but still this is continuously erase the data.

SD.PNG
 

Referring to SD specification, the question makes little sense for me.

4.3.5
Erase It is desirable to erase many write blocks simultaneously in order to enhance the data throughput. Identification of these write blocks is accomplished with the ERASE_WR_BLK_START (CMD32), ERASE_WR_BLK_END (CMD33) commands.
The host must adhere to the following command sequence: ERASE_WR_BLK_START, ERASE_WR_BLK_END and ERASE (CMD38).
If an erase (CMD38) or address setting (CMD32, 33) command is received out of sequence, the card shall set the ERASE_SEQ_ERROR bit in the status register and reset the whole sequence.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top