Hard Processor System Technical Reference Manual: Agilex™ 5 SoCs

ID 814346
Date 4/01/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

A.2.6.1.2.2. Indirect Write Operation

An indirect write operation programs data from the SRAM to the Flash memory. The following registers control the indirect write operations:

  • Indirect write transfer register (indwr)
  • Indirect write transfer watermark register (indwrwater)
  • Indirect write transfer start address register (indwrstaddr)
  • Indirect write transfer number bytes register (indwrcnt)
  • Indirect address trigger register (indaddrtrig)

These registers need to be configured prior to issuing indirect write operations. The start address needs to be defined in the indwrstaddr register and the total number of bytes to be written is specified in the indwrcnt register. The start indirect write bit (start) of the indwr register triggers the indirect write operation from the SRAM to the Flash memory.

To write data from the SRAM to the Flash device, an external controller issues 32-bit write transactions to the data target. The address of the write access must be in the indirect address range. You can configure the indirect address through the indaddrtrig register. The external controller can issue 32-bit writes until the last word of an indirect transfer. On the final write, the external controller may issue a 32-bit, 16-bit, or 8-bit write to complete the transfer. If there are less than four bytes of data to write on the last transfer, the external controller can still issue a 32-bit write and the QSPI controller discards the extra bytes.

The SRAM size can limit the amount of data that the QSPI controller can accept from the external controller. If the SRAM is not full at the point of the write access, the data is pushed to the SRAM with minimum latency. If the external controller attempts to push more data to the SRAM than the SRAM can accept, the QSPI controller back-pressures the external controller with wait states. When the SRAM resource is freed up by pushing the data from SRAM to the Flash memory, the SRAM is ready to receive more data from the external controller. When the SRAM holds an equal or greater number of bytes than the size of a Flash page, or when the SRAM holds all the remaining bytes of the current indirect transfer, the QSPI controller initiates a write operation to the Flash memory.

The processor can also use the SRAM fill level, in the sramfill register, to control when to write more data into the SRAM.

Alternatively, you can configure the fill level watermark of the SRAM in the indwrwater register. When the SRAM fill level falls below the watermark level, an indirect transfer watermark interrupt is generated to tell the software to write the next page of data to the SRAM. Because the QSPI controller initiates non-end-of-data writes to the Flash memory only when the SRAM contains a full Flash page of data, you must set the watermark level to a value greater than one Flash page to avoid the system stalling. You can disable this watermark feature by writing a value of all ones to the indwrwater register.

If the address of the write access is outside the range of the indirect trigger address, one of the following actions occurs:

  • When direct access mode is enabled, the write uses direct access mode.
  • When direct access mode is disabled, the target returns an error back to the requesting controller.

You can cancel an indirect operation by setting the cancel indirect write bit (cancel) of the indwr register to 1. For more information, refer to the “Indirect Write Operation” section.