AB SWAP on Aurix TriCore platform for OTA

  • UCB_SWAP_{ORIG|COPY}_MARKERLx: Determines the system address map (standard or alternate) used by the currently running application.
  • UCB_SWAP_{ORIG|COPY}_MARKERHx: Holds the 32-bit system address of the corresponding UCB_SWAP_{ORIG|COPY}_MARKERLx entry confirming its validity. The startup software checks this for safety before the address map is installed.
  • UCB_SWAP_{ORIG|COPY}_CONFIRMATIONLx: This holds the confirmation code of the address map configured in the previous MARKER{L|H}x. A valid code indicates that the startup software can install the above configuration of the address map in the SCU_SWAPCTRL register. (More on this register later)
  • UCB_SWAP_ORIG_CONFIRMATIONHx: Holds the 32-bit system address of the corresponding UCB_SWAP_{ORIG|COPY}_CONFIRMATIONLx entry confirming its validity. Startup software checks this register segment before the MARKER regions are read. The address map is installed only if this address matches the actual address of this location.
  • The address map value is written to MARKERLx. Address map value is either 0x55 or 0xAA. 0x55 corresponds to A-banks, and 0xAA corresponds to B-banks.
  • The address of the MARKERLx register is written to MARKERHx
  • Confirmation code 0x57B5327F is written to CONFIRMATIONLx.
  • The address of this CONFIRMATIONLx is written to CONFIRMATIONHx
  • Then the UCB_OTP.PROCONTP.SWAPEN is written to enable the swap. Before enabling SWAPEN, make sure that the UCB_SWAP_ORIG & UCB_SWAP_COPY are written.
  • After this, a system reset is needed to perform the address map swap and run the new bank.
  • If SWAP is enabled and UCB state of UCB_SWAP_ORIG is CONFIRMED or UNLOCKED, and no valid SWAP configuration exists in ORIG, then the device remains in the reset state forever.
  • Only if the state of UCB_SWAP_ORIG is ERRORED, then UCB_SWAP_COPY is evaluated and used for installation. If there is no valid entry in UCB_SWAP_COPY, then the device remains in reset state forever. Hence it is recommended to write the UCB_SWAP_COPY before the UCB_SWAP_ORIG is written.
  • SWAP cannot be switched off if any of UCB_OTPx_{ORIG | COPY} is set to UCB state ‘CONFIRMED’. So, set this only when the SWAP mechanism needs to be enabled permanently. This is where the term One Time Programmable of OTP comes from.
  • SCU_STMEM1.SWAP_DW_INDEX: This is the index of the UCB_SWAP_{ORIG|COPY} register used to install the SWAP configuration (A/B). Recall,MARKER{L|H}x and CONFIRMATION{L|H}x. This is that x.
  • SCU_STMEM1.SWAP_TARGET: Indicates if the UCB_SWAP_COPY or the UCB_SWAP_ORIG was used to install the address map.
    - 0b SWAP configuration done based on UCB_SWAP_ORIG
    - 1b SWAP configuration done based on UCB_SWAP_COPY
  • SCU_STMEM1.SWAP_CFG: SWAP configuration. This register member indicates which address map is installed. Standard or Alternate.
    - 00B no SWAP configured by SSW (the SWAP feature is not enabled, the entire PFlash address space is active with the default map)
    - 01b SWAP A configured (PFlash Bank A active, B inactive)
    - 10b SWAP B configured (PFlash Bank B active, A inactive)
    - 11b reserved

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store