Flashing QuadSPI (NOR Flash) via JTAG with u-boot on i.MX6UL

Showing results for 
Search instead for 
Did you mean: 

Flashing QuadSPI (NOR Flash) via JTAG with u-boot on i.MX6UL

No ratings

Flashing QuadSPI (NOR Flash) via JTAG with u-boot on i.MX6UL

1.- Set SW602 Boot mode pin settings to Serial Downloader mode

2.-Connect JTAG debug probe and turn on the board

3.-Run script to bring-up DRAM

In Lauterbach this script is called 'mcimx6ul_sieve_dram.cmm' under the mcimx6ul folder, the scripts can be found here and are also attached (download the imx6ultralite package). If you are not using Lauterbach please ask your probe vendor for a similar script.

NOTE: this u-boot image has been built to run off DRAM if your bootloader runs from OCRAM you might not need a script.

While running the script you might be prompted with and error telling you there is a syntax error in the script system.cpu IMX6ULL simply edit the script and change the CPU name to IMX6ULTRALITE


4.- Load u-boot.srec to DRAM and start executing it

The srec is being used in this case because it contains the addresses where the binary needs to be loaded and the entry point for the application is automatically recognised and set by Lauterbach. To load it simply issue 'data.load.S3record u-boot.srec' and then click on go to let it run.


You should now be able to see the output from u-boot on the console hit any key on the console to stop the boot process.


5.- Load QuadSPI configuration to DRAM and flash it to the memory

The Boot ROM on the i.MX6UL requires the configuration data for the QuadSPI memory to be stored at address 0x400 of the QuadSPI memory, the length of this configuration data is 512 bytes. Attached is a configuration binary that can be used for the NOR flash memory used in the i.MX6UL EVK. For more details on the configuration parameters please refer to chapter '8.6.3 QuadSPI Configuration Parameters' of the i.MX6UL Reference Manual.

Stop the execution on T32 (Lauterbach's environment) and load the configuration to DRAM by issuing 'data.load.binary QSPI_cfg2.bin 0x90000000' and resume execution.



On u-boot execute the 'sf probe' command (sf stands for Serial Flash) to detect the memory.

You should see an output like the following:

=> sf probe
SF: Detected N25Q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB

Now issue the sf erase command to erase the first sector (remember our erase size is of 4KiB):

=> sf erase 0x0 0x1000
SF: 4096 bytes @ 0x0 Erased: OK

Now we are ready to write our configuration to address 0x400

=> sf write 0x90000000 0x400 0x200
SF: 512 bytes @ 0x400 Written: OK

6.- Load u-boot.imx to DRAM and download it to memory.

We will follow the same procedure to download the u-boot image to the memory.

Stop execution on Lauterbach and load u-boot.imx to DRAM using 'data.load.binary u-boot_SPI.imx 0x90000000' and resume execution (u-boot.imx contains the IVT header which basically stores all the information the device needs to boot u-boot.bin and u-boot.imx).

The boot ROM expects to find the IVT header at address 0x1000 of the SPI NOR Flash memory.


We will load u-boot.imx to this address by issuing 'sf update 0x90000000 0x1000 0x57830'(the size of u-boot.imx is 358448 bytes) this will erase and write the memory.

=> sf update 0x90000000 0x1000 0x57830
358448 bytes written, 0 bytes skipped in 23.741s, speed 15458 B/s

If you want to verify that the image was flashed correctly you can read from QuadSPI to DRAM by issuing 'sf read 0x90000000 0x1000 0x57830 ' and verify the data.

7.- Now we can end our debug session and turn off our board

Set SW602 to Internal boot mode (ON/OFF) and SW601 to select boot from QuadSPI (all OFF)

Turn on the board again and you should be able to see u-boot's output on your terminal.


This procedure can be used with other boards/i.MX6 derivatives, I am just posting the setup in which I tested it.

Labels (2)

Hi Manuel,

How does using the IMX6ULL EVK change the above instructions?

Where can users of the mx6ull evk locate the file to load to QSPI Nor Flash at offset 0x400?

Note: I am currently using 'fsl_yocto-L4.1.15_2.0.0-ga.tar.gz' collection of Yocto project instructions with the mx6ull evk.

Thanks Manuel!

--DJ Regan

Hi DJ Regan,

The .cfg file will be located under your tmp/work/... folder after triggering the yocto build, you should be able to use those files. Also please note that the offset for QSPI is 0x1000 not 0x400.



Version history
Revision #:
2 of 2
Last update:
‎09-10-2020 02:21 AM
Updated by: