19. QSPI Programmer

The ‘QSPI Programmer’ tools are used for burning the QSPI Flash memory. Visualizing and testing the QSPI memory while still under development helps increasing productivity and avoiding mistakes of erroneously programming flash memory. ‘QSPI Programmer’ includes three sub tools for DA1468x family chips: the ‘QSPI Flash Programmer’, the ‘QSPI NVPARAMS Programmer’ and ‘QSPI Partition Table’. For DA1469x family chips it includes one extra tool: ‘QSPI Layout Controller’

19.1. QSPI Flash Programmer

QSPI Flash Programmer is used for downloading an image file to QSPI Flash Memory. Its functionality is similar to the functionality of the OTP Image tab.

../_images/qspi.png

Figure 74 QSPI Flash Programmer

  • Select File to download: User can select a .hex or binary (.bin) image file in order to burn it to the QSPI Flash Memory.

  • Length: (DEC, in KB): Optionally user can specify the number of bytes that will read or erase from QSPI Flash memory.

  • Offset (HEX): Optionally user can specify an offset in hex for the QSPI memory. Actions (read, write) will respect that offset.

  • Memory size (HEX, in Bytes): User set the size of QSPI Flash memory. The value is used for validating that the data range to be read/written does not go beyond the boundaries of the available memory space. In this way, Toolbox makes an initial check before the command is sent to the underlying library.
    If this value is smaller than the actual size, please update the value to prevent Toolbox from issuing the following message:
    Size of data of selected file plus offset exceeds QSPI FLASH memory size
    If this value is higher than the actual size, the underlying library will fail to read/write beyond the max memory size and the following message will be displayed:
    Memory burning failed

For Da1468x family chips, user can make the image bootable by pressing the Prepare Image button. A header is added to the bytes of the file. Deselecting Cached Mode, results in not adding the bootable header to the file. Once the bootable image has been written, the user can press the reset button (a relative message is presented at the Log panel) in order to boot from QSPI Flash Memory. The available options are presented in detail below:

  • Connect: A second stage bootloader is downloaded to the chip to allow the user interact with the QSPI Flash memory. This is a mandatory step before enabling the other actions.
  • Read: The length in KB, indicated by the length text field, is the number of bytes that will be read from QSPI Flash memory, starting from the specified offset. If no or zero length is specified, 32 KB will be read. This offset plus the number of bytes to be read, cannot be greater than the QSPI Flash memory size. Since the application does not know the QSPI Flash memory size, the user can specify it by filling the ‘Memory size (HEX, in bytes)’ text field. If the user does not know the size of the QSPI Flash memory, a default value of 2 MB is used.
  • Erase: User can specify the length to be erased at the length text field and the starting offset at the offset text field. Erase is performed in memory sectors, having a size of 4 KB each. This means that if the offset is inside sector 1 and offset+length is in sector 3, sectors 1, 2 and 3 will be completely erased.
  • Burn: The selected image is burned to the QSPI, at the specified offset.
  • Save: By pressing the Save button, the user has the ability to save QSPI Flash memory contents to a file. A dialog will popup, in order to select the output file, the offset and how many bytes of QSPI Flash memory to save.

Please note that currently SPI Flash Programmer has been tested in BUCK mode at 3V and BOOST mode at 2.7V.

19.2. QSPI NVPARAMS Programmer

This tool allows the user to read and write NVPARAMS block on flash memory and is similar to OTP NVDS tool used for DA14580/581/583 chip family.

By editing the address text field, user can change the address at which a burn and a read operation will be performed. The offset (in bytes) must be a hex number between 0x00000 and the maximum address allowed by the QSPI type selected on QSPI Programmer tool. For burn operations, the offset should be such so that the address where the last NVPARAMS data byte will be written is smaller than the maximum address of QSPI type. The recommended value for start writing NVPARAMS is 0x80000

An example of the NVPARAMS Programmer tab and log output is shown below:

../_images/qspi_nvparams_0.png

Figure 75 QSPI NVPARAMS Programmer

Log screen:

../_images/qspi_nvparams_1.png

Figure 76 QSPI NVPARAMS Programmer log

User selects or inserts the values of the corresponding parameter at column Value. Default values are shown on column Default Value.

There is a second editable column called Enabled where the user defines that the parameter will be actually used. It is also called Validation Flag. When checked a byte with value 0x00 is added at the end of the parameter value in memory. When left unchecked a byte with value 0xFF is added to define that the parameter is not valid for that configuration.

All values except TAG_BLE_PLATFORM_BLE_CA_MIN_RSSI are accepting unsigned values. Validation error messages are shown when user tries to export or burn invalid values. Value of TAG_BLE_PLATFORM_BLE_CA_NB_BAD_PKT is recommended to be half the value of TAG_BLE_PLATFORM_BLE_CA_NB_PKT.

Buttons Connect, Read, Burn, Import from file and Export to file have the same functionality like the previous tools described.

Log or error messages are shown on Log tab during each operation aforementioned.

19.3. QSPI Partition Table

QSPI memory is divided into smaller parts, called partitions. QSPI Partition Table tool is used for reading, writing and erasing flash partitions.

../_images/qspiPartition.png

Figure 77 QSPI Partition Table

In the left part, the user can press the Browse button in order to select a file to burn to a partition or verify a partition against it. The user can hide the left part of the tool and expand the right, or vice versa, by pressing the t01 arrows. In the top right part of the tool, the user can see the contents of the partition table. In order to read the partition table from QSPI flash memory, the user has to first press the Connect button, in order to download the appropriate firmware to the board and the press the Read button. Once a partition table is successfully read from flash memory, the drop down box in Partition Tasks panel is updated with the list of the partitions and the buttons that perform operations on the selected partition, are enabled. The following tasks are available on each partition:

Read: When the user selects a partition from the list and presses the Read button, the contents of the partition are shown in the table of Partition Tasks panel. The user can also enter an offset, which is relative to the partition start address, shown in Partition Table in Start column, in order to read only a part of the partition, starting from this offset and ending at the partition end. By relative, we mean that the user should enter offset 0x200 in order to read from address 0x80200, for a partition starting at address 0x80000. The offset cannot be larger than the total size of the partition, which is estimated as sector_count * sector_size. sector_count indicates the number of sectors a partition contains and is shown in Sector Count column of the Partition Table. sector_size indicates the size of every sector in bytes, is read from QSPI Flash memory and is printed in the log.

Burn: The user can load a file in the left part of the tool by pressing the Browse button, and then press the Burn button, in order to write it to the selected partition. If a value has been entered in offset field, the file contents will be burned in the specified, relative to the partition start address, offset. After burn, the partition is read again in order to refresh its contents.

Verify: The user can load the file to be verified a partition against in the left part of the tool, by pressing the Browse button. The user can also insert a value in offset field, in order to verify only part of the partition, starting from offset and ending after file_length bytes, where file_length is the size in bytes of the file that the partition is verified against. When the verification fails, an error message indicating the first address where the partition contents differ from the file contents, is shown in the log.

Erase: By pressing erase, all the bytes of the selected partition are erased. After erase, the partition is read again in order to refresh its contents and also to verify that all the bytes have been successfully erased.

Save: By pressing save, all the bytes of the selected partition can be saved in a hex or bin file.

19.4. QSPI Layout Controller

This tool is available for DA1469x family chips. QSPI Flash of DA1469x family chips is partitioned into regions in order to have the possibility to support multiple images in one Flash device. The first region of the QSPI is used for the Configuration Script section and the Product Header section. Then one or more Firmware Image sections may follow. The sections are optional and their start is indicated by special bytes at the beginning of the section. Some of the sections may contain optional fields and subsections, the length of which is indicated by the value of other fields. QSPI Layout Controller helps the user visualize the layout of the QSPI, by detecting the sections that have been burned to the QSPI and presenting them to the user in a tree-table format. The following image shows 2 sections in QSPI Layout Controller: Product Header and Firmware Image:

../_images/qspiLayout.png

Figure 78 QSPI Layout Controller

Product Header section contains special fields which determine the presence of firmware images in QSPI. Flash Programmed Identifier field is turned to true to indicate the presence of one or more firmware images in Flash. Active FW Image address field points to the address of the active firmware image in Flash. If an Upgrade FW Image is also specified, the Booter will try to validate the upgrade image and if validated both Active FW Image and Upgrade FW Image fields will point to the address of the upgrade firmware image. The buttons in the QSPI Layout Controller that can be used to program the QSPI Flash memory are the following:

Connect: Opens the connection with the selected interface and downloads the bootloader to the target device.

View: By pressing the View button, the user can view secondary/backup sections that are not usually visible through the Read button. When the user presses the View button, a popup appears (Figure 79) asking the user to select a backup section to view. As soon as the user selects a backup section, another popup (Figure 80) appears showing the selected section.

../_images/qspiSelectSection.png

Figure 79 Select a section to view

../_images/qspiBackupProductHeader.png

Figure 80 View of the ‘Backup Product Header’

Note

Currently only ‘Backup Product Header’ is supported.

Read: QSPI Layout Controller tries to detect the sections that have been burned in memory and builds the table that presents QSPI memory layout. The minimum requirements to detect FW Images in QSPI is to detect the Flash Programmed identifier of the Product Header and a valid firmware image address in the Active FW Image address field.

Burn: By pressing the Burn button the user can select which of the sections that are loaded in the QSPI Layout Controller table will be burned to the memory.

Erase: By pressing the Erase button the user can select which one of the sections that will be erased from the QSPI memory. Note that FW Image(s) detection depends on Product Header values, so if Product Header is erased FW Image(s) will not be visible in QSPI Layout Controller after reading the QSPI Flash memory.

Change default flash params: This button is used to configure the size of the QSPI Flash memory that is available for writing firmware images and the maximum size of an image in QSPI Flash. When pressed the popup in Figure 81 is presented:

../_images/changeFlashParams.png

Figure 81 Change default flash params

The popup is loaded with the default values: 0x00200000 bytes for Flash size and 0x00080000 bytes for max image size. User specified values are saved in the selected settings file and are loaded the next time the same settings file is selected and Flash parameters’ configuration dialog opens.

Add: The user can use the Add button to add firmware images in QSPI Flash. When the Add button is pressed, the popup in Figure 82 is presented and user can select what type of section should be added the QSPI Flash. If “Firmware Image” is selected, the “Prepare QSPI Image” dialog is presented (Figure 83). The user initially selects the binary file which will be converted to a DA1469x device image and loaded to the QSPI Layout Controller table. Optionally the generate image can be saved in a binary file, if the user specifies a file in the “Save image to file” field. The image is generated when the Prepare Image button is pressed. In order to load the image to the QSPI Layout Controller table, the user has to select a flash region and optionally an offset in the flash region. The available flash regions are estimated by the values entered in Change default flash params dialog. Each Flash region has size equal to “Max image size” and the number of available flash regions is the “Flash size for writing fw images” divided by the “Max image size”. When a flash region start address has already been used for a FW Image, it is marked with red color. User can use the same flash region for a FW image but he/she is advised to use an offset so that the previous FW Image in this region does not overlap with the new one. For bootable images offset should be multiple of sector size (0x1000). When the OK button is pressed, the image is added to the QSPI Layout Controller table. The “Upgrade FW address” field of the Product Header is updated with the new firmware image address, which is the address of the selected flash region plus the selected offset, if any. Note that firmware images that are loaded in QSPI Layout Controller tool initially have the t02 icon indication, which notifies the user that the FW Image has not been burned to the memory yet. The user can select the Burn button to burn the firmware image to the memory. The “Upgrade FW image address” and the “Flash Programmed Identifier” field of Product Header are also burned to the QSPI Flash together with the firmware image. When the FW Image is burned to the memory, the t03 icon in the FW Image indicates that image is located in QSPI Flash memory. The user can now press the reset button in the target device in order for the Booter in the target device to validate the new firmware image and upgrade to it if it is valid and boot from the QSPI Flash.

../_images/selectSectionToAddToQSPI.png

Figure 82 Add Firmware Image to QSPI

../_images/prepareQSPIImageWindow.png

Figure 83 Prepare QSPI Firmware Image

19.4.1. Configuration Script (CS) in QSPI

A Configuration Script can be added to the QSPI memory by pressing the Add button and selecting Configuration Script. The Manage Configuration Script dialog pops up which will help the user build the CS by adding commands to it. In case a valid CS is already present in the QSPI, the same dialog can be shown by selecting the button that becomes visible when mousing over the value column of the Configuration Script field. Please refer to Configuration Script (CS) in OTP for more details about the Configuration Script and how to use the Manage Configuration Script dialog. Since the CS can be burned more than once to the QSPI memory, the user can alter the contents of the CS that is already burned in memory by deleting commands and adding new commands at any place in the CS.