Jump to main content

##

# 2.72.10 NVM_ProgramFlashWriteProtect Function

## C

The prototype of NVM_ProgramFlashWriteProtect() varies based on device family. Refer to the generated header file for the actual prototype to be used.

    void NVM_ProgramFlashWriteProtect( uint32_t address );

    void NVM_ProgramFlashWriteProtect( uint32_t lt_address, uint32_t gte_address );

## Summary

Protect Program Flash Memory from Writes

## Description

For NVM_ProgramFlashWriteProtect( uint32_t address )

- Protects the Program Flash Page in which the address falls and all the lower pages below it from writes. Passing address value as 0 will unlock the entire program flash memory for writes.

For NVM_ProgramFlashWriteProtect( uint32_t lt_address, uint32_t gte_address )

- Protects the Program pages at Flash addresses less than the "lt_address" and the pages at Flash addresses greater than or equal to "gte_address". Passing address value as 0 will unlock the entire program flash memory for writes.

## Precondition

None

## Parameters

Param | Description
--- | ---
address | 24-Bit address till where the memory has to be protected from start of flash memory.
lt_address | Pages at Flash addresses less than this value are write protected
gte_address | Pages at Flash addresses greater than or equal to this value are write protected.

## Returns

None.

## Example

    // Protects Memory locations 0x9D000000 - 0x9D001000
    NVM_ProgramFlashWriteProtect(0x9D001000);

    // Protects Memory locations below 0x9D001000 and Memory locations above 0x9D003000
    NVM_ProgramFlashWriteProtect(0x9D001000, 0x9D003000);