From "CC2540/41 System-on-Chip Solution for 2.4- GHz Bluetooth® low energy Applications User's Guide":
"The debug interface (Chapter 3) implements a proprietary two-wire serial interface that is used for in- circuit debugging. Through this debug interface, it is possible to perform an erasure of the entire flash memory, control which oscillators are enabled, stop and start execution of the user program, execute supplied instructions on the 8051 core, set code breakpoints, and single-step through instructions in the code. Using these techniques, it is possible to perform in-circuit debugging and external flash programming elegantly."
"Debug mode is entered by forcing two falling-edge transitions on pin P2.2 (debug clock) while the RESET_N input is held low. When RESET_N is set high, the device is in debug mode."
"The debug interface uses I/O pins P2.1 and P2.2 as debug data and debug clock, respectively, during debug mode. These I/O pins can be used as general-purpose I/O only while the device is not in debug mode."
"For software and/or access protection, a set of lock bits can be written to the upper available flash page—the lock-bit page."