This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2538: Block the CPU for reading a specific region of flash

Part Number: CC2538


Hello, I would like to block read access to a specific region of flash of a CC2538 device. As I can see I can block the write access for a flash page using CCA but I have not find anything about read. I would like to store credentials to this region and block the access after reading them.

  • Hello Nikos,

    You will need to lock the JTAG debug interface so that it is unable to read any flash memory region.  The top most page the Flash contains the lock bit information. A value of 1 enables the access to all the secondary/slave DAP/TAP connected to the ICEPick while 0 disables all the access. After having locked debug access, a mass erase of the device, followed by an external reset, must be performed to regain control of the chip.

    Regards,
    Ryan

  • Thank you, thus in this way the protection is against the JTAG debug. Also, the entire flash is locked and in order to "gain" access again I have to erase and reset the device. Correct?  Could you give me more details about the register I have to set in order to lock the debug access? I am using contiki-ng

  • Your understanding is correct, the LOCK_DEBUG_N bit is located in the CCA alongside the LOCK_PAGE_N bits, specifically byte 2047 of the uppermost available page (further described in Section 8.6 of the TRM).

    Regards,
    Ryan

  • I understood. thanks. One more question, if I have locked access for write/erase to a flash page how can I unlock it?

  • From Section 8.2.2 and 8.6 of the TRM: The page lock bits (CCA) are placed in the uppermost available page which is called the lock bit page. When a page is locked, a write or erase operation to the page is aborted. The Lock Bit Page is not accessible unless FLASH_CTRL_FCTL .UPPER_PAGE_ACCESS is set.  The user can disable erasing and writing to certain pages with a page lock bit that is available to each individual flash page.

    You can typically view use of the Customer Configuration Area in Lock Page from the startup_ewarm.c file of your IAR project and modify for your own needs.

    Regards,
    Ryan