This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Nand boot with AM3352

Other Parts Discussed in Thread: AM3352

Hi,

In our customized design with AM3352, we want to boot from nand. We used u-boot and kernel from sitara am335x sdk as a reference. Currently we are using mmc0 for booting.  When I build u-boot source, there are two images for first stage u-boot are created in bellow u-boot path,

./MLO

./spl/u-boot-spl.bin 

I am right now using MLO for mmc boot.

Should I use u-boot-spl.bin nand boot ? or is there any other option to build first stage u-boot for nand boot ?

Seeking quick response,

Shabbir Limdiwala

  • Hi Shabbir,

    Here is the U-Boot User's Guide / NAND boot section: http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide#NAND_2

    There isn't a specific option to build the SPL and U-Boot for NAND boot, just use the "make am335x_evm" command.

    The files you will need will be generated in the main U-Boot folder. The "MLO" file is the second stage bootloader (SPL) and the "u-boot.img" file is the U-Boot itself. Check the expected NAND layout from the link above for NAND boot.

    The ./spl/u-boot-spl.bin file is used for UART boot.

    Best regards,
    Miroslav

  • Hi,

    If I write MLO in nand's first partition then will it work ?

    Thanks,

    Shabbir Limdiwala

  • Check the expected NAND layout here: http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide#NAND_Layout

    You need 4 copies of the MLO at the beginning of the NAND flash.

    Best regards,
    Miroslav

  • Hi Miroslav,

    I am still not able to boot from NAND after flashing MLO, u-boot.img and uImage on their respective partition. I set SYSBOOT[4:0] = 10010b

    Which ecc scheme does RBL support ? And I didn't find nandecc on u-boot console. How to enable this command ?

    Note: on u-boot console i can able to read kernle image from nand and it is booting successfully.

    Shabbir Limdiwala

  • Hi,

    Also please share how to partition the NAND or NOR?

  • Hi,

    I use MT29F4G08ABADAWP nand.


    Shabbir Limdiwala

  • The previous question was for Miroslav Kiradzhiyski XID.  If you use any script for partitioning, kindly share link.

  • Shabbir,

    Please read this: http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide#NAND_ECC_algorithm_selection

    Starting with the 04.06.00.09-rc2 release only BCH8 is supported, and is used by default in all cases. No user interaction is required to select the algorithm and locations where the nandecc command are required can be seen by looking at the history of this page.

    There is no nandecc command any more as it isn't needed.

    Here is how you should flash your NAND:

    U-Boot# mmc rescan
    U-Boot# nand erase.chip
    U-Boot# fatload mmc 0 0x81000000 MLO
    U-Boot# cp.b 0x81000000 0x81020000 20000
    U-Boot# cp.b 0x81000000 0x81040000 20000
    U-Boot# cp.b 0x81000000 0x81060000 20000
    U-Boot# fatload mmc 0 0x81080000 u-boot.img
    U-Boot# fatload mmc 0 0x81280000 uImage
    U-Boot# nand write 0x81000000 0x0 0x400000
    U-Boot# saveenv

    Vinayak,

    NAND or NOR flashes are not partitioned from U-Boot. They are partitioned in linux. You need to modify the mtd_partition structures inside the board-am335xevm.c file:

    /* NAND partition information */
    static struct mtd_partition am335x_nand_partitions[] = {
    /* All the partition sizes are listed in terms of NAND block size */
        {
            .name           = "SPL",
            .offset         = 0,            /* Offset = 0x0 */
            .size           = SZ_128K,
        },
        {
            .name           = "SPL.backup1",
            .offset         = MTDPART_OFS_APPEND,    /* Offset = 0x20000 */
            .size           = SZ_128K,
        },
        {
            .name           = "SPL.backup2",
            .offset         = MTDPART_OFS_APPEND,    /* Offset = 0x40000 */
            .size           = SZ_128K,
        },
        {
            .name           = "SPL.backup3",
            .offset         = MTDPART_OFS_APPEND,    /* Offset = 0x60000 */
            .size           = SZ_128K,
        },
        {
            .name           = "U-Boot",
            .offset         = MTDPART_OFS_APPEND,   /* Offset = 0x80000 */
            .size           = 15 * SZ_128K,
        },
        {
            .name           = "U-Boot Env",
            .offset         = MTDPART_OFS_APPEND,   /* Offset = 0x260000 */
            .size           = 1 * SZ_128K,
        },
        {
            .name           = "Kernel",
            .offset         = MTDPART_OFS_APPEND,   /* Offset = 0x280000 */
            .size           = 40 * SZ_128K,
        },
        {
            .name           = "File System",
            .offset         = MTDPART_OFS_APPEND,   /* Offset = 0x780000 */
            .size           = MTDPART_SIZ_FULL,
        },
    };

    /* SPI 0/1 Platform Data */
    /* SPI flash information */
    static struct mtd_partition am335x_spi_partitions[] = {
        /* All the partition sizes are listed in terms of erase size */
        {
            .name       = "SPL",
            .offset     = 0,            /* Offset = 0x0 */
            .size       = SZ_128K,
        },
        {
            .name       = "U-Boot",
            .offset     = MTDPART_OFS_APPEND,    /* Offset = 0x20000 */
            .size       = (3 * SZ_128K) - SZ_4K,
        },
        {
            .name       = "U-Boot Env",
            .offset     = MTDPART_OFS_APPEND,    /* Offset = 0x7F000 */
            .size       = SZ_4K,
        },
        {
            .name       = "Kernel",
            .offset     = MTDPART_OFS_APPEND,    /* Offset = 0x80000 */
            .size       = 866 * SZ_4K,        /* size = 0x362000 */
        },
        {
            .name       = "File System",
            .offset     = MTDPART_OFS_APPEND,    /* Offset = 0x3E2000 */
            .size       = MTDPART_SIZ_FULL,        /* size ~= 4.1 MiB */
        }
    };

    Best regards,
    Miroslav

  • Hi Miroslav,

    I understand about the ecc scheme. I follow your commands to flash nand from mmc0 but still board is not able to boot from NAND.

    I followed the steps mention in the guide for nand flash though just to make sure, Can you provide steps for flashing the nand from UART or MMC0 ?

    Shabbir Limdwala

  • Shabbir, where does the boot process stop while trying to boot from NAND? Any messages?

    The steps to flash the NAND from MMC/SD are posted in my last post. Here are the steps to flash NAND from UART (this example uses the "picocom" terminal emulator):

    1. You need to first set your SYSBOOT switches for UART boot (1-5: 10000).
    2. After you build U-Boot save the MLO, u-boot.img and also the u-boot-spl.bin file from the <u-boot_dir>/spl/ folder. You will also need the kernel uImage file.
    3. Start picocom from the folder containing the UART boot images (board is OFF):
    # picocom -b 115200 /dev/ttyS0 --send-cmd "sx -vv"
    5. Press CTRL+A; CTRL+S; to send the u-boot-spl.bin file via UART and then start the board.
    6. After transfer is complete press CTRL+A; CTRL+S; to send the u-boot.img file.
    7. After transfer is complete interrupt the boot sequence to enter U-Boot mode.
    8. Flash the NAND:

    IMPORTANT: Depending on whether you're using kermit or ymodem mode use one of these two commands to load the image files to RAM:

    loadb - load binary file over serial line (kermit mode)
    loady - load binary file over serial line (ymodem mode)

    U-Boot# nand erase.chip
    U-Boot# loady 0x81000000
    - (when prompted press CTRL+A; CTRL+S; and send the MLO file via UART)
    U-Boot# cp.b 0x81000000 0x81020000 20000
    U-Boot# cp.b 0x81000000 0x81040000 20000
    U-Boot# cp.b 0x81000000 0x81060000 20000
    U-Boot# loady 0x81080000
    - (when prompted press CTRL+A; CTRL+S; and send the u-boot.img file via UART)
    U-Boot# loady 0x81280000
    - (when prompted press CTRL+A; CTRL+S; and send the uImage file via UART)
    U-Boot# nand write 0x81000000 0x0 0x400000
    U-Boot# saveenv

    Best regards,
    Miroslav

  • Hi Miroslav,

    SYSBOOT[4:0] is 10010b

    I have tried flashing NAND using above steps through UART boot in ymodem mode. But the result is same. still not able to boot from NAND.
    And as i mention in last post, It's also not boot when flashing NAND using mmc0.

    After flashing NAND, I kept the sysboot config 10010b since it has NAND as first boot mode. Bellow messages appears on console upon reset,

    "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"

     

    Shabbir Limdiwala

  • The CCCCCC characters mean that the ROM bootloader is trying to boot from UART. It has most probably tried to boot from the other devices of your SYSBOOT configuration, but failed.

    This looks like either a hardware issue, or a NAND part that is not supported for boot.

    You can take a look at the AM335x TRM, section 26.1.7.4 NAND, Table 26-14. Supported NAND Devices for supported NAND devices.

    Best regards,
    Miroslav

  • Hi Shabbir,

    Can you provide the following information:

    1. All SYSBOOT[15:0] settings
    2. NAND part number and datasheet
    3. NAND connection diagram
  • Miroslav,

    I checked in TRM, It is supported.

    Biser,

    1. sysboot[15:0] = 0x4012

    2. Part no. MT29F4G08ABADAWP and attaching the datasheet 0820.nand_datasheet.pdf

    3. Here is the nand connections, 

    Thanks,

    Shabbir Limdiwala

  • Hi Biser,

    I have already posted all detail you wanted. But it says, Moderator required to approve this post.

    So It would be better and appreciable if you try to make it quick to approve my post because we are running out of time and need quick help.

    Thanks in advance,

    Shabbir Limdiwala

  • Shabbir, this forum never requires moderator approval for community member posts. Can you make a screenshot of this message? Can you try posting again?

    Best regards,
    Miroslav

  • Miroslav,

    I checked in TRM. NAND is supported.

    Biser,

    1. SYSBOOT[15:0] = 0x4012

    2. Part no. is MT29F4G08ABADAWP and attaching the datasheet,

    7024.nand_datasheet.pdf

    3. Here is the nand connections,

    Thanks,

    Shabbir Limdiwala

  • Hi Miroslav,

    Here what it says when i post,

  • Miroslav,

    Now I tried to post the screenshot of the message which appears while i make the last post, but  it also says moderator approval requires. In short whenever i paste any snaps it says, require moderator approval.

    Can you please verify this behavior from your side. ?


    Shabbir Limdiwala

  • Do not paste them, attach them. Use the "Insert file" (paper clip) icon on the tool bar.

  • Miroslav,

    I checked in TRM. NAND is supported.

    Biser,

    1. SYSBOOT[15:0] = 0x4012

    2. Part no. MT29F4G08ABADAWP and attaching the datasheet,

    5355.nand_datasheet.pdf

    3. Attaching the connection diagram,

    Thanks,

    Shabbir Limdiwala

  • Hi Shabbir,

    1. SYSBOOT is OK.
    2. NAND part is ONFI compliant, should be supported by AM335X ROM code.
    3. Where is NAND_RB_B connected? It must be connected to GPMC_WAIT0 (AM335X pin T17 on ZCZ package). An external 4.7k pullup resistor must be present.

  • Hi Biser,

    Yes NAND_RB_B is connected to GPMC_WAIT0. I removed 1K pullup and mount 4.7K pullup but still didn't get success.

    Do you think this NAND is not supported by AM3352 ROM code ? According to the TRM of AM335x and datasheet of the NAND, This nand is ONFI compliant and supported by AM335x.

    Thanks,

    Shabbir Limdiwala

  • Do you see any activity on the GPMC bus after reset? Please check the WAIT signal too.

  • Hi Biser,

    I want to inform you that NAND interface is working in u-boot and kernel perfectly if I boot the system from some other media (SD/UART). I can able to read and write into NAND. The only issue is processor not able to boot from NAND.

    Thanks and Regards,

    Shabbir Limdiwala

  • Hi Shabbir,

    The only possible reason remaining is that MLO/u-boot image is either not correct or not programmed in the correct locations on NAND.

  • Hi Biser,

    If you have seen past posts in conversation with Miroslav, I have followed his steps to flash MLO/u-boot in NAND. These MLO/u-boot is same as used in SD boot.

    Thanks and regards,

    Shabbir Limdiwala

  • The NAND MLO binary image is NOT the same as the SD MLO image. The NAND MLO has a special 512 byte header in Front of it. (Or was it the other way round?)

    Read the documentation.

    Regards

    Wolfgang

  • Wolfgang, both the SD/MMC and the NAND MLO binaries have a special GP image header, which contains information on image size and destination address as these are non-XIP devices. This header contains no information about the boot device.

    Both the SD/MMC and the NAND MLO binaries are generated in the exact same way, using the make am335x_evm target.

    For XIP devices, like NOR flash, there is a different target (make am335x_evm_norboot) and the MLO binary doesn't need to contain a GP header, just the code for direct execution.

    All this can be found in sections 26.1.9 and 26.1.10 of the AM335x TRM.

    Best regards,
    Miroslav

  • Hi Biser,

    One more important thing i want to inform you, Ethernet PHY is connected to port 2 of the ethernet mac and switch (cpsw). According to the silicon errata this may create problem when booting from NAND as GPMC_WAIT0 signal is multiplexed with GMII2_CRS.

    So, just to make sure nand boot is working, I have disabled all the configuration of PHY and flash nand from u-boot. Still it is not working.

    I am surprised with behavior, any idea still what causing the problem ?

    Thanks,

    Shabbir Limdiwala

  • This is very important indeed. What you should do is physically disconnect the  GMII2_CRS line from WAIT0. Disabling in U-boot makes no sense as you cannot reach this stage when you try to boot from NAND.

  • Hi Biser,

    Good news. It can able to boot from NAND. I have physically disconnected GMII2_CRS line from GPMC_WAIT0 and it's working.

    Thanks Biser and Miroslav for your continuous support. Really appreciable.

    Shabbir Limdiwala

  • Miroslaw,

    you wrote:

    "Both the SD/MMC and the NAND MLO binaries are generated in the exact same way, using the make am335x_evm target."

    But for booting from SD card (FAT-Formatted), there is an extra 512 Byte CHANGESETTINGS header in front of the GP header.  I can not boot from SD without this header.

    regards

    Wolfgang

  • Wolfgang, this is correct. The CHSETTINGS header is needed for MMC/SD card booting (FAT), but it doesn't affect NAND flash booting. The am335x_evm make target is used for generating the images for both NAND boot and MMC/SD boot. There is no separate make target for the NAND boot mode.

    I guess the NAND booting isn't affected because the ROM Code reads data from NAND devices in 512 bytes sectors and the GP header is located at offset 0x200 in the MLO file.

    Best regards,
    Miroslav

  • Hi,

    I am also facing the same issue. while UART/SD my nand is booting. By default my NAND is not booting. 

    Always GPMC_WAIT0 is showing as high using CRO. I am using Ethernet and using Port1.

    I am using 8 bit NAND, SDK6. How can i resolve my issue.

    Thanks,