MDD_SDSPI_SectorWrite Function

MDD File System Interface Library

MDDFS Interface Library Help
MDD_SDSPI_SectorWrite Function
C
BYTE MDD_SDSPI_SectorWrite(
    DWORD sector_addr, 
    BYTE* buffer, 
    BYTE allowWriteToZero
);
Description

The MDD_SDSPI_SectorWrite function writes one sector of data (512 bytes) of data from the location pointed to by 'buffer' to the specified sector of the SD card.

Preconditions

The MDD_SectorWrite function pointer must be pointing to this function.

Parameters
Parameters 
Description 
sector_addr 
The address of the sector on the card. 
buffer 
The buffer with the data to write. 
allowWriteToZero 
  • TRUE - Writes to the 0 sector (MBR) are allowed
  • FALSE - Any write to the 0 sector will fail.
 
Return Values
Return Values 
Description 
TRUE 
The sector was written successfully. 
FALSE 
The sector could not be written. 
Side Effects

None.

Remarks

The card expects the address field in the command packet to be a byte address. The sector_addr value is ocnverted to a byte address by shifting it left nine times (multiplying by 512).

Microchip MDD File System Interface 1.4.2 - [Oct 15, 2012]
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.