One Time Programmable (OTP) memory

The flashloader also provides commands to program and read the on-chip one-time programmable (OTP) fuse memory from the LPC540xx/LPC54S0xx device. The efuse-program-once command is used for programming the fuses and efuse-read-once to read the programmed data from the fuse memory. The OTP memory for LPC540xx/LPC54S0xx devices contains four memory banks of 128 bits each. Every 128-bit bank is comprised of four 32-bit words. From Bank 0 Register 0 to Bank 3 Register 3, there are sixteen 32-bit words. A single word can be read or programmed in each call to the bootloader fuse commands. See Chapter 46.12, OTP functional details in UM11060 LPC540xx/LPC54S0xx User’s Manual to see OTP functional details.

efuse-read-once

The efuse-read-once command requires one argument, an index to one of 0 to 15 32-bit fuse words.

index 0: OTP Bank 0 Word 0

index 1: OTP Bank 0 Word 1

index 2: OTP Bank 0 Word 2

index 3: OTP Bank 0 Word 3

index 4: OTP Bank 1 Word 0

index 5: OTP Bank 1 Word 1

index 6: OTP Bank 1 Word 2

index 7: OTP Bank 1 Word 3

index 8: OTP Bank 2 Word 0

index 9: OTP Bank 2 Word 1

index 10: OTP Bank 2 Word 2

index 11: OTP Bank 2 Word 3

index 12: OTP Bank 3 Word 0

index 13: OTP Bank 3 Word 1

index 14: OTP Bank 3 Word 2

index 15: OTP Bank 3 Word 3

The index can be obtained by calculating 4 * OTP_Bank_Index + Word_Index. The following figure shows the results from fuse-read-once command for OTP Bank 0 Word 1.

efuse-read-once command results OTP Bank 0 Word 1

efuse-program-once

The efuse-program-once command requires two arguments. The first is an index to one of 0 to 15 fuse words, and the second argument is the 32-bit data to program to the fuse word specified in the first argument. For LPC540xx devices, the first memory bank (OTP Bank 0) is reserved. The other three OTP banks are programmable. So, index 0, 1, 2,and 3 are invalid. See Chapter 46.12, OTP functional details in UM11060 LPC540xx/LPC54S0xx User’s Manual to see OTP functional details. The following example shows the blhost calling to program bit 0 of OTP Bank 1 Word 3.

blhost.exe -u 0x1fc9,0x01a2 efuse-program-once 7 00000001

efuse-program-once command results

Note: The second argument should be in hex without the prefix “0x” to the 32-bit hex word.

program-aeskey

The program-aeskey command is used to program a 128-bit AES key into OTP bank2 of LPC54S0xx. The AES key programming is different from the usual OTP programming. AES keys go through a “scrambler” block in hardware and they get programmed into OTP scrambled.

The program-aeskey command requires one argument which is a file containing a 128-bit data. This command can be used as described below:

blhost -u 0x1fc9,0x01a2 -- program-aeskey aes_key.bin

The srambled AES key in OTP bank2 can be read using command efuse-read-once command after power cycling the device.