18.4.2.3 Programming

The programming procedure for the Flash and SRAM memories is as follows:
  1. At power-up, RESET is driven low by a debugger. The on-chip regulator holds the system in a Power-On Reset (POR) state until the input supply rises above the POR threshold (refer to the POR characteristics). The system remains in this static state until the internally regulated supplies reach a safe operating level.
  2. The Power Manager (PM) starts, and the clocks are switched to the slow clock (Core Clock, System Clock, Flash Clock, and any Bus Clocks that do not have clock gate control). Internal resets are maintained because of the external RESET signal.
  3. The debugger maintains SWCLK at a low level. RESET is released, initiating a debugger cold-plugging procedure.
  4. The debugger generates a clock signal on the SWCLK pin, and the DAP receives the clock.
  5. The CPU remains in Reset because of the cold-plugging procedure; meanwhile, the rest of the system is released from Reset.
  6. A Chip-Erase command is issued to ensure that the Flash is fully erased before programming.
  7. Programming is available through the AHB-AP.
  8. After the operation is completed, the chip can be restarted either by asserting RESET or by toggling power. Ensure that the SWCLK pin is high when releasing RESET to prevent the CPU reset from being extended.