Flashloader behaviour

From SEGGER Wiki
Jump to: navigation, search

This article describes the general behaviour of SEGGER flashloaders.

Device state for programming

Flashloaders are tested with the device in reset state. With the device in any other state proper flash operation may or may not work. Therefore, it is recommended to perform a device reset before flash programming.

Initializing and deinitializing device

Flashloaders initialize the device before programming/erasing and afterwards restore it to the same state it was before the flash operation was executed. This includes:

  • Clock speed
  • System Control registers
  • Flash Control registers
  • QSPI flash initialization state
  • etc.

For the user this means that the device state before the flash operation is indistinguishable from the state afterwards.

For QSPI flashes it also means that, if the QSPI was not initialized before flash programming, it will not be afterwards and reading the flash or debugging may not work. QSPI flash is not left in an initialized state after programming, because otherwise if the user had the QSPI flash initialized and configured beforehand, it may not be in the same configuration after the flash operation (e.g. 3-Byte-Mode vs. 4-Byte-Mode).

Therefore, if the user wants to use the QSPI flash, it is in his or hers responsibility to ensure that the QSPI flash is initialized.