Skip to content

Reflash U Boot

Wenting Zhang edited this page Mar 10, 2022 · 2 revisions

The u-boot is stored on the onboard SPI Flash. This is a guide about how to reflash the u-boot. This is typically not required.

Getting u-boot and uuu

To be written.

Running u-boot from RAM

The plan is to run the u-boot in the RAM, then write the u-boot image to the SPI flash. The typical u-boot run on the board has the SPL, however, the one being run from the RAM currently needs to have SPL disabled. (NOTE: This is could be changed in the future. Currently, SPL supports SDP protocol, it's possible to run the u-boot from RAM with SPL, however, under current settings it just hangs after jumping. Needs investigation.)

After power-up, the PMIC resets the voltage value. The core supply voltage defaults to 1.275V, the DDR supply voltage defaults to 1.2V, and the SD card supply voltage defaults to 1.3V. The core voltage is okay, however, the remaining 2 are too low (below minimum spec.). These voltages should be set before preceding. There are 2 possible ways:

Use SPL to initialize PMIC (RECOMMENDED)

In a normal boot, the SPL would set up the correct voltage. It's possible and recommended to use the same procedure for USB boot:

  1. Enter the recovery mode by pressing the reset button while holding the recovery button
  2. Create a new file called run_uboot.uuu:
uuu_version 1.2.135

SDP: boot -f u-boot-with-spl.imx
SDPV: write -f u-boot-with-spl.imx -addr 0x877eefc0
SDPV: jump -ivt -addr 0x877fffc0
SDPV: done
  1. Boot the board with sudo uuu run_uboot.uuu

Manually configure voltage

This method is not recommended. However if for whatever reason you need to use this, proceed on.

This method technically violates the specification: the idea is to run the u-boot with default voltage, knowing that DDR is running at only 1.2V instead of 1.35V. Then initialize the PMIC manually in the u-boot to get the correct voltage. Typically when only clocked at DDR3-800, memory should be stable enough to boot into u-boot. However, use this method at your own risk.

  1. Enter the recovery mode by pressing the reset button while holding the recovery button
  2. Create a new file called run_uboot.uuu:
SDP: boot -f u-boot-dtb.imx -nojump
SDP: jump -f u-boot-dtb.imx -ivt
SDP: done
  1. Boot the board with sudo uuu run_uboot.uuu
  2. Run the following commands inside uboot (via serial terminal, like using minicom for example):
i2c dev 0
i2c mw 0x34 0x23.1 0x1b 1
i2c mw 0x34 0x27.1 0x1a 1
i2c mw 0x34 0x29.1 0x68 1

Make sure you enter these commands correctly. Wrong value could damage the hardware.

Writing eFuse values

This is only for brand new chips. This step is typically done before boards are shipped out. So unless you are replacing the main SoC or making your own boards, you could skip this step.

In u-boot, use the following commands to set the default boot mode to QSPI:

fuse prog -y 0 5 0x10 fuse prog -y 0 6 0x10

Hint: related information could be found in i.MX6ULL Reference Manual Chapter 5 and 8.

Flash u-boot

  1. Copy the u-boot-with-spl.imx to the SD Card /boot/ folder if it hasn't been there yet. Insert the SD card to the board.
  2. Run mmc info to make sure the board could detect the SD card.
  3. Run the following commands to load the file into memory:
mmc dev 0
ext4load mmc 0 ${loadaddr} boot/u-boot-with-spl.imx
  1. Run the following commands to write the file into flash
sf probe 0
sf erase 0 +0x100000
sf write ${loadaddr} 0x400 0x${filesize}