37.11 Scrambling/Unscrambling Function

The external data bus D[15:0] can be scrambled in order to make recovery of intellectual property data located in off-chip memories more difficult by analyzing data at the package pin level of either the microcontroller or the memory device.

The scrambling and unscrambling are performed on-the-fly without additional wait states.

The scrambling method depends on two user-configurable key registers, HSMC_KEY1 and HSMC_KEY2. These key registers are only accessible in Write mode.

The key must be securely stored in a reliable nonvolatile memory in order to recover data from the off-chip memory. Any data scrambled with a given key cannot be recovered if the key is lost.

The scrambling/unscrambling function is enabled or disabled by configuring specific bits in the HSMC_OCMS and the HSMC_TIMINGSx registers. The bit configuration values to enable memory scrambling are summarized in the table below.

Table 37-6. Scrambling Function Bit Encoding
Memories Bit Values
HSMC_OCMS.SMSE HSMC_OCMS.SRSE HSMC_TIMINGSx.OCMS
Off-chip Memories 1 0 1
NAND Flash with NFC 0 1 0

When the NAND Flash memory content is scrambled, the on-chip NFC SRAM page buffer associated for the transfer is also scrambled.