QSPI NOR Flash ================ This guide will show you how to access the 16 MiB QSPI NOR Flash populated on the phyCORe-i.MX7 SOM. The NOR Flash is accessible through the QSPI interface and can also be used as an alternative boot source. This guide will show how to read from and write to the QSPI NOR. Available NOR Partitions -------------------------- * Make sure the NOR interface was initialized properly. .. code-block:: none :caption: Target (Linux) mtdinfo .. code-block:: none :caption: Expected Output Count of MTD devices: 1 Present MTD devices: mtd0 Sysfs interface supported: yes * View basic partition information. .. code-block:: none :caption: Target (Linux) cat /proc/mtd .. code-block:: none :caption: Expected Output dev: size erasesize name mtd0: 01000000 00010000 "30bb0000.spi" * More detailed information can be viewed using the "mtdinfo" command on a specific partition. .. code-block:: none :caption: Target (Linux) mtdinfo /dev/mtd0 .. code-block:: none :caption: Expected Output mtd0 Name: 30bb0000.spi Type: nor Eraseblock size: 65536 bytes, 64.0 KiB Amount of eraseblocks: 256 (16777216 bytes, 16.0 MiB) Minimum input/output unit size: 1 byte Sub-page size: 1 byte Character device major/minor: 90:0 Bad blocks are allowed: false Device is writable: true Write to OSPI --------------- * Create a random file equal to the size of the /dev/mtd0 partition (512 kBytes). .. code-block:: none :caption: Target (Linux) dd if=/dev/urandom of=test.dat bs=1k count=512 * Copy the generated file to the mtd0 partition using the "flashcp" command. .. code-block:: none :caption: Target (Linux) flashcp -v test.dat /dev/mtd0 Reading from OSPI ------------------- * Dump the contents of /dev/mtd0 partition to a new file: .. code-block:: none :caption: Target (Linux) dd if=/dev/mtd0 of=read.dat bs=1k count=512 * Make sure the output file was not corrupted during the transfer using md5sum. .. code-block:: none :caption: Target (Linux) md5sum test.dat read.dat .. code-block:: none :caption: Expected Output 90ba5a74fa335d7aef3af63d9b93070a test.dat 90ba5a74fa335d7aef3af63d9b93070a read.dat