TM STM32F4xx Libraries  v1.0.0
Libraries for STM32F4xx devices from Tilen Majerle
TM_OTP_Functions

Library Functions. More...

Macros

#define TM_OTP_BlockLocked(block)   ((*(__IO uint8_t *) (OTP_LOCK_ADDR + block)) == 0x00 ? 1 : 0)
 Checks if block is locked or not. More...
 

Functions

TM_OTP_Result_t TM_OTP_Write (uint8_t block, uint8_t byte, uint8_t data)
 Writes one-time data to specific block and specific byte in this block. More...
 
uint8_t TM_OTP_Read (uint8_t block, uint8_t byte)
 Reads data from specific block and specific byte in this block. More...
 
TM_OTP_Result_t TM_OTP_BlockLock (uint8_t block)
 Locks entire block to prevent future programming inside. More...
 

Detailed Description

Library Functions.

Macro Definition Documentation

#define TM_OTP_BlockLocked (   block)    ((*(__IO uint8_t *) (OTP_LOCK_ADDR + block)) == 0x00 ? 1 : 0)

Checks if block is locked or not.

Parameters
blockOTP block number, 0 to 15 is allowed
Return values
Blocklock status
  • 0: Block is not locked
  • > 0: Block locked

Function Documentation

TM_OTP_Result_t TM_OTP_BlockLock ( uint8_t  block)

Locks entire block to prevent future programming inside.

Note
When you lock your block, then you are not able to program it anymore. Even, if it is totally empty. You can't unlock it back!
Parameters
blockOTP block number, 0 to 15 is allowed
Return values
Memberof TM_OTP_Result_t enumeration
uint8_t TM_OTP_Read ( uint8_t  block,
uint8_t  byte 
)

Reads data from specific block and specific byte in this block.

Note
You can read data unlimited times from locations
Parameters
blockOTP block number, 0 to 15 is allowed
byteOTP byte inside one block, 0 to 31 is allowed
Return values
Valueat specific block and byte location, or 0 if location is invalid
TM_OTP_Result_t TM_OTP_Write ( uint8_t  block,
uint8_t  byte,
uint8_t  data 
)

Writes one-time data to specific block and specific byte in this block.

Note
You can only ONCE write data at desired byte in specific block, if you will try to do it more times, you can have broken data at this location.
Parameters
blockOTP block number, 0 to 15 is allowed
byteOTP byte inside one block, 0 to 31 is allowed
dataData to be written to OTP memory
Return values
Memberof TM_OTP_Result_t enumeration