Skip to main content
AGond.2
Associate III
June 4, 2024
Question

SD Card 1 Byte Write

Hello 

we Have Custom Build PCB Board where we Mounted SD card Interface and Using stm32f4xx_HAL_SD.c Library file in which 512 byte Hard Coded as config.DataBlockSize = SDIO_DATABLOCK_SIZE_512B;, but we have to write Byte  means don't block size of 512 Byte.

So as i Went through Transcend Sd Card There they Recommended Something WRITE_BL_PARTIAL , if WRITE_BL_PARTIAL =0 means 512 Byte Block Size and WRITE_BL_PARTIAL =1 means Small Block Size that is 1 Byte. So how we can Enable or Disable  WRITE_BL_PARTIAL in  stm32f4xx_HAL_SD.c .

Anyone Have Idea how we can do ?

 

Thank You

This topic has been closed for replies.

2 replies

Peter BENSCH
ST Technical Moderator
June 4, 2024

SD cards are based on NAND flash, where you cannot write individual bytes. You can only access them in blocks.

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Tesla DeLorean
Guru
June 4, 2024

It's a BLOCK DEVICE, want to change a BYTE, read a BLOCK, change the BYTE, and write the modified BLOCK back.

You don't use 128MB device just a BYTE at a time, it's just impractical. You can use FATFS to f_open() / f_write() content in small amounts, by it's incredibly inefficient

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..