Help with Booting i.MX6 from NAND Flash

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

Help with Booting i.MX6 from NAND Flash

Jump to solution
15,152 Views
RobMauro
Contributor II

Has anyone booted the i.MX6 from NAND Flash?  Any qualified flash devices?  Any tips?

Labels (1)
1 Solution
3,748 Views
HuangShijie
Contributor III

Most of the NAND chips should be supported to NAND boot.

Please use the latest version kobs-ng to burn the u-boot to NAND.

View solution in original post

22 Replies
3,749 Views
HuangShijie
Contributor III

Most of the NAND chips should be supported to NAND boot.

Please use the latest version kobs-ng to burn the u-boot to NAND.

3,645 Views
timharvey
Contributor IV

Shijie Huang wrote:

Most of the NAND chips should be supported to NAND boot.

Please use the latest version kobs-ng to burn the u-boot to NAND.

I have not been able to find any reference of 'bootlets' code for imx6 - can you provide a reference or documentation?

Is there any support in Freescale's patched u-boot to program NAND in the fasion that kobs-ng does?

Thanks,

Tim

3,645 Views
vivekkaushik
Contributor I

Hello Everyone,

I am booting i.MX6SOLO from NAND in my custom design, but I have below requirement:

1. Want to Keep 2 copies of u-boot in NAND, 1st as an option to be able to modify any time, 2nd as an permanent backup to boot the board if something goes wrong with 1st copy or does not get update properly at the time of updation

Is there a way to achieve this?

Thanks and Regards

Vivek

0 Kudos
3,638 Views
timharvey
Contributor IV

Vivek,

If booting directly from NAND the IMX6 BOOT ROM will allow for multiple copies of the 'bootstream' in case bad blocks occur in the bootstream. Refer to Table 5-9 from the IMX6QDRM (BOOT_SEARCH_COUNT) and Chapter 8 (System Boot) for the flow of the BOOT ROM internal code. I'm not sure what you mean as your first option to modify at any time however.

Tim

0 Kudos
3,629 Views
vivekkaushik
Contributor I

Hello Tim,

Thanks for providing the pointer to solution, below are the my points for elaborating my requirement and concern:

1. Its very good information about BOOT_SEARCH_COUNT, it means with those fuse setting IMX6 will search 2, 4 or 8 times (or 2, 4 or 8 locations of NAND) for u-boot, is my understanding correct?

2. Today I use "kobs-ng init --chip_0_device_path=/dev/mtd0" command for writing the first copy, I do not know how to write 2nd copy and to which location of NAND.

3. from "Option to modify I mean": from my 2 copies of u-boot, I will overwrite or modify only one copy, that at first partition of NAND i.e /dev/mtd0 (starting at 0x0 location of NAND). I will not overwrite 2nd copy of u-boot because as you said in case bad blocks occur or if during my overwriting/modification some things goes wrong then system should be able to boot from this 2nd copy.

Hope I am clear on my requirement and you can provide some support on achieving this feature.

Thanks and Regards

Vivek

0 Kudos
3,629 Views
timharvey
Contributor IV

Vivek,

Yes, BOOT_SEARCH_COUNT tells the internal IMX BOOT ROM what the redundancy

of the Firmware Configuration Block (FCB) whihc consists of NAND timings,

page address of the Discoverred Bad Block Table (DBBT) and pointers to the

primary and secondary firmware. See section 8.5.2.2 of the IMX6QDRM for

more detail along with Figure 8.5 and 8.6 which show the flow-chart for

NAND boot). The 'Search Count' specified by BOOT_CFG2[4:3] indicates how

many times the FCB is repeated in the NAND flash. The bootloader itself is

not replicated 'search count' times, just the critical tables that point to

it. The bootloader gets replicated always twice (primary and secondary). In

my opinion this is not explained very well.

The kobs-ng application is the only way I know of to program the NAND flash

according to the rules explained in section 8.5.2.2. It will handle all the

redundancy for you as long as you provide it the correct parameters. You

need to set the '--search_exponent=' parameter to the value you put

in the BOOT_CFG2[4:3] eFuse/gpio-strapping (which defaults to 2 if you

don't specify) - this should match the 2,4,8 value. The kobs-ng app writes

to a single mtd partition and uses the size of the partition to determine

where it will put things (splits it in half for the two copies of the

bootloader). When you run the kobs-ng application it gives a lot of verbose

information that spells out where its putting things which may explain

things better.

Tim

On Mon, Apr 27, 2015 at 4:06 AM, Vivek Kaushik <

0 Kudos
3,641 Views
visakh
Contributor III

Dear Huang,

Please provide the details regarding kobs-ng and how it can be used to flash the nand. I have an imx53 based custom board and i booted android in my board from sdcard. Now i want the board to boot from the nand flash. I tried mfg tool but it got some issues. what do you think is the best method  to flash the nand?

Thank You

0 Kudos
3,643 Views
HuangShijie
Contributor III

:) The best detail is in the kobs-ng's code.

You can use the "kobs-ng init -v uboot.bin" to burn the uboot to the /dev/mtd0.

The followings are just a summary about the kobs-ng's code:

   [1] parse out the nand chip's geometry, such as page size,oob  size.

   [2] fill the FCB, and DBBT according the [1].

   [3] writting the FCB/DBBT.

   [4] writting the uboot.

BR

Huang Shijie

0 Kudos
3,643 Views
zctee
Contributor III

Hi Huang,

I happen to saw this post when i am scratching my head trying to booting the i.mx6solo from a 4GB NAND flash.

I had manage to flash the u-boot and kernel into the NAND flash using kobs-ng version 1.3.

After flashing in the u-boot and kernel, i am able to boot up the u-boot from NAND.

However, the u-boot is not able to load and go into kernel. It seems like seeing all blocks as bad blocks.

U-Boot 2009.08 (May 06 2015 - 08:31:00)

BOOTLOADER_VER=1.03

CPU:   Freescale i.MX 6 family 0.2V at 792 MHz

Temperature:   56 C, calibration data 0x5aa52169

mx6q pll1: 792MHz

mx6q pll2: 528MHz

mx6q pll3: 480MHz

mx6q pll8: 50MHz

ipg clock     : 66666666Hz

ipg per clock : 66666666Hz

uart clock    : 80000000Hz

cspi clock    : 60000000Hz

ahb clock     : 133333333Hz

axi clock   : 200000000Hz

emi_slow clock: 22222222Hz

ddr clock     : 400000000Hz

usdhc1 clock  : 200000000Hz

usdhc2 clock  : 200000000Hz

usdhc3 clock  : 200000000Hz

usdhc4 clock  : 200000000Hz

nfc clock     : 11000000Hz

Board: i.MX6DL/Solo-SABRESD: unknown-board Board: 0x61002 [POR ]

Boot Device: NAND

I2C:   ready

DRAM:  512 MB

NAND:  NAND device: Manufacturer ID: 0x2c, Chip ID: 0x44 (Micron NAND 4GiB 3,3V 8-bit)

Manufacturer      : Micron (0x2c)

Device Code       : 0x44

Cell Technology   : MLC

Chip Size         : 4 GiB

Pages per Block   : 256

Page Geometry     : 4096+224

ECC Strength      : 12 bits

ECC Size          : 512 B

Data Setup Time   : 15 ns

Data Hold Time    : 10 ns

Address Setup Time: 20 ns

GPMI Sample Delay : 6 ns

tREA              : 20 ns

tRLOH             : 5 ns

tRHOH             : 15 ns

Description       : MT29F32G08CBADAWP (4GB)

2048 MiB

MMC:   FSL_USDHC: 0,FSL_USDHC: 1

Using default environment

In:    serial

Out:   serial

Err:   serial

curr nand dev: 0

NAND read: device 0 offset 0x500000, size 0x1000

Skipping bad block 0x00500000

Skipping bad block 0x00600000

Skipping bad block 0x00700000

Skipping bad block 0x00800000

Skipping bad block 0x00900000

Skipping bad block 0x00a00000

Skipping bad block 0x00b00000

Skipping bad block 0x00c00000

Skipping bad block 0x00d00000

read failed @ offset 0xe00000 size 4096, ecc_stats.failed inc 8

NAND read from offset e00000 failed -74

0 bytes read: ERROR

Net:   got MAC address from IIM: 00:00:00:00:00:00

FEC0

Hit Ctrl-C to stop autoboot:  0

NAND read: device 0 offset 0x600000, size 0x300000

Skipping bad block 0x00600000

Skipping bad block 0x00700000

Skipping bad block 0x00800000

Skipping bad block 0x00900000

Skipping bad block 0x00a00000

Skipping bad block 0x00b00000

Skipping bad block 0x00c00000

Skipping bad block 0x00d00000

read failed @ offset 0xe00000 size 1048576, ecc_stats.failed inc 2042

NAND read from offset e00000 failed -74

0 bytes read: ERROR

Wrong Image Format for bootm command

ERROR: can't get kernel image!

MX6SDL SABRESD U-Boot >

After checking through the code, it seems like the cmd.nand.c uses lot's of 32 bits address space. There is even a FIXME in the source code stating that uboot cmd_nand does not support 64bit address space. 4GB is 33 bits address space. Could this be the issue?

I am using u-boot version 2009.08. NAND is MT29F32G08CBADAWP.

Is there any patch that i can apply for this u-boot version to fix the issue? Thanks.

Regards,

zc

0 Kudos
3,643 Views
JimMalone
Contributor III

Hi Shijie Huang,

Could you elaborate on how to use kobs-ng to burn u-boot to NAND?

It appears as thought kobs-ng does not copy the IVT out of the u-boot.bin and place it in the correct offset (for the i.mx6solo in my case) - (or I am totally missing it in the kobs-ng code which I have stepped through many times at this point).  Is it correct to assume that if the FCB is located at 0x0 in the NAND, that the IVT should go in at 0x400 in this same block?  I should mention that I am using a large flash (8K pages with 1MB erase blocks).

Any help would be much appreciated.

0 Kudos
3,643 Views
HuangShijie
Contributor III

sorry for the later reply.

our mail system did not forward your reply to me.

The kobs-ng treats the uboot or kernel as a file, it just copies the whole u-boot.bin to the nand. The kobs-ng even does know what it copy. The FCB is located at 0x0. the kobs-ng does not know the IVT.

Maybe you use the wrong u-boot.bin.

thanks

Huang Shijie

0 Kudos
3,645 Views
JimMalone
Contributor III

Hi Huang,

The issue I did not understand was that the IVT was positioned at a relative 0x400 offset in the sector containing u-boot.  The i.mx6 manuals do not make this clear and I was thinking the IVT had to be placed at an absolute address of 0x400 which would be in the same sector as the FCB.

I resolved my own confusion with trial and error.

Thanks

0 Kudos
3,645 Views
terry_lv
NXP Employee
NXP Employee

Pls use bootlets to program u-boot and uImage to nand.

3,645 Views
jkobs2014
Contributor III

If you could please post the "bootlets" program, and indicate why you think it is better than kobs-ng, that would be very helpful.

0 Kudos
3,645 Views
PradapRaj
Contributor III

We have used Toshiba's TC58NVG3S0FTA00 NAND with iMX6 and successfully booted...

3,645 Views
austinf
Contributor I

We're using Micron MT29F32G08CBACAWP successfully. Make sure you're using the latest source release though.

3,645 Views
srishan
Contributor III

Could you please let me know the latest release where you got MT29F32G08CBACAWP working is yocto version "L4.9.11_1.0.0" for i.mx6ull evk board??

Does yocto version "L4.9.11_1.0.0" have the support for MT29F32G08CBACAWP in u-boot and linux kernel??

0 Kudos
3,645 Views
dickginther
Contributor III

I am checking whether the latest release would support lower density (8Gb or 16Gb) SLC devices like the MT29F8G08ABACAWP?

0 Kudos
3,645 Views
HuangShijie
Contributor III

I think the latest version does support this SLC.

you can test it.

thanks.

Huang Shijie

0 Kudos
3,645 Views
JimMalone
Contributor III

Hi Austin, PradapRaj,

The i.mx6 documentation does not seem clear to me when booting from NAND flash regarding loading u-boot.  Did you have to use the SPL (secondary program loader) method that splits u-boot up into two images or a single u-boot method (standard method)?  I am reading mixed information and am a bit confused.

I think that if u-boot is small enough to run in the internal RAM (OCRAM) of the i.MX6 then it does not need the SPL step.  Is this correct thinking?

Thanks,

Jim

0 Kudos