SAM-BA® ISP - Applets: Program External QSPI NOR Flash Memory

Program External QSPI NOR Flash Memory (qspiflash)

The qspiflash applet initializes the Quad Serial Peripheral Interface (QSPI) controller and can perform read, write, erase, and verify functions.

The qspiflash applet applies to the following devices. Documentation is available in the ../sam-ba/doc/ directory.

Device Documentation
SAM9X60 ../doc/sam9x60.html
SAM9XX5 ../doc/sam9xx5.html
SAMA5D2 Series ../doc/sama5d2.html
SAMA5D3 ../doc/sama5d3.html
SAMA5D4 ../doc/sama5d4.html

Additional documentation is located in the ../doc/qspiflash.html document directory.

qspiflash Command Structure

Initialize Controller

Initialization of the qspiflash applet has the following command structure:

$ sam-ba -p <port> -d <device> -a qspiflash -c <command>

A list of parameters to initialize the qspiflash applet can be displayed with the following command:

$ sam-ba -p serial -d sama5d2 -a qspiflash:help

Syntax: qspiflash:[<instance>]:[<ioset>]:[<frequency>]
    instance   QSPI controller instance
    ioset      QSPI I/O set
    frequency  QSPI clock frequency in MHz
    qspiflash         use default board settings
    qspiflash:0:3:66  use fully custom settings (QSPI0, IOSET3, 66MHz)
    qspiflash:::20    use default board settings but force frequency to 20MHz

A list of parameters per support target device is located in the ../doc/qspiflash.html document directory.

Supported Commands

A list of commands supported by the qspiflash controller can be displayed with the following command:

$ sam-ba -p <port> -d <device> -a qspiflash -c help

read Command

The read command reads data from QSPI flash into a binary file.

$ sam-ba -p serial -b sam9x60-ek -a qspiflash -c read:help

* read - read from memory to a file
    read:firmware.bin              read all to firmware.bin
    read:firmware.bin:0x1000       read from 0x1000 to end into firmware.bin
    read:firmware.bin:0x1000:1024  read 1024 bytes from 0x1000 into firmware.bin
    read:firmware.bin::1024        read 1024 bytes from start of memory into firmware.bin

erase Command

The erase command erases (resets to 0xFF) a range of data blocks in the QSPI flash. The size of the data block depends on the target device (manufacturer and part number).

$ sam-ba -p serial -b sam9x60-ek -a qspiflash -c erase:help

* erase - erase all or part of the memory
    erase                 erase all
    erase:4096            erase from 4096 to end
    erase:0x1000:0x10000  erase from 0x1000 to 0x11000
    erase::0x1000         erase from 0 to 0x1000

write and writeboot Command

The write and writeboot commands write data from a binary file into the QSPI flash.

The blocks containing the pages to be written should be erased first with the erase command.

Padding bytes are added to align programmed data to the page boundary.

$ sam-ba -p serial -b sam9x60-ek -a qspiflash -c write:help

* write - write to memory from a file
    write:bootstrap.bin         write bootstrap.bin to start of memory
    write:u-boot.bin:0x10000    write u-boot.bin at offset 0x10000

The writeboot command modifies the relevant unused ARM exception vector to store the size of the bootstrap binary, as required by the ROM Boot code during the boot process.

$ sam-ba -p serial -b sam9x60-ek -a qspiflash -c writeboot:help

    writeboot:bootstrap.bin     write bootstrap.bin as boot program at start of memory

verify and verifyboot Command

The verify and verifyboot commands compare the data written into the QSPI flash with the contents of a binary file.

$ sam-ba -p serial -b sam9x60-ek -a qspiflash -c verify:help

* verify - verify memory from a file
    verify:firmware.bin         verify that start of memory matches firmware.bin
    verify:firmware.bin:0x1000  verify that memory at offset 0x1000 matches firmware.bin

$ sam-ba -p serial -b sam9x60-ek -a qspiflash -c verifyboot:help

* verifyboot - verify boot program from a file
    verifyboot:bootstrap.bin    verify that start of memory matches boot program bootstrap.bin
© 2021 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.