MDD_SDSPI_SectorWrite Function

Microchip MDD File System Interface

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 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. 
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.2.0 - [Aug 18, 2008]
Copyright © 2008 Microchip Technology, Inc.  All rights reserved.