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.

Writing Uboot to NAND _from Uboot_.

Guru 10685 points

Hi, I wish to flash my Uboot image to NAND using Uboot itself, so that I can then boot into it. This will save me from faffing around with the NAND flasher that TI recommends in the EZSDK documentation. Working with the supplied Uboot I've tried running the following in Uboot but to no avail:

mmc init
fatload mmc 1 0x80009000 u-boot.noxip.bin
nand erase 02000000 2BBCC
nand write.i 0x80009000 02000000 2BBCC

The NAND offset address of 02000000 is basically a guess as I have no idea where the board actually boots from and there is nothing in the documentation either. Any ideas where the board boots from when you have the NAND addresses set?

Thanks,
Ralph

 

  • Ralph,

    We do support flash a u-boot image to NAND when booting out of SD card.

    1. copy the u-boot image u-boot.noxip.bin into the FAT partition on your SD card.

    2. Wait the second stages of SD boot comes up and perform the following command:

    TI8168_EVM# mmc init
    TI8168_EVM# fatload mmc 1 0x81000000 u-boot.noxip.bin
    TI8168_EVM# nandecc hw 2
    TI8168_EVM# nand erase 0x0 0x1c0000
    TI8168_EVM# nand write.i 0x81000000 0x0 0x1c0000
    TI8168_EVM# nandecc hw 0
    
    After done, please set the EVM switch SW3  to NAND boot mode(SW3 [4:0]=10010) if boot out of NAND is required.
    Regards,
    yihe
  • Hi Yihe,

    I tried what you said and it doesn't boot up at all; nothing is displayed in the terminal. The exact text of what happened is below:

    Environment size: 753/8188 bytes
    TI8168_EVM#mmc init
    mmc1 is available
    TI8168_EVM#fatload mmc 1 0x81000000 u-boot.noxip.bin
    reading u-boot.noxip.bin

    179148 bytes read
    TI8168_EVM#nandecc hw 2
    HW ECC BCH8 Selected
    TI8168_EVM#nand erase 0x0 0x1c0000

    NAND erase: device 0 offset 0x0, size 0x1c0000
    Skipping bad block at  0x00000000
    Skipping bad block at  0x00020000
    Skipping bad block at  0x00040000
    Skipping bad block at  0x00060000
    Skipping bad block at  0x00080000
    Skipping bad block at  0x000a0000
    Skipping bad block at  0x000c0000
    Skipping bad block at  0x000e0000
    Erasing at 0x1a0000 -- 100% complete.
    OK
    TI8168_EVM#nand write.i 0x81000000 0x0 0x1c0000

    NAND write: device 0 offset 0x0, size 0x1c0000
    Skip bad block 0x00000000
    Skip bad block 0x00020000
    Skip bad block 0x00040000
    Skip bad block 0x00060000
    Skip bad block 0x00080000
    Skip bad block 0x000a0000
    Skip bad block 0x000c0000
    Skip bad block 0x000e0000
     1835008 bytes written: OK
    TI8168_EVM#nandecc hw 0
    HW ECC Hamming Code selected
    TI8168_EVM#saveenv
    Saving Environment to NAND...
    Erasing Nand...
    Warning: Erase size 0x00002000 smaller than one erase block 0x00020000
             Erasing 0x00020000 instead
    Erasing at 0x260000 -- 100% complete.
    Writing to Nand... done

    I don't know if it matters, but when I reset the board _without_ setting the switches for NAND boot, u-boot tells me:

    *** Warning - bad CRC or NAND, using default environment

    and then continues with the SD card boot which I have working fine.

    Regards,
    Ralph

  • Ralph,

    After programing the NAND flash, it is normal to see the following message.

    *** Warning - bad CRC or NAND, using default environment

    I did not see anything wrong in your steps. What do you expect to see any flashing the NAND.

    If you do not want to boot from SD, take the SD out of SLOT and either program uImage to NAND of setup a NSF server to boot.

    Regards 

    yihe

  • Hello,

    I have followed your steps which flashes Uboot to NAND. By setting the switches on SW4 [BTM4:BTM0] to [10010] I expect that when I turn the board on it will boot from NAND. i.e. it will run the Uboot from NAND which will output something on the terminal.

    However, I get no output at all on the terminal which suggests to me that Uboot is not running, and that the board is not correctly booting from NAND. My NAND switch is set to 1 and my NOR to 0 yet it doesn't boot. I don't care about the kernel yet, I just want Uboot to run from NAND! (Side note: I have the kernel loading from TFTP.) It doesn't matter whether the SD card is in the slot or not; what matters is the state of the switches that determines where Uboot is booted from. So do you have any idea why Uboot is not being run from NAND?

    Thanks,

    Ralph

  • Ralph,

    Just want to confirm that: After programming the NAND from SD boot, you did not see anything output at UART when switching the boot mode to NAND, 

    I did the same steps over my EVM and everything is fine, please see the log below. Could you try another NAND flash since I saw some bad sectors in your log?  Did you have Code Composer Studio and JTAG, if so, could you try program NAND from there?

    Regards,

    yihe

    TI8168_EVM#mmc init
    mmc1 is available
    TI8168_EVM#fatload mmc 1 0x81000000 u-boot.noxip.bin
    reading u-boot.noxip.bin

    179264 bytes read
    TI8168_EVM#nandecc hw 2
    HW ECC BCH8 Selected
    TI8168_EVM#nand erase 0x0 0x1c0000

    NAND erase: device 0 offset 0x0, size 0x1c0000
    Erasing at 0x1a0000 -- 100% complete.
    OK
    TI8168_EVM#nand write.i 0x81000000 0x0 0x1c0000

    NAND write: device 0 offset 0x0, size 0x1c0000
     1835008 bytes written: OK
    TI8168_EVM#nandeec hw 0
    Unknown command 'nandeec' - try 'help'
    TI8168_EVM#
    Unknown' - try 'help'
    TI8168_EVM#
    TI8168_EVM#
    TI8168_EVM#
    TI8168_EVM#nandecc hw 0
    HW ECC Hamming Code selected
    TI8168_EVM#saveenv
    Saving Environment to NAND...
    Erasing Nand...
    Warning: Erase size 0x00002000 smaller than one erase block 0x00020000
             Erasing 0x00020000 instead
    Erasing at 0x260000 -- 100% complete.
    Writing to Nand... done
    TI8168_EVM#

    U-Boot 2010.06 (Mar 03 2011 - 01:04:13)

    TI8168-GP rev 1.1

    ARM clk: 987MHz
    DDR clk: 398MHz

    I2C:   ready
    DRAM:  2 GiB
    NAND:  HW ECC Hamming Code selected
    256 MiB
    :,;;:;:;;;;;;;;r;;:,;;:;:;;;;;;;;:,;;:;:;;;;;;;;:,;;:;:;;;;;;;;:;;;;;;;;:,;;:;:
    ;,;:::;;;;r;;;rssiSiS552X5252525259GX2X9hX9X9XX2325S55252i5:,;;:;:;;;;;;;;:,;;:
    ;:;;;;;;;rrssSsS52S22h52299GGAAMHMM#BBH#B#HMM#HMBA&&XX2255S2S5Si:,;;:;:;;;;;;;;
    ;:;;r;;rsrrriiXS5S329&A&MH#BMB#A&9XXA252GXiSXX39AAMMMBB&G22S5i2SSiiiisi:,;;:;:;
    ;;;;;r;rr2iisiih393HB#B#AA99i22irrrX3X52AGsisss2Xii2299HBMA&X2S5S5iSiisSsi:,;;:
    r:r;rrsrsihXSi2&##MHB&Ahh3AGHGA9G9h&#H##@@@##MAMMXXX9SSS29&&HGGX2i5iisiiisisi:,
    ;;rrrrsSiiiA&ABH&A9GAGhAhBAMHA9HM@@@@@@@@@@@@@@@@@@@HHhAh2S2SX9&Gh22SSiisiiisii
    r:rrssisiS2XM##&h3AGAX&3GG3Ssr5H@M#HM2; ;2X&&&MHMB###GBB#B&XXSSs529XX55iSsisisi
    r;rsrisSi2XHAhX99A3XXG&&XS;:,rH#HGhAS   @@@@3rs2XBM@@A552&&AHA2XiisSS252SSsisSs
    r;issi5S22&&3iSSX292&hXsr;;:;h@&G339&S9@@@@2@MA&9&HB##Xris29ABMAAX2ir;rsSi5iss5
    rrsSi2XhG&9GXh399&X99i;;;;;;r#H&293H9X#@@@@@@@B&9GhAH@XrrsrsiXABHB&HG2rr;rrSiSi
    ;:rsisS599&AA9XG&3A35r;:::;,;BMh&&2iX5A@@@@@@@&392X5GB2;;;r;iSX393A##A&Xi:::rsi
    ;:rss552222X553&XHMhir;;::,:,h#HhGSXhG3#@@@@#AXXS2XAHA;::;;;;ss55XShBA3239r:,;;
    r;ii2S5SSi2i53hirsh2srr::,,,,;MMXX359&Ah3h&Si59SX99A#i:,::::;;sri2,.2r;:SGAr;,:
    ;:;rrrrssiriXGSi::shs;;;,,,:,,rBBA9h5s5h5iS5isi2SAHB5:,,,:::;rrs5&SrisSX5Srrr:,
    ;,r;;;;rsriSSrrrr;;5Xrr;;,:,,.,;9AA2SsisS5323XXXG9&i:.,,::;;r;;;srrrrrr;;:;::::
    :,;r;r;rrissrrr;:;::;s;;;;,:,,..,r293h222hXXAAGGGX;:,,,:,:,::;:;::,:,,,,...,,,,
    ;,;;;;rrrrrrrrirr;,.,,:::::::,,,,.,;SX&ABAB2hhXir:,,.,,.,,:,,,,..,,,..,..,,,..:
    :.:;:;;;:;;;;r;rrs;:.. ,,:::::,:,:,,.::rrsrr;;,,.......,..,....,,,,,,,...,.,,:,
    :.:::,::::::;;r;rrr;:.......,.,.,,:::,,...............,,::.,,,,:,::,,:,:,,,:,;:
    ,.::,:,,,,,;;;;;;;;r;;::,..............................;;;:;::::,:::::::,:,:,,,
    : ,,:,,,,,,,,,,,,,:;rrr;;:;,,,,,,,::,.,.:.,.,;s,:;;;;:;:;;;;;::::,:::,:::,:,:,:
    ,.,,,,,,,...,,.,,....................................:,............:,,,:,:,,,,,

    Net:   Detected MACID:7c:8e:e4:f9:f2:60
    Ethernet PHY: GENERIC @ 0x01
    DaVinci EMAC
    Hit any key to stop autoboot:  0
    No MMC card found
    Please set bootargs and bootcmd before booting the kernel
    If that has already been done please ignore this message
    TI8168_EVM#

  • Hello Yihe,

    that is correct. I've just repeated your commands exactly as you write them and the only differences in my output are the number of bytes read when it loads u-boot.noxip.bin from SD card (my u-boot.noxip.bin is 179148 bytes as with the current public EZSDK) and the part where you run "nand erase" and I get lots of "Skipping bad block at" messages but you don't.

    Just to be clear, after I've entered the last "saveenv" command I leave the board powered on, change the position of SW4 BTM0 and BTM2 so they are both off (BTM4->BTM0 = 10010), and press the reset button. I then get absolutely no output at all. Perhaps you could try using the public EZSDK uboot file? Or maybe my board is broken? What do you think?

    Thanks,
    Ralph

     

    P.S.

    Sorry about the strange formatting. The forum server has changed my original text and I can't do anything about it.

  • Ralph,

    I tried the u-boot.noxip.bin from the public EZSDK and did not see problems, please see the log below. Could you try change NAND flash chip? I attacahed the u-boot.noxip.bin in the case you need it. Are you sure that you set the SW3(bootmode) in the right NAND boot mode. Could you double check?

    Regards,

    yihe

     

    TI8168_EVM#mmc init
    mmc1 is available
    TI8168_EVM#fatload mmc 1 0x81000000 u-boot.noxip.bin
    reading u-boot.noxip.bin

    179148 bytes read
    TI8168_EVM#nandecc hw 2
    HW ECC BCH8 Selected
    TI8168_EVM#nand erase 0x0 0x1c0000

    NAND erase: device 0 offset 0x0, size 0x1c0000
    Erasing at 0x1a0000 -- 100% complete.
    OK
    TI8168_EVM#nand write.i 0x81000000 0x0 0x1c0000

    NAND write: device 0 offset 0x0, size 0x1c0000
     1835008 bytes written: OK
    TI8168_EVM#nandecc hw 0
    HW ECC Hamming Code selected
    TI8168_EVM#savenv
    Unknown command 'savenv' - try 'help'
    TI8168_EVM#saveenv
    Saving Environment to NAND...
    Erasing Nand...
    Warning: Erase size 0x00002000 smaller than one erase block 0x00020000
             Erasing 0x00020000 instead
    Erasing at 0x260000 -- 100% complete.
    Writing to Nand... done
    TI8168_EVM#

    U-Boot 2010.06 (Oct 28 2010 - 22:40:09)

    TI8168-GP rev 1.0

    ARM clk: 987MHz
    DDR clk: 398MHz

    I2C:   ready
    DRAM:  2 GiB
    NAND:  256 MiB
    *** Warning - bad CRC or NAND, using default environment

    :,;;:;:;;;;;;;;r;;:,;;:;:;;;;;;;;:,;;:;:;;;;;;;;:,;;:;:;;;;;;;;:;;;;;;;;:,;;:;:
    ;,;:::;;;;r;;;rssiSiS552X5252525259GX2X9hX9X9XX2325S55252i5:,;;:;:;;;;;;;;:,;;:
    ;:;;;;;;;rrssSsS52S22h52299GGAAMHMM#BBH#B#HMM#HMBA&&XX2255S2S5Si:,;;:;:;;;;;;;;
    ;:;;r;;rsrrriiXS5S329&A&MH#BMB#A&9XXA252GXiSXX39AAMMMBB&G22S5i2SSiiiisi:,;;:;:;
    ;;;;;r;rr2iisiih393HB#B#AA99i22irrrX3X52AGsisss2Xii2299HBMA&X2S5S5iSiisSsi:,;;:
    r:r;rrsrsihXSi2&##MHB&Ahh3AGHGA9G9h&#H##@@@##MAMMXXX9SSS29&&HGGX2i5iisiiisisi:,
    ;;rrrrsSiiiA&ABH&A9GAGhAhBAMHA9HM@@@@@@@@@@@@@@@@@@@HHhAh2S2SX9&Gh22SSiisiiisii
    r:rrssisiS2XM##&h3AGAX&3GG3Ssr5H@M#HM2; ;2X&&&MHMB###GBB#B&XXSSs529XX55iSsisisi
    r;rsrisSi2XHAhX99A3XXG&&XS;:,rH#HGhAS   @@@@3rs2XBM@@A552&&AHA2XiisSS252SSsisSs
    r;issi5S22&&3iSSX292&hXsr;;:;h@&G339&S9@@@@2@MA&9&HB##Xris29ABMAAX2ir;rsSi5iss5
    rrsSi2XhG&9GXh399&X99i;;;;;;r#H&293H9X#@@@@@@@B&9GhAH@XrrsrsiXABHB&HG2rr;rrSiSi
    ;:rsisS599&AA9XG&3A35r;:::;,;BMh&&2iX5A@@@@@@@&392X5GB2;;;r;iSX393A##A&Xi:::rsi
    ;:rss552222X553&XHMhir;;::,:,h#HhGSXhG3#@@@@#AXXS2XAHA;::;;;;ss55XShBA3239r:,;;
    r;ii2S5SSi2i53hirsh2srr::,,,,;MMXX359&Ah3h&Si59SX99A#i:,::::;;sri2,.2r;:SGAr;,:
    ;:;rrrrssiriXGSi::shs;;;,,,:,,rBBA9h5s5h5iS5isi2SAHB5:,,,:::;rrs5&SrisSX5Srrr:,
    ;,r;;;;rsriSSrrrr;;5Xrr;;,:,,.,;9AA2SsisS5323XXXG9&i:.,,::;;r;;;srrrrrr;;:;::::
    :,;r;r;rrissrrr;:;::;s;;;;,:,,..,r293h222hXXAAGGGX;:,,,:,:,::;:;::,:,,,,...,,,,
    ;,;;;;rrrrrrrrirr;,.,,:::::::,,,,.,;SX&ABAB2hhXir:,,.,,.,,:,,,,..,,,..,..,,,..:
    :.:;:;;;:;;;;r;rrs;:.. ,,:::::,:,:,,.::rrsrr;;,,.......,..,....,,,,,,,...,.,,:,
    :.:::,::::::;;r;rrr;:.......,.,.,,:::,,...............,,::.,,,,:,::,,:,:,,,:,;:
    ,.::,:,,,,,;;;;;;;;r;;::,..............................;;;:;::::,:::::::,:,:,,,
    : ,,:,,,,,,,,,,,,,:;rrr;;:;,,,,,,,::,.,.:.,.,;s,:;;;;:;:;;;;;::::,:::,:::,:,:,:
    ,.,,,,,,,...,,.,,....................................:,............:,,,:,:,,,,,

    Net:   Ethernet PHY: GENERIC @ 0x01
    DaVinci EMAC
    Hit any key to stop autoboot:  0
    No MMC card found
    Please set bootargs and bootcmd before booting the kernel
    If that has already been done please ignore this message
    TI8168_EVM#

    u-boot.noxip.zip
  • Hi Yihe,

    I have repeated exactly the same as your commands above. After that, I leave SW4 with NAND set to "ON" and SPI set to "OFF". On SW4, the only switches set to ON are BTM1 and BTM4. Unfortunately it still isn't booting; nothing appears on screen after I press reset.

    If this is as your setup, clearly my NAND is broken. I'll look into replacing it.

    Thanks,

    Ralph

  • Ralph were you able to get this issue resolved...did you discover the root cause of the NAND boot?

  • Hello Dave,

    unfortunately I was not able to resolve this despite my best efforts and use of "nand scrub". It's not the end of the world as hopefully I will get a new EVM fairly soon, and NAND boot is always a bit dodgy due to the physical nature of NAND flash so we may end up not using it.

    Ralph

  • Hi:

    I have met the same problem with you,the suggestion is to use CCS to flash you u-boot.noxip.bin to nand flash. I am still trying this step, althrough i failed flashing u-boot.noxip.bin to nandflash, but the marked bad block all turned to be normal when I used sd uboot to flash u-boot.noxip.bin into nandflash. I don't know the actual reason of this ,but I think this will help you make the first step. I will try again to have CCS flashing u-boot.noxip.bin to nand.

  • Hi, yes I agree that flashing via CCS and a JTAG debugger is one way forward if U-Boot flashing.

    I have just succeeded in getting this to work at last! Here are the exact commands I used, copied mostly from the U-Boot document in psp/docs.

    mmc init
    mw.b 0x81000000 0xFF 0x100000
    fatload mmc 1 0x81000000 u-boot.noxip.bin
    nand erase 0x0 0x1C0000
    nandecc hw 2
    nand write.i 0x81000000 0x0 0x1C0000
    nandecc sw 0

    I think by the looks of it it was the mw.b command that fixed things.

    Ralph

  • Hi, Ralph!

    I have the same problem, when I try to burn U-boot into NAND.  And I have the same adresses of bad blocks. Please say how do you solve this problem?

    Thank you.

  • I never did solve this problem. I think I just ended up ignoring the "bad blocks" error and carrying on as normal. It's been a while so I could be wrong.

    Ralph

  • _Ralph, what does it mean "I just ended up ignoring"? You simply use nand read/write command or before you use nand scrub command? (really clean NAND erasing bad blocks (UNSAFE)). On my EVM I have:

    TI8168_EVM#nand bad  
    Device 0 bad blocks:
      00000000
      00020000
      00040000
      00060000
      00080000
      000a0000
      000c0000
      000e0000

    Thank you.
  • Just follow the instructions I put in my post:

    http://e2e.ti.com/support/dsp/integra_dsparm/f/625/p/100154/380511.aspx#380511

    This will allow you to boot fine. I ignored any error messages that came up when doing this.

    Ralph

  • Hi, _Ralph_! I was repeated all your steps, but no results for NAND :( Burn u-boot into the SPI was successful. Thank you for your help. 

    TI8168_EVM#nand info

    Device 0: nand0, sector size 128 KiB
    TI8168_EVM#nand erase 0x0 0x260000

    NAND erase: device 0 offset 0x0, size 0x260000
    Skipping bad block at  0x00000000                                          
    Skipping bad block at  0x00020000                                          
    Skipping bad block at  0x00040000                                          
    Skipping bad block at  0x00060000                                          
    Skipping bad block at  0x00080000                                          
    Skipping bad block at  0x000a0000                                          
    Skipping bad block at  0x000c0000                                          
    Skipping bad block at  0x000e0000                                          
    Erasing at 0x240000 -- 100% complete.
    OK
    TI8168_EVM#dhcp            
    BOOTP broadcast 1
    DHCP client bound to address 192.168.0.77
    TI8168_EVM#setenv serverip 192.168.0.39
    TI8168_EVM#mw.b 0x81000000 0xFF 0x260000
    TI8168_EVM#tftp 0x81000000 u-boot.noxip.bin
    Using DaVinci EMAC device
    TFTP from server 192.168.0.39; our IP address is 192.168.0.77
    Filename 'u-boot.noxip.bin'.
    Load address: 0x81000000
    Loading: ###################################
    done
    Bytes transferred = 178732 (2ba2c hex)
    TI8168_EVM#nandecc hw 2
    HW ECC BCH8 Selected
    TI8168_EVM#nand write.i 0x81000000 0x0 0x260000

    NAND write: device 0 offset 0x0, size 0x260000
    Skip bad block 0x00000000
    Skip bad block 0x00020000
    Skip bad block 0x00040000
    Skip bad block 0x00060000
    Skip bad block 0x00080000
    Skip bad block 0x000a0000
    Skip bad block 0x000c0000
    Skip bad block 0x000e0000
     2490368 bytes written: OK
    TI8168_EVM#nandecc hw 0
    HW ECC Hamming Code selected
    TI8168_EVM#

  • Hi, all!

    I'm checked NAND flash on my DDR2 EVM. NAND is ok. For testing I used source code of low-level driver from here http://www.micron.com/products/nand_flash/software/ I modified  driver code for Linux and add cleanup function.  May be it was useful for somebody 8787.nand.tar.gz

    After that, I installed EZSDK 5_00_00_56 instead 5_02_02_60 and rebuild u-boot for NAND. Then I was successfully burn u-boot, kernel image and file system image.

    Thanks to all.

  • Hi all:

     I reproduce this problem.  I tried all the way and it doesn't boot up at all; nothing is displayed in the terminal.

    The version of ezsdk used is ti-ezsdk_dm816x-evm_5_03_01_15.

    did everyone discover the root cause of the NAND boot??

    Thank you!

  • My thoughts on this thread, some things to consider

    My EVM came with an older version of the EZSDK (5_01_01_80). The flash programming instructions for that version of uboot is different from the newer version (ti-ezsdkdm816z-evm_5_3 or 5_4).
    So if I used my CF card image that came with the board to start I would use the 05_01_01_80 instructions for loading which is in the documents on this CF card as well.
    Once the new uboot image is on then you can use the new instructions.
    Just something to read up on.

    OR Get another CF card and re-image it with the newer version of EZSDK (05_03) and use the new instructions for moving the uboot image off of that into the nand flash. I am telling you to get another CF card only because I don't think it is a good idea to destroy the original until you are comforable with what you are doing.

    Also don't forget to flip the dip switch to enable the NAND but not the SPI, they can't both be enabled at the same time.

    Conceptually :

    1. with the board off set the board to boot from CF card (it gets uboot off of the CF card)
    2. enable the NAND flash (SW4)
    3. power on to boot to the CF card , use instructions for the version of EZSDK on the CFcard to burn uboot to the nand flash
    4. power off and change boot settings to nand flash (it gets uboot off the nand)
    5. removed CF card (to test that it worked) and apply power again.
    6. adjust the boot script to handle NFS or CF or whatever
    7. IF YOU DO IT WRONG - start over at CF card boot - READ many threads and other websites. I remember that details to how this board woks were in multiple locations sometimes.

    good luck

  • Hi ,thank you!

    I follow the step already,but still couldn't boot from nand flash. I can't find a way. should i use an older version of the EZSDK?

    I don't know why "Skip bad block" is there. did I need to change the code of u-boot?

    I can try what method?