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)

Mr smile

Newbie
Newbie level 2
Joined
Mar 15, 2023
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
1
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);
 

Mr smile

Newbie
Newbie level 2
Joined
Mar 15, 2023
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
1
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.
 

Attachments

  • SD.PNG
    SD.PNG
    21.4 KB · Views: 13

FvM

Super Moderator
Staff member
Advanced Member level 7
Joined
Jan 22, 2008
Messages
50,996
Helped
14,633
Reputation
29,542
Reaction score
13,742
Trophy points
1,393
Location
Bochum, Germany
Activity points
291,765
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.
 

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top