Shutdown Procedure

Currently, four different shutdown procedures are implemented to enter the various low-power modes.
They are all very similar, but differentiate in some details and between the AMiRo Modules (AMs).
The basic procedure is defined as follows:

  1. The signals SYS_SYNC_N and SYS_PD_N are both set active.
  2. first custom operation
  3. Some GPIO pins are reconfigured as inputs.
    This is required, because otherwise a high output could unintentionally power periphery hardware, which is intended to be turned off.
    More specifically, these are all signals, which are inputs of hardware that is powered by a regulated power supply voltage.
    Whenever the supply is disabled, these elements should be turned off, but if the MCU then drives an input high, it might power up again.
  4. second custom operation
  5. SYS_SYNC_N is deactivated and each module waits until it is deactivated by all other AMs as well.
  6. third custom operation
  7. The board LED (if available) signals "OK" in Morse code (--- -·-).
  8. All modules enter low-power mode or reset.

As defined in SSSP, the state of SYS_PD_N in the moment when SYS_SYNC_N becomes inactive specifies whether the system will shutdown or restart.

In the following, the four procedures with their particularities for each board are described one by one.
As a matter of fact, the custom operation steps are empty for most AMs.
The only modules, that act somewhat differently are the PowerManagamenet and the DiWheelDrive.
Hence, only these two are addressed in the following.


Transportation

PowerManagement

  1. first custom operation
    nothing (just proceeding to the next step)
  2. second custom operation
    nothing (just proceeding to the next step)
  3. third custom operation
    1. cutting power
      1. deactivation of SYS_WARMRST_N
      2. deactivation of SYS_REG_EN
      3. deactivation of POWER_EN
      4. Waits ten milliseconds to make sure, everything is shut down.
    2. disables all wakeup sources
      1. disables the WKUP pin
      2. disables any RTC events
      3. disables the independent watchdog
    3. writing information to the backup register
      (see Startup Procedure)

At the end of the shutdown procedure, the module enters standby mode.

DiWheelDrive

  1. first custom operation
    nothing (just proceeding to the next step)
  2. second custom operation
    1. cutting power of the motors by setting POWER_EN inactive
    2. deactivation of all wakeup sources
      1. deactivation of the WKUP pin
      2. deactivation of any RTC events
      3. deactivation of the independent watchdog
  3. third custom operation
    nothing (just proceeding to the next step)

At the end of the shutdown procedure, the module enters standby mode.


DeepSleep

PowerManagement

  1. first custom operation
    nothing (just proceeding to the next step)
  2. second custom operation
    nothing (just proceeding to the next step)
  3. third custom operation
    1. cutting power
      1. deactivation of SYS_WARMRST_N
      2. deactivation of SYS_REG_EN
      3. deactivation of POWER_EN
      4. Waits ten milliseconds to make sure, everything is shut down.
    2. configuration of wakeup sources
      Whilst the WKUP pin is enabled explicitly, RTC and independent watchdog are not configured and thus can be initialized by other means.
    3. writing information to the backup register
      (see Startup Procedure)

At the end of the shutdown procedure, the module tests whether a power plug is attached.
If so, it restarts and will enter Hibernate mode on startup, else the MCU enters standby mode.

DiWheelDrive

  1. first custom operation
    nothing (just proceeding to the next step)
  2. second custom operation
    1. cutting power of the motors by setting POWER_EN inactive
    2. configuration of wakeup sources
      Whilst the WKUP pin is enabled explicitly, RTC and independent watchdog are not configured and thus can be initialized by other means.
  3. third custom operation
    nothing (just proceeding to the next step)

At the end of the shutdown procedure, the module enters standby mode.


Hibernate

PowerManagement

  1. first custom operation
    nothing (just proceeding to the next step)
  2. second custom operation
    nothing (just proceeding to the next step)
  3. third custom operation
    1. cutting power
      1. deactivation of SYS_WARMRST_N
      2. deactivation of SYS_REG_EN
      3. deactivation of POWER_EN
      4. Waits ten milliseconds to make sure, everything is shut down.
    2. writing information to the backup register
      (see Startup Procedure)

At the end of the shutdown procedure, the MCU resets and will enter Hibernate mode on startup.

DiWheelDrive

Since the DiWheelDrive can not initiate Hibernate mode (only the PowerManagement can do that), there is no special shutdown sequence for this case.
All particularities for Hibernate mode are handled during startup.


Restart

PowerManagement

  1. first custom operation
    1. Waits one millisecond to ensure, all modules could detect the state of SYS_PD_N.
    2. setting SYS_PD_N inactive
    3. Waits another millisecond for the same reason.
  2. second custom operation
    nothing (just proceeding to the next step)
  3. third custom operation
    1. cutting power
      1. deactivation of SYS_WARMRST_N
      2. deactivation of SYS_REG_EN
      3. deactivation of POWER_EN
      4. Waits ten milliseconds to make sure, everything is shut down.
    2. writing information to the backup register
      (see startup)

At the end of the shutdown procedure, the MCU will either enter the default low-power mode (DeepSleep) or reset, depending on the state of SYS_PD_N.

DiWheelDrive

  1. first custom operation
    1. Waits one millisecond to ensure, all modules could detect the state of SYS_PD_N.
    2. setting SYS_PD_N inactive
    3. Waits another millisecond for the same reason.
  2. second custom operation
    1. cutting power of the motors by setting POWER_EN inactive
    2. configuration of wakeup sources
      Whilst the WKUP pin is enabled explicitly, RTC and independent watchdog are not configured and thus can be initialized by other means.
  3. third custom operation
    nothing (just proceeding to the next step)

At the end of the shutdown procedure, the module enters standby mode.