Skip to main content
Visitor II
June 4, 2024
Question

SD Card 1 Byte Write

  • June 4, 2024
  • 2 replies
  • 921 views

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

    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

    Graduate II
    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