Project

General

Profile

Flashing NAND from SD Card

Added by Raja Vankam almost 12 years ago

Hi,

1. I have tried flashing NAND through SD boot. I have followed the steps mentioned in AM335x u-boot users guide.

Files used are by default provided with the MityArm SD card.

Steps followed are:
U-Boot# mmc rescan
U-Boot# mw.b 0x82000000 0xFF 0x20000
U-Boot# fatload mmc 0 0x82000000 MLO
U-Boot# nandecc hw 2
U-Boot# nand erase 0x0 0x20000
U-Boot# nand write.i 0x82000000 0x0 0x20000

U-Boot# mmc rescan
U-Boot# mw.b 0x82000000 0xFF 0x40000
U-Boot# fatload mmc 0 0x82000000 u-boot.img
U-Boot# nandecc hw 2
U-Boot# nand erase 0x80000 0x40000
U-Boot# nand write.i 0x82000000 0x80000 0x40000

U-Boot# mmc rescan
U-Boot# fatload mmc 0 0x81000000 uEnv.txt
U-Boot# env import -t 0x81000000 $filesize
U-Boot# saveenv
U-Boot# boot

After that i have chaged the boot option to NAND by changing Sysboot setting as 10011.

Booting from NAND stops after that. terminal log in mentioned below for your reference.

U-Boot SPL 2011.09-00000-g23e81b9-dirty (Feb 24 2012 - 11:15:23)
Texas Instruments Revision detection unimplemented
PLL configuration complete
nand_spl_load_image: loading 2048 bytes from 0x00040000 to 0x80800000
mkimage signature not found - ih_magic = ffffffff
Assuming u-boot.bin ..
nand_spl_load_image: loading 204800 bytes from 0x00040000 to 0x80800000

2. Later tried to flash using UART.

Procedure: as mentioned in TI website, transfered u-boot.spl.bin, u-boot.img through Xmoded transfer.
To get the u-boot.spl.bin, i had to rebuilt the bootloader as it is not available in SD card. Procedure to build boot loader is referred from 'Das U-Boot Port - Critical Link Support' page.

IS there anything wrong in procedure followed? I am not sure to post on TI support or here.

Regards,
Raja.

But after


Replies (18)

RE: Flashing NAND from SD Card - Added by Tim Iskander almost 12 years ago

Raja
The uboot spl (MLO) loads from nand at 0x00040000...
nand_spl_load_image: loading 2048 bytes from 0x00040000 to 0x80800000
you wrote the image of u-boot to flash at 0x00080000
U-Boot# nand erase 0x80000 0x40000
U-Boot# nand write.i 0x82000000 0x80000 0x40000

redo your nand write with 0x40000
U-Boot# nand erase 0x40000 0x40000
U-Boot# nand write.i 0x82000000 0x40000 0x40000

I will double-check the wiki tomorrow
cheers
/Tim

RE: Flashing NAND from SD Card - Added by Raja Vankam almost 12 years ago

Hi Tim,

I have followed your instructions and flashed NAND with MLO at 0x20000 and u-boot.img at 0x40000. but the booting stops during NAND boot. Ihave updated the log for your reference. Could you please check on this what could be wrong.

steps followed are:

1. Booted from SD card and stopped at u-boot prompt.
U-Boot SPL 2011.09-00000-g23e81b9-dirty (Feb 24 2012 - 11:15:23)
Texas Instruments Revision detection unimplemented
PLL configuration complete
OMAP SD/MMC: 0
reading u-boot.img
reading u-boot.img

U-Boot 2011.09-00000-g23e81b9-dirty (Feb 24 2012 - 11:15:23)

I2C: ready
DRAM: 256 MiB
WARNING: Caches not enabled
NAND: HW ECC Hamming Code selected
256 MiB
MMC: OMAP SD/MMC: 0
Error: Bad compare! failed
Error: Bad compare! failed
Error: Bad compare! failed
Error: Bad compare! failed
NAND read from offset 80000 failed -74
  • Warning - readenv() failed, using default environment

Net: cpsw
Hit any key to stop autoboot: 0

2. Flashing MLO

U-Boot# mmc rescan
U-Boot# mw.b 0x82000000 0xFF 0x20000
U-Boot# fatload mmc 0 0x82000000 MLO
reading MLO

38592 bytes read
U-Boot# nandecc hw 2
HW ECC BCH8 Selected
U-Boot# nand erase 0x0 0x20000

NAND erase: device 0 offset 0x0, size 0x20000
Erasing at 0x0 -- 100% complete.
OK
U-Boot# nand write.i 0x82000000 0x0 0x20000

NAND write: device 0 offset 0x0, size 0x20000
131072 bytes written: OK

3. Flashing u-boot.img

U-Boot# mmc rescan
U-Boot# mw.b 0x82000000 0xFF 0x40000
U-Boot# fatload mmc 0 0x82000000 u-boot.img
reading u-boot.img

373252 bytes read
U-Boot# nandecc hw 2
HW ECC BCH8 Selected
U-Boot# nand erase 0x40000 0x40000

NAND erase: device 0 offset 0x40000, size 0x40000
Erasing at 0x60000 -- 100% complete.
OK
U-Boot# nand write.i 0x82000000 0x40000 0x40000

NAND write: device 0 offset 0x40000, size 0x40000
262144 bytes written: OK
U-Boot# mmc rescan
U-Boot# fatload mmc 0 0x81000000 uEnv.txt
reading uEnv.txt

1711 bytes read
U-Boot# env import t 0x81000000 $filesize
U-Boot# saveenv
Saving Environment to NAND...
Erasing Nand...
Erasing at 0x80000 -
100% complete.
Writing to Nand... done
U-Boot# boot

4. Then i have changed the boot mode to NAND 10011.
Booting stops after below messages. Do i have to set uEnv separately than which is present in SD card.

U-Boot SPL 2011.09-00000-g23e81b9-dirty (Feb 24 2012 - 11:15:23)
Texas Instruments Revision detection unimplemented
PLL configuration complete
nand_spl_load_image: loading 2048 bytes from 0x00040000 to 0x80800000
nand_spl_load_image: loading 373252 bytes from 0x00040000 to 0x807fffc0

RE: Flashing NAND from SD Card - Added by Tim Iskander almost 12 years ago

Raja
Your uboot image is 373252 bytes long
you are only erasing/writing 0x40000, which is 262144 (256k)
try erasing 0x80000 and use the command
U-Boot# nand write.i 0x82000000 0x40000 ${filesize}
to write it.

cheers
/Tim

RE: Flashing NAND from SD Card - Added by Raja Vankam almost 12 years ago

Hi Tim,

I have flashed as mentioned above.
But even now u-boot prompt is not appearing after booting from NAND.
Log is mentioned below.

U-Boot SPL 2011.09-00000-g23e81b9-dirty (Feb 24 2012 - 11:15:23)
Texas Instruments Revision detection unimplemented
PLL configuration complete
nand_spl_load_image: loading 2048 bytes from 0x00040000 to 0x80800000
nand_spl_load_image: loading 373252 bytes from 0x00040000 to 0x807fffc0

What could be wrong in the process?

Alternatively I have tried updating from UART. Changed the sysboot to UART boot mode. Waited for CCCC to appear and Trasnfered the u-boot.spl.bin file through Xmodem (1k) mode. and then u-boot.img. Even through this procedure also couldnot boot.

Feeling that some is wrong..

Regards,
Raja.

RE: Flashing NAND from SD Card - Added by Raja Vankam almost 12 years ago

Hi Tim,

Do we have any answer on this.

I found one thing interesting from booting sequence of the board.
Below are the details on partitioning of NAND. Do we have to follow these adresses while flashing NAND? If so memory 0x260000 to 0x280000 may not be sufficient. Correct me if i am wrong.

Creating 8 MTD partitions on "omap2-nand.0":
[ 1.088561] 0x000000000000-0x000000020000 : "SPL"
[ 1.094898] 0x000000020000-0x000000040000 : "SPL.backup1"
[ 1.101882] 0x000000040000-0x000000060000 : "SPL.backup2"
[ 1.108745] 0x000000060000-0x000000080000 : "SPL.backup3"
[ 1.115648] 0x000000080000-0x000000260000 : "U-Boot"
[ 1.122751] 0x000000260000-0x000000280000 : "U-Boot Env"
[ 1.129479] 0x000000280000-0x000000780000 : "Kernel"
[ 1.137978] 0x000000780000-0x000010000000 : "File System"

Regards,
Raja.

RE: Flashing NAND from SD Card - Added by Raja Vankam almost 12 years ago

Hi,

I could load bootloader to NAND and my boot log is as below. Flashed MLO at 0x0 and u-boot.img at 0x40000. u-boot image size is more than 256KB which will be written beyond the address 0x80000.

which address to write environment files and kernel uImage. Below log gives an impression that environment variables are missing.

Please let me know how to update env, uImage and rootfs to the NAND from SDcard. I want to keep UART booting method as a backup for my board incase SD card fails.

I appreciate your response. If needed we can have a call to resolve this.

U-Boot SPL 2011.09-00000-g23e81b9-dirty (Feb 24 2012 - 11:15:23)
Texas Instruments Revision detection unimplemented
PLL configuration complete
nand_spl_load_image: loading 2048 bytes from 0x00040000 to 0x80800000
nand_spl_load_image: loading 373252 bytes from 0x00040000 to 0x807fffc0

U-Boot 2011.09-00000-g23e81b9-dirty (Feb 24 2012 - 11:15:23)

I2C: ready
DRAM: 256 MiB
WARNING: Caches not enabled
NAND: HW ECC Hamming Code selected
256 MiB
MMC: OMAP SD/MMC: 0
Error: Bad compare! failed
Error: Bad compare! failed
Error: Bad compare! failed
Error: Bad compare! failed
Error: Bad compare! failed
Error: Bad compare! failed
Error: Bad compare! failed
NAND read from offset 80000 failed -74
*** Warning - readenv() failed, using default environment*

Net: cpsw
Hit any key to stop autoboot: 0
Card did not respond to voltage select!
Booting from nand ...
HW ECC BCH8 Selected

NAND read: device 0 offset 0x20000, size 0x500000
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable.
ECC: uncorrectable

Regards,
Raja.

RE: Flashing NAND from SD Card - Added by Tim Iskander almost 12 years ago

Raja
The MTD partitions set up in the kernel are also the positions uboot expects
things to be in
Creating 8 MTD partitions on "omap2-nand.0":
[ 1.088561] 0x000000000000-0x000000020000 : "SPL"
[ 1.094898] 0x000000020000-0x000000040000 : "SPL.backup1"
[ 1.101882] 0x000000040000-0x000000060000 : "SPL.backup2"
[ 1.108745] 0x000000060000-0x000000080000 : "SPL.backup3"
[ 1.115648] 0x000000080000-0x000000260000 : "U-Boot"
[ 1.122751] 0x000000260000-0x000000280000 : "U-Boot Env"
[ 1.129479] 0x000000280000-0x000000780000 : "Kernel"
[ 1.137978] 0x000000780000-0x000010000000 : "File System"

so
o SPL (MLO) needs to go at 0 (we put copies at 20000,40000, and 60000 so help prevent bricking the board if flash sectors go bad).
o U-Boot needs to go at 80000
o The U-Boot environment goes at 260000
o The Kernel goes at 280000

The SPL loads the u-boot image from the same device it was loaded from (i.e. you can not boot from SD but load u-boot from flash).

hope that helps
/Tim

RE: Flashing NAND from SD Card - Added by Raja Vankam almost 12 years ago

Hi Tim,

I have programmed as per the address mentioned above.

But during booting MLO always looks for u-boot at 0x40000 and environment variables at 0x80000. As the bootloader size is more than 256K it goes beyond the location 0x80000 and writing environment variables at 0x80000 makes u-boot also not to boot. Refer my earlier boot log. I have mentioned below the lines on addresses for your reference.
"nand_spl_load_image: loading 2048 bytes from 0x00040000 to 0x80800000
nand_spl_load_image: loading 373252 bytes from 0x00040000 to 0x807fffc0

NAND read from offset 80000 failed -74*** Warning - readenv() failed, using default environment*

NAND read: device 0 offset 0x20000, size 0x500000
ECC: uncorrectable."

I checked in the bootloader and the nand Boot config defined in mityarm335x.h is different from the kernel partitions shown above. Am i using the correct boot loader?

Could you please check out the details and help me in flashing the NAND.
Please let me know how to go about the addresses and flashing. Giving detailed procedure would be of great help.

Appreciate your response.

Thanks,
Raja.

RE: Flashing NAND from SD Card - Added by Raja Vankam almost 12 years ago

Hi,

Do we have any answer on this.

Thanks,
Raja.

RE: Flashing NAND from SD Card - Added by Tim Iskander almost 12 years ago

Raja
I am looking in to this... I am suspecting that the u-boot MLO was not configured correctly for the nand flash partitioning scheme.
cheers
/Tim

RE: Flashing NAND from SD Card - Added by Raja Vankam almost 12 years ago

Hi Tim,

Thanks. I will wait for your response.

Regards,
Raja.

RE: Flashing NAND from SD Card - Added by Raja Vankam almost 12 years ago

Hi,

Do we have any update on the u-boot MLO?

Appreciate your response.

Thanks
Raja.

RE: Flashing NAND from SD Card - Added by Tim Iskander almost 12 years ago

Raja
Definitely a bug in the NAND layout in u-boot. I just need to test the fixes.
I wanted to get back to you before too long, but I hope to be able to release a new image today.
cheers
/Tim

RE: Flashing NAND from SD Card - Added by Raja Vankam almost 12 years ago

Hi Tim,

Thanks for your reply.

Also I am planning to flash the file system to NAND. What would be the image format to write the file system? is it UBIFS?

Do you got any procedure to create and flash the same and the image file.

Request your response at the earliest.

Thanks,
Raja.

RE: Flashing NAND from SD Card - Added by Tim Iskander almost 12 years ago

Raja
On our L138 based SOM, we used the JFFS2 filesystem for flash based filesystem. We have not gone down the flash filesystem
path on the MityARM-3359 yet, as the dev kit boots from the SD card. There is support for both JFFS2 and UBIFS, but we have
only done a cursory investigation into using them on the 3359 so far.

cheers
/Tim

RE: Flashing NAND from SD Card - Added by Kjell Erickson over 11 years ago

Tim, we are also interested in utilizing the ubifs support on the 335x series and wonder if there has been any progress on CL's part in implementation?

Thanks,

Kjell

RE: Flashing NAND from SD Card - Added by Bindu Jagannatha about 10 years ago

Hello,

Has there been any progress on this? I followed the instructions on this page: https://support.criticallink.com/redmine/projects/armc8-platforms/wiki/UBIFS_Nand_Boot and flashed NAND from Linux. Then I set the appropriate config pins and the boot sequence gets stuck as shown below.

U-Boot SPL 2013.01.01 (Jul 23 2013 - 09:59:03)
MityARM335x profile 1 - Model No: 3354-GX-X38-RC Serial No: 133869
Configuring for 512 MB DDR3 @ 303MHz
som.c:470 config_am335x_ddr3 RAM size = 536870912
ECC Mode = 2 lo = 56/0
nand_spl_load_image: loading 2048 bytes from 80000 to 80800000
skipping bad block 4...
skipping bad block 5...
nand_spl_load_image: loading 204800 bytes from 80000 to 80800000
skipping bad block 4...
skipping bad block 5...

I think it is related to the first post on this thread, so I am reviving this thread. Please help!

RE: Flashing NAND from SD Card - Added by Jonathan Cormier about 10 years ago

Hi Bindu,

A lot has changed since this post was made. I've created you a separate thread that references this one so we can try to work out what may be wrong.

https://support.criticallink.com/redmine/boards/28/topics/3604

    (1-18/18)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)