SPIU023 August 2026 TMS320F28P551SG
Configures write (program) and erase protection for the sectors.
Fapi_StatusType Fapi_setupBankSectorEnable(
uint32 WEPROT_register,
uint32 oSectorMask
)| Parameters | Description |
|---|---|
| pu32StartAddress [in] | Register address for write and erase protection configuration. Use FLASH_WRAPPER_PROGRAM_BASE+FLASH_O_CMDWEPROTA for the first 32 (0-31) sectors. Use FLASH_WRAPPER_PROGRAM_BASE+FLASH_O_CMDWEPROTB for the remaining main-array (32–127) sectors. Use FLASH_WRAPPER_PROGRAM_BASE+FLASH_O_CMDWEPROT_UO for the USER OTP. |
| OSectorMask [in] | 32-bit mask indicating which sectors to mask from the erase and program operations. |
On this device, all of the flash main-array sectors and the USER OTP are protected from the erase and program operations by default. The application of the user must disable the protection for the sectors that the application wants to perform erase or program (or both) operations. This function can be used to enable or disable the protection. This function is called before each erase and program command, as shown in the flash API usage example provided in the C2000Ware.
The first input parameter for this function can be the address of any of these three registers: CMDWEPROTA, CMDWEPROTB, and CMDWEPROT_UO.
The CMDWEPROTA register is used to configure the protection for the first 32 sectors (0 to 31). Each bit in this register corresponds to each sector – Example: Bit 0 of this register is used to configure the protection for Sector 0, and Bit 31 of this register is used to configure the protection for Sector 31. A 32-bit user-provided sector mask (second parameter passed to this function) indicates which sectors the user wants to mask from the erase and program operations, that is, sectors that are not meant to be erased and programmed. If a bit in the mask is 1, that particular sector is not erased or programmed.
The CMDWEPROTB register is used to configure the protection for the 32–127 sectors in the main-array flash bank. However, note that each bit in this register is used to configure protection for eight sectors together. This means, bit 0 is used to configure the protection for all of the sectors 32 to 39 together, bit 1 is used to configure the protection for all of the sectors 40 to 47 together, and so on. A 32-bit user-provided sector mask (second parameter passed to this function) indicates which sectors the user wants to mask from the erase and program operations, that is, sectors that are not meant to be erased and programmed. If a bit in the mask is 1, that particular set of sectors is not erased or programmed. If a bit in the mask is 0, that particular set of sectors is erased or programmed.
The CMDWEPROT_UO register is used to configure the protection for the USER OTP. Bit 0 in this register is used to configure the protection for the USER OTP. This means, if bit 0 is configured as 1, USER OTP is not erased or programmed. Other bits can be configured as 1s. Since USER OTP is not erasable, the CMDWEPROT_UO register protection is not applicable for erase operations. This must be configured only for the program operation as needed.
See the flash programming example provided in C2000Ware at C2000Ware_.....\driverlib\f28p551x\examples\flash\flashapi_128bit_programming.c for TMS320F28P551x.
See the flash programming example provided in C2000Ware_.....\driverlib\f28p551x\examples\flash\flashapi_512bit_programming.c for TMS320F28P551x.