IMX6UL evk with NAND [SOLVED]

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX6UL evk with NAND [SOLVED]

Jump to solution
6,818 Views
matkattanek
Contributor III

Installed the mfgtools using L4.1.15_2.0.0-ga_mfg-tools. Was able to successfully flash QSPI and SDCARD via OTG usb.

Got the board re-worked and soldered on the NAND.

Using the mfgtools demo packages and running mfgtool2-yocto-mx-evk-NAND.vbs, i encoutered some issues.

Looks like the NAND is recognized by the kernel and initialized.

 

nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x44
nand: Micron MT29F32G08CBADAWP
nand: 4096 MiB, MLC, erase size: 2048 KiB, page size: 8192, OOB size: 744
gpmi-nand 1806000.gpmi-nand: enable the asynchronous EDO mode 5
Bad block table not found for chip 0
Bad block table not found for chip 0
Scanning device for bad blocks
Bad eraseblock 90 at 0x00000b400000
Bad eraseblock 91 at 0x00000b600000
Bad eraseblock 114 at 0x00000e400000
Bad eraseblock 552 at 0x000045000000
Bad eraseblock 972 at 0x000079800000
Bad eraseblock 1022 at 0x00007fc00000
Bad eraseblock 1424 at 0x0000b2000000
Bad eraseblock 1754 at 0x0000db400000
Bad block table written to 0x0000ffe00000, version 0x01
Bad block table written to 0x0000ffc00000, version 0x01
gpmi-nand 1806000.gpmi-nand: driver registered.

 

But when UTP starts it actually runs into an error:

Linux File-Backed Storage
random: nonblocking pool is initialized
UTP: received command '$ mount -t debugfs debugfs /sys/kernel/debug'
UTP: executing "mount -t debugfs debugfs /sys/kernel/debug"
UTP: sending Success to kernel for command $ mount -t debugfs debugfs
/sys/kernel/debug.
utp_poll: pass returned.
UTP: received command '$ flash_erase /dev/mtd0 0 0'
UTP: executing "flash_erase /dev/mtd0 0 0"
Erasing 2048 Kibyte @ b200000 --  4 % complete flash_erase: Skipping bad block
at 0b400000
flash_erase: Skipping bad block at 0b600000
Erasing 2048 Kibyte @ e200000 --  5 % complete flash_erase: Skipping bad block
at 0e400000
Erasing 2048 Kibyte @ 44e00000 -- 26 % complete flash_erase: Skipping bad block
at 45000000
Erasing 2048 Kibyte @ 79600000 -- 47 % complete flash_erase: Skipping bad block
at 79800000
Erasing 2048 Kibyte @ 7fa00000 -- 49 % complete flash_erase: Skipping bad block
at 7fc00000
Erasing 2048 Kibyte @ b1e00000 -- 69 % complete flash_erase: Skipping bad block
at b2000000
Erasing 2048 Kibyte @ db200000 -- 85 % complete flash_erase: Skipping bad block
at db400000
Erasing 2048 Kibyte @ fc400000 -- 98 % cutp_poll: pass returned.
Erasing 2048 Kibyte @ ff600000 -- 99 % complete flash_erase: Skipping bad block
at ff800000
flash_erase: Skipping bad block at ffa00000
flash_erase: Skipping bad block at ffc00000
flash_erase: Skipping bad block at ffe00000
Erasing 2048 Kibyte @ ffe00000 -- 100 % complete 
UTP: sending Success to kernel for command $ flash_erase /dev/mtd0 0 0.
UTP: received command 'send'
UTP: sending Success to kernel for command send.
UTP: received command '$ kobs-ng init -x -v --chip_0_device_path=/dev/mtd0
$FILE'
UTP: executing "kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 $FILE"
MTD CONFIG:
  chip_0_device_path = "/dev/mtd0"
  chip_1_device_path = "(null)"
  search_exponent = 2
  data_setup_time = 80
  data_hold_time = 60
  address_setup_time = 25
  data_sample_time = 6
  row_address_size = 3
  column_address_size = 2
  read_command_code1 = 0
  read_command_code2 = 48
  boot_stream_major_version = 1
  boot_stream_minor_version = 0
  boot_stream_sub_version = 0
  ncb_version = 3
  boot_stream_1_address = 0
  boot_stream_2_address = 0
         -- We add the 1k-padding to the uboot.
.tmp_kobs_ng: verifying using key '00000000000000000000000000000000'
.tmp_kobs_ng: is a valid bootstream for key '00000000000000000000000000000000'
mtd: use new bch layout raw access mode
mtd: opening: "/dev/mtd0"
NFC geometry :
        ECC Strength       : 40
        Page Size in Bytes : 8762
        Metadata size      : 10
        ECC Chunk Size in byte : 1024
        ECC Chunk count        : 8
        Block Mark Byte Offset : 7692
        Block Mark Bit Offset  : 0
====================================================
mtd: opened '/dev/mtd0' - '(null)'
mtd: mtd size too small
mtd_init failed!
UTP: sending Non-success to kernel for command $ kobs-ng init -x -v
--chip_0_device_path=/dev/mtd0 $FILE.
utp_poll: exit with status 1280

 

Can anybody shed some light on this one.  What went wrong? Did I miss to initialize something?

 

Mat

Original Attachment has been moved to: imx6ul_evk_nand_flash.log.zip

Labels (2)
1 Solution
3,683 Views
matkattanek
Contributor III

Finally figured out the last missing pieces of the 'NAND' puzzle. I came to realize that my custom uboot and kernel I am using with mfgtool is NOT the same that is loaded to the NAND.

The mfgtool distinguish between the mfgtools u-boot/kernel and the uboot/kernel is flashes into NAND. There are 2 respective folder:

     mfgtools/Profiles/Linux/OS Firmware/firmware/       uboot and kernel used by the mfgtool to initialize the board

     mfgtools/Profiles/Linux/OS Firmware/files                files here will be flashed into the NAND  (or sd,qspi,emmc,..)

As already mentioned earlier the uboot/kernel that comes with the mfgtool2 package does NOT work with imx6ul EVK NAND configuration. So my fix was simple. I just copied my custom uboot and kernel to the folder 'files'.

Re-flashed the NAND (' mfgtool2-yocto-mx-evk-NAND.vbs') and now after reset I see the uboot messages popping up and the kernel is starting.   FINALLY i got to boot from NAND.

I still noticed a mixup  with the NAND/MTD/ubifs partition. The problem was sorted quickly and addressed in 'mx6ul_14x14_evk.h'.

This header file defines the NAND partitions for the kernel, which I modified already earlier in the process. But I overlooked that there are 2x NAND partition declarations. Both need to be  setup exactly the same. Go figure!. Here is my example ( nand partition setup in blue):

snippet from  /u-boot-imx-mfgtool/2016.03-r0/git/include/configs/mx6ul_14x14_evk.h:

#ifdef CONFIG_SYS_BOOT_NAND
#define CONFIG_MFG_NAND_PARTITION "mtdparts=gpmi-nand:64m(boot),16m(kernel),16m(dtb),16m(misc),-(rootfs) "
#else
#define CONFIG_MFG_NAND_PARTITION ""
#endif

#define CONFIG_MFG_ENV_SETTINGS \
        "mfgtool_args=setenv bootargs console=${console},${baudrate} " \
            CONFIG_BOOTARGS_CMA_SIZE \
                "rdinit=/linuxrc " \
                "g_mass_storage.stall=0 g_mass_storage.removable=1 " \
                "g_mass_storage.file=/fat g_mass_storage.ro=1 " \
                "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\
                "g_mass_storage.iSerialMxNumber=\"\" "\
                CONFIG_MFG_NAND_PARTITION \
                "clk_ignore_unused "\
                "\0" \
        "initrd_addr=0x83800000\0" \
        "initrd_high=0xffffffff\0" \
        "bootcmd_mfg=run mfgtool_args;bootz ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \

#if defined(CONFIG_SYS_BOOT_NAND)
#define CONFIG_EXTRA_ENV_SETTINGS \
        CONFIG_MFG_ENV_SETTINGS \
        "panel=TFT43AB\0" \
        "fdt_addr=0x83000000\0" \
        "fdt_high=0xffffffff\0"   \
        "console=ttymxc0\0" \
        "bootargs=console=ttymxc0,115200 ubi.mtd=4 "  \
                "root=ubi0:rootfs rootfstype=ubifs "                 \
                CONFIG_BOOTARGS_CMA_SIZE \
                "mtdparts=gpmi-nand:64m(boot),16m(kernel),16m(dtb),16m(misc),-(rootfs)\0"\
        "bootcmd=nand read ${loadaddr} 0x4000000 0x800000;"\
                "nand read ${fdt_addr} 0x5000000 0x100000;"\
                "bootz ${loadaddr} - ${fdt_addr}\0"

Note:  the NAND partition order should match what you have in ' mfgtool2-yocto-mx-evk-NAND.vbs'.

PS:     ubi.mtd=4       this points to the rootfs partition

View solution in original post

13 Replies
3,683 Views
sreekanth_m
Contributor II

Hi Mat,

I learnt from this conversation that you are able to flash it to QSPI through mfgtools. Can u please explain the steps you followed to do that?

mainly, we wanted to know the way partitions are setup or flash the NOR with zImage, dtb and rootfs. Do we have to make multiple partitions similar to NAND? 

Thanks

Sreekanth M.

0 Kudos
3,683 Views
matkattanek
Contributor III

Sreekanth,

to program/flash the QSPI I just used the mfgtools. There are samples  provided by NXPs mfgtools that allow you to do exactly  that.  Typically QSPI flash is not big enough to have a complete rootfs on it. Most cases it just fits u-boot, zimage and dtb. For that reason I explored NAND and EMMC.

If your rootfs is small enough to fit your QSPI, then I would suggest to look at the NAND and/or EMMC setup.

An alternative is just to pick a starting block in the QSPI for the rootfs image  and then modify U-boot respectively.

Mat

3,683 Views
sreekanth_m
Contributor II

Hi Mat,

Thanks for your reply.

I had gone through the .xml file what NXP's mfgtool has given. In that I don't see those commands where partition is done to dump the kernel image and dtb. I see only U- boot partition and writing it to the flash. QSPI which is available on the board is only 32MB(256Mb) which cant accommodate rootfs. I just wanted to know if you were able to flash kernel image and dtb files to QSPI?

Your help will be appreciated.

Thanks

Sreekanth M.

0 Kudos
3,683 Views
matkattanek
Contributor III

As already mentioned before: Yes I used the mfg2 tools to flash u-boot, kernel image and DTB into the QSPI successfully.

Just reboot. (assure you have the correct jumper settings) then you will see the evk board booting up.

0 Kudos
3,683 Views
sreekanth_m
Contributor II

Hi Mat,

Thanks for your patience to understand my problem.

Let me detail it a little more.

Even I used mfgtool to flash it. I didn't modify anything in the .xml file given by NXP. I just ran vbs script for QSPI NOR FLASH. After that I rebooted the device with the boot pin configuration for QSPI NOR. I saw u-boot was coming up. But kernel didn't come up. I changed the environment variable for bootcmd too. Still it didn't work.Later I checked the xml file. Then I got to see there are no kernel images and dtb files flashed to the NOR flash.

If possible could you please share the xml file you used for mfgtool so that I could compare with the one I do have.

Your help will be appreciated Mat.

Thanks

Sreekanth M.

0 Kudos
3,683 Views
matkattanek
Contributor III

Sreekanth,  Sorry I can't be of any help with that. I looked, but I do not have any data, config or logs left. Plus at this point i do not have access to any qspi hardware.

What I remember though that u-boot, dtb and kernel image is written to the QSPI on the evk board. On reboot then it launches and looks for a TFTP server to boot from. 

If your kernel is not written in QSPI:

  - Is your QSPI big enough to hold all the data

  - check the mfgtool logs for any errors

  - check the serial console output while flashing the QSPI

Mat

0 Kudos
3,683 Views
eric_kang
Contributor II

Dear Mat,

I'm trying the NAND boot in i.MX6UL-EVK.

I confirmed the NAND Writing operation with MFGTool.

But I couldn't boot from the NAND on i.MX6UL-EVK.

Could you tell me how to boot from NAND in your case?

For your more understanding,

I'll attach the NAND Writing Log via MFGTool and the NAND Booting Log.

Best Regards,

Eric.

=======================

In my case, the NAND boot was not operated normally after displaying the below logs.

nand read 0x80800000 0x4000000 0x800000; // Kernel, 0x80.0000
NAND read: device 0 offset 0x4000000, size 0x800000

NAND read: device 0 offset 0x5000000, size 0x100000
 1048576 bytes read: OK

Kernel image @ 0x80800000 [ 0x000000 - 0x639b68 ]
## Flattened Device Tree blob at 83000000
   Booting using the fdt blob at 0x83000000
   Using Device Tree in place at 83000000, end 8300bedf

fdt_find_or_add_subnode: memory: FDT_ERR_BADSTRUCTURE
ERROR: arch-specific fdt fixup failed
 - must RESET the board to recover.


FDT creation failed! hanging...### ERROR ### Please RESET the board ###

0 Kudos
3,683 Views
matkattanek
Contributor III

 FDT_ERR_BADSTRUCTURE indicates your NAND is most likely not properly written.

0 Kudos
3,684 Views
matkattanek
Contributor III

Finally figured out the last missing pieces of the 'NAND' puzzle. I came to realize that my custom uboot and kernel I am using with mfgtool is NOT the same that is loaded to the NAND.

The mfgtool distinguish between the mfgtools u-boot/kernel and the uboot/kernel is flashes into NAND. There are 2 respective folder:

     mfgtools/Profiles/Linux/OS Firmware/firmware/       uboot and kernel used by the mfgtool to initialize the board

     mfgtools/Profiles/Linux/OS Firmware/files                files here will be flashed into the NAND  (or sd,qspi,emmc,..)

As already mentioned earlier the uboot/kernel that comes with the mfgtool2 package does NOT work with imx6ul EVK NAND configuration. So my fix was simple. I just copied my custom uboot and kernel to the folder 'files'.

Re-flashed the NAND (' mfgtool2-yocto-mx-evk-NAND.vbs') and now after reset I see the uboot messages popping up and the kernel is starting.   FINALLY i got to boot from NAND.

I still noticed a mixup  with the NAND/MTD/ubifs partition. The problem was sorted quickly and addressed in 'mx6ul_14x14_evk.h'.

This header file defines the NAND partitions for the kernel, which I modified already earlier in the process. But I overlooked that there are 2x NAND partition declarations. Both need to be  setup exactly the same. Go figure!. Here is my example ( nand partition setup in blue):

snippet from  /u-boot-imx-mfgtool/2016.03-r0/git/include/configs/mx6ul_14x14_evk.h:

#ifdef CONFIG_SYS_BOOT_NAND
#define CONFIG_MFG_NAND_PARTITION "mtdparts=gpmi-nand:64m(boot),16m(kernel),16m(dtb),16m(misc),-(rootfs) "
#else
#define CONFIG_MFG_NAND_PARTITION ""
#endif

#define CONFIG_MFG_ENV_SETTINGS \
        "mfgtool_args=setenv bootargs console=${console},${baudrate} " \
            CONFIG_BOOTARGS_CMA_SIZE \
                "rdinit=/linuxrc " \
                "g_mass_storage.stall=0 g_mass_storage.removable=1 " \
                "g_mass_storage.file=/fat g_mass_storage.ro=1 " \
                "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\
                "g_mass_storage.iSerialMxNumber=\"\" "\
                CONFIG_MFG_NAND_PARTITION \
                "clk_ignore_unused "\
                "\0" \
        "initrd_addr=0x83800000\0" \
        "initrd_high=0xffffffff\0" \
        "bootcmd_mfg=run mfgtool_args;bootz ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \

#if defined(CONFIG_SYS_BOOT_NAND)
#define CONFIG_EXTRA_ENV_SETTINGS \
        CONFIG_MFG_ENV_SETTINGS \
        "panel=TFT43AB\0" \
        "fdt_addr=0x83000000\0" \
        "fdt_high=0xffffffff\0"   \
        "console=ttymxc0\0" \
        "bootargs=console=ttymxc0,115200 ubi.mtd=4 "  \
                "root=ubi0:rootfs rootfstype=ubifs "                 \
                CONFIG_BOOTARGS_CMA_SIZE \
                "mtdparts=gpmi-nand:64m(boot),16m(kernel),16m(dtb),16m(misc),-(rootfs)\0"\
        "bootcmd=nand read ${loadaddr} 0x4000000 0x800000;"\
                "nand read ${fdt_addr} 0x5000000 0x100000;"\
                "bootz ${loadaddr} - ${fdt_addr}\0"

Note:  the NAND partition order should match what you have in ' mfgtool2-yocto-mx-evk-NAND.vbs'.

PS:     ubi.mtd=4       this points to the rootfs partition

3,683 Views
matkattanek
Contributor III

As decribed in my last comment I now can flash the NAND. But still facing an issues: I can't boot from the NAND.

Not sure what is going on. the mfgtool tells me it succeeded without problems. I set the switches SW602 and SW601 to 'internal boot' and boot device to NAND. but when a apply power/reset nothing happens.

On the serial console I do not see any output at all. I would expect at least some U-boot output to come up. But nothing.

Another thing I noticed that with above settings the EVK board still presents itself as a HID device. And yes I double checked SW602 is not configured for 'serial download'.

Is there still something else broken with/in mfgtool or setup?

Could the mfgtool files/u-boot be broken too?

Why is the serial console blank?

Did I miss anything hardware-wise that needs  to be changed when the NAND was soldered?

Note: SDcard still works fine. Same with QSPI (before I changed to NAND)

0 Kudos
3,683 Views
matkattanek
Contributor III

Thanks for you response Rita. I already looked at that it was helpful to understand the process. And I came to realize that the current BSP L4.1.15_2.0. Additionally L4.1.15_2.0.0-ga_mfg-tools provides all the tools and binaries needed for imx6ul-evk, including 'mfgtool2-yocto-mx-evk-nand.vbs'

If my understanding is correct the mfgtools are broken/incomplete for the NAND setup and flashing of the imx6ul-evk. The problem is the uboot. The provided u-boot-imx6ul14x14evk_nand.imx does not provide the need kernel arguments needed fo rthe mfg kernel to create the 4 partitions needed [/dev/mtd0.... mtd3].  All the mfg kernel is provided with is /dev/mtd0.

If using a 4G NAND, this leads to a limitation in the ioctl(MEMGETINFO) (passing a 64bit value using a 32bit integer) and makes the imx-kobs app to be presented with a 'zero' size partition.  Thats why the above fails.

So I had to compile my own u-boot-imx-mfgtool and updated my mfgtool/firmware folder. Now the kernel output shows the following:

Kernel command line: console=ttymxc0,115200 rdinit=/linuxrc g_mass_storage.stall=0 g_mass_storage.removable=1 g_mass_storage.file=/fat g_mass_storage.ro=1 g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF g_mass_storage.iSerialNumber= mtdparts=gpmi-nand:64m(boot),16m(kernel),16m(dtb),16m(misc),-(rootfs) clk_ignore_unused

and the respective NAND initialization looks like this:

nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x44
nand: Micron MT29F32G08CBADAWP
nand: 4096 MiB, MLC, erase size: 2048 KiB, page size: 8192, OOB size: 744
gpmi-nand 1806000.gpmi-nand: enable the asynchronous EDO mode 5
Bad block table found at page 524032, version 0x01
Bad block table found at page 523776, version 0x01
nand_read_bbt: bad block at 0x00000b400000
nand_read_bbt: bad block at 0x00000b600000
nand_read_bbt: bad block at 0x00000e400000
nand_read_bbt: bad block at 0x000045000000
nand_read_bbt: bad block at 0x000079800000
nand_read_bbt: bad block at 0x00007fc00000
nand_read_bbt: bad block at 0x0000b2000000
nand_read_bbt: bad block at 0x0000db400000
5 cmdlinepart partitions found on MTD device gpmi-nand
Creating 5 MTD partitions on "gpmi-nand":
0x000000000000-0x000004000000 : "boot"
0x000004000000-0x000005000000 : "kernel"
0x000005000000-0x000006000000 : "dtb"
0x000006000000-0x000007000000 : "misc"
0x000007000000-0x000100000000 : "rootfs"
gpmi-nand 1806000.gpmi-nand: driver registered.

which now results in the imx-knobs tool now happily progressing and flash u-boot, kernel, dtb and rootfs. The flashing now finally succeeds.

PS: I changed 'mfgtool2-yocto-mx-evk-nand.vbs' and set the mtd nand partition rootfs parameter to:

... -s nand=nand -s nanddtb=gpmi-weim -s part_uboot=0 -s part_kernel=1 -s part_dtb=2 -s part_rootfs=4

0 Kudos
3,683 Views
andy_q
Contributor II

Hi mat:

  I have encountered the same issue,I use L4.1.15_2.0.0-ga_mfg-tools to boot nand.

 Could you give detail solution of this trouble ?please see the attachment.

Thanks !

0 Kudos
3,684 Views
Rita_Wang
NXP TechSupport
NXP TechSupport

Hi mat,

About  How-To use NAND boot on i.MX6UL EVK board you can refer to the thread How-To use NAND boot on i.MX6UL EVK board patch and tools are here.
Have a great day,
Rita

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos