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.

How to set ECC control setting in UBL?

Other Parts Discussed in Thread: ASH

 

My Customers use DM365 and have a question on UBL code.

 

1)      How to set ECC control setting in UBL.(ex. ECC setting/DM36x to set 1 bit or 4 bit)

2)      Are there any update? (Specially related with NAND module). Currently STW uses Boot loader 1.3.4 version.

 

  • Hi,

    Can you please let me know the release version the customer is using? When you say STW is using version 1.3.4, are you talking about the U-Boot version or UBL version?

    Regards, Sudhakar

  • I checked versions like blow from customer.

    * kernel : 2.6.18

    * DVSDK : 2_10_01_18

  • Hi,

    This is very old release. We had observed that UBL/U-Boot/Linux does not correct ECC errors and this has been fixed in the later releases. See the technical reasoning for the problem below:

    ECC_STATE field reads 0x3 (Error correction complete) immediately after setting the 4BITECC_ADD_CALC_START bit. So if you immediately begin trying to poll for the state, you may fall right out of your loop without any of the correction calculations having taken place. The recommendation from the hardware team is to initially delay as long as ECC_STATE reads less than 4. After that, ECC HW has entered correction state.

    As per the above description, DEVICE_NAND_ECC_correct() function needs to be modified as below:

    // Start calculating the correction addresses and values
      AEMIF->NANDFCR |= (0x1U << DEVICE_EMIF_NANDFCR_4BITECC_ADD_CALC_START_SHIFT);

      /*
       * loop without any of the correction calculations having taken place.\r
       * So wait till ECC_STATE reads less than 4.\r
       */
      do
      {
        temp = (AEMIF->NANDFSR >> 8) & 0xf;
      }while (temp < 4);

      // Loop until timeout or the ECC calculations are complete (bit 11:10 == 00b)
      i = NAND_TIMEOUT;
      do
      {
        temp = (AEMIF->NANDFSR & DEVICE_EMIF_NANDFSR_ECC_STATE_MASK)>>10;
        i--;
      }
      while((i>0) && (temp != 0x0));

    Highlighted text needs to be added.

    Regards, Sudhakar
            

  • INT-Where is the latest release?

    When  I had checked with the latest release, it doesn't have your added lines.

    Can you give me the link for it?

  • Hi,

    You can download the release from http://software-dl.ti.com/dsps/dsps_public_sw/psp/LinuxPSP/DaVinci_03_21/03_21_00_04/index_FDS.html.

    Please refer to src/boot-strap/flash-utils-03.21.00.04/DM36x/Common/src/davinci_nand.c file in the release.

    Regards, Sudhakar 

  • Although after modification, it has same error as before. (micron NAND)

  • With new UBL package (3.21.00.04), same error happens. (corrState "0x5" and boot failed).

  • Finally checked that with latest UBL of PSP 3.21.00.04, this ECC correction fail issue is solved.

  • Hello,

    I know this is old thread but hope you can assist.
    When I just replaced the old ubl with the fixed one (1.5->1.65)
    It all works until I write something from kernel. But I write to filesystem not to u-boot/ubl partition.
    Why does linux write to filesystem partition fails ?

    Regards,
    Ran
  • Hi Ran,

    How are you flashing the filesystems ? Make sure uboot and kernel are having same ECC bits and layout.
  • Hi Dwarakesh ,

    Thank you so much for the kind reply.

    this is the procedure I am doing:

    1. from ccs5 with nanderase/nandwrite programs I do:

      1.1 nand erase flash

      1.2 nand write ubl + u-boot

    2. from u-boot I program:

        2.1 boot parameters

        2.2 kernel

        2.3 initrd filesystem

    3. from kernel I then do:

       3.1 flash_eraseall for filesystem partition

       3.2 mount filesystem partition as yaffs and extract filesystem tar into this partition

    This procedure works well with: ubl 1.5 + u-boot 1.3.4+ kernel 2.6.18

    If I only change ubl from 1.5 to 1.65 this procedure fails in 3.2 ( mount filesystem partition as yaffs from linux)

    I don't understand how it can be... the partition is not u-boot/ubl but this is the filesystem partitions, so why the new ubl version can cause this failue ?

    Our partitions:

    nand
    0x020000 ubl+header
    0x320000 u-boot + header
    0x3c0000 - params
    0x400000 - kernel
    0x800000 - filesystem

    0xc00000 - filesystem2 

    Thanks,

    Ran

  • Hi Ran,

    What exactly is the failure ? Can you share the logs ?
  • Yes,

    #

    # cd /root

    # tftp -g -r ramdisk.tar 192.168.1.114

    mkdir /mnt/nand

    flash_eraseall /dev/mtd3

    mount -t yaffs /dev/mtdblock3 /mnt/nand

    cd /mnt/nand

    tar -xf /root/ramdisk.tar

    Erasing 128 Kibyte @ f720000 -- 99 %yaffs: dev is 32505859 name is "mtdblock3"

    Erasiyaffs: passed flags ""

    ng 128 Kibyte @ yaffs: Attempting MTD mount on 31.3, "mtdblock3"

    f740000 -- 99 % yaffs: auto selecting yaffs2

    Erasing 128 Kibyte @ f760000 -- 99 % complete.

    Skipping bad block at 0x0f780000

    Skipping bad block at 0x0f7a0000

    Skipping bad block at 0x0f7c0000

    Skipping bad block at 0x0f7e0000

    # block 1981 is bad

    block 1982 is bad

    block 1983 is bad

    block 1984 is bad

    yaffs_read_super: isCheckpointed 0

    **>> yaffs chunk 2112 was not erased

    # # **>> yaffs chunk 2113 was not erased

    **>> yaffs chunk 2114 was not erased

    **>> yaffs chunk 2115 was not erased

    **>> yaffs chunk 2116 was not erased

    **>> yaffs chunk 2117 was not erased

    **>> yaffs chunk 2118 was not erased

    **>> yaffs chunk 2119 was not erased

    **>> yaffs chunk 2120 was not erased

    **>> yaffs chunk 2121 was not erased

    **>> yaffs chunk 2122 was not erased

    **>> yaffs chunk 2123 was not erased

    **>> yaffs chunk 2124 was not erased

    **>> yaffs chunk 2125 was not erased

    **>> yaffs chunk 2126 was not erased

    **>> yaffs chunk 2127 was not erased

    **>> yaffs chunk 2128 was not erased

    **>> yaffs chunk 2129 was not erased

    **>> yaffs chunk 2130 was not erased

    **>> yaffs chunk 2131 was not erased

    **>> yaffs chunk 2132 was not erased

    **>> yaffs chunk 2133 was not erased

    **>> yaffs chunk 2134 was not erased

    **>> yaffs chunk 2135 was not erased

    **>> yaffs chunk 2136 was not erased

    **>> yaffs chunk 2137 was not erased

    **>> yaffs chunk 2138 was not erased

    **>> yaffs chunk 2139 was not erased

    **>> yaffs chunk 2140 was not erased

    **>> yaffs chunk 2141 was not erased

    **>> yaffs chunk 2142 was not erased

    **>> yaffs chunk 2143 was not erased

    **>> yaffs chunk 2144 was not erased

    **>> yaffs chunk 2145 was not erased

    **>> yaffs chunk 2146 was not erased

    **>> yaffs chunk 2147 was not erased

    **>> yaffs chunk 2148 was not erased

    **>> yaffs chunk 2149 was not erased

    **>> yaffs chunk 2150 was not erased

    **>> yaffs chunk 2151 was not erased

    **>> yaffs chunk 2152 was not erased

    **>> yaffs chunk 2153 was not erased

    **>> yaffs chunk 2154 was not erased

    **>> yaffs chunk 2155 was not erased

    **>> yaffs chunk 2156 was not erased

    **>> yaffs chunk 2157 was not erased

    **>> yaffs chunk 2158 was not erased

    **>> yaffs chunk 2159 was not erased

    **>> yaffs chunk 2160 was not erased

    **>> yaffs chunk 2161 was not erased

    **>> yaffs chunk 2162 was not erased

    **>> yaffs chunk 2163 was not erased

    **>> yaffs chunk 2164 was not erased

    **>> yaffs chunk 2165 was not erased

    **>> yaffs chunk 2166 was not erased

    **>> yaffs chunk 2167 was not erased

    **>> yaffs chunk 2168 was not erased

    **>> yaffs chunk 2169 was not erased

    **>> yaffs chunk 2170 was not erased

    **>> yaffs chunk 2171 was not erased

    **>> yaffs chunk 2172 was not erased

    **>> yaffs chunk 2173 was not erased

    **>> yaffs chunk 2174 was not erased

    **>> yaffs chunk 2175 was not erased

    **>> yaffs chunk 2816 was not erased

    **>> yaffs chunk 2817 was not erased

    **>> yaffs chunk 2818 was not erased

    **>> yaffs chunk 2819 was not erased

    **>> yaffs chunk 2820 was not erased

    **>> yaffs chunk 2821 was not erased

    **>> yaffs chunk 2822 was not erased

    **>> yaffs chunk 2823 was not erased

    **>> yaffs chunk 2824 was not erased

    **>> yaffs chunk 2825 was not erased

    **>> yaffs chunk 2826 was not erased

    **>> yaffs chunk 2827 was not erased

    **>> yaffs chunk 2828 was not erased

    **>> yaffs chunk 2829 was not erased

    **>> yaffs chunk 2830 was not erased

    **>> yaffs chunk 2831 was not erased

    **>> yaffs chunk 2832 was not erased

    **>> yaffs chunk 2833 was not erased

    **>> yaffs chunk 2834 was not erased

    **>> yaffs chunk 2835 was not erased

    **>> yaffs chunk 2836 was not erased

    **>> yaffs chunk 2837 was not erased

    **>> yaffs chunk 2838 was not erased

    **>> yaffs chunk 2839 was not erased

    **>> yaffs chunk 2840 was not erased

    **>> yaffs chunk 2841 was not erased

    **>> yaffs chunk 2842 was not erased

    **>> yaffs chunk 2843 was not erased

    **>> yaffs chunk 2844 was not erased

    **>> yaffs chunk 2845 was not erased

    **>> yaffs chunk 2846 was not erased

    **>> yaffs chunk 2847 was not erased

    **>> yaffs chunk 2848 was not erased

    **>> yaffs chunk 2849 was not erased

    **>> yaffs chunk 2850 was not erased

    **>> yaffs chunk 2851 was not erased

    **>> yaffs chunk 2852 was not erased

    **>> yaffs chunk 2853 was not erased

    **>> yaffs chunk 2854 was not erased

    **>> yaffs chunk 2855 was not erased

    **>> yaffs chunk 2856 was not erased

    **>> yaffs chunk 2857 was not erased

    **>> yaffs chunk 2858 was not erased

    **>> yaffs chunk 2859 was not erased

    **>> yaffs chunk 2860 was not erased

    **>> yaffs chunk 2861 was not erased

    **>> yaffs chunk 2862 was not erased

    **>> yaffs chunk 2863 was not erased

    **>> yaffs chunk 2864 was not erased

    **>> yaffs chunk 2865 was not erased

    **>> yaffs chunk 2866 was not erased

    **>> yaffs chunk 2867 was not erased

    **>> yaffs chunk 2868 was not erased

    **>> yaffs chunk 2869 was not erased

    **>> yaffs chunk 2870 was not erased

    **>> yaffs chunk 2871 was not erased

    **>> yaffs chunk 2872 was not erased

    **>> yaffs chunk 2873 was not erased

    **>> yaffs chunk 2874 was not erased

    **>> yaffs chunk 2875 was not erased

    **>> yaffs chunk 2876 was not erased

    **>> yaffs chunk 2877 was not erased

    **>> yaffs chunk 2878 was not erased

    **>> yaffs chunk 2879 was not erased

    **>> yaffs chunk 7616 was not erased

    **>> yaffs chunk 7617 was not erased

    **>> yaffs chunk 7618 was not erased

    **>> yaffs chunk 7619 was not erased

    **>> yaffs chunk 7620 was not erased

    **>> yaffs chunk 7621 was not erased

    **>> yaffs chunk 7622 was not erased

    **>> yaffs write required 136 attempts

    nand_davinci_4bit_compare_ecc Too many errors to be corrected!

    nand_davinci_4bit_compare_ecc Too many errors to be corrected!

    nand_davinci_4bit_compare_ecc Too many errors to be corrected!

    nand_davinci_4bit_compare_ecc Too many errors to be corrected!

    **>> yaffs chunk 10048 was not erased

    **>> yaffs chunk 10049 was not erased

    **>> yaffs chunk 10050 was not erased

     

    And it goes on with this errors but better stop the log here...

    Regards,

    Ran

  • Hi Ran,

    Just to confirm, are you sure it is mtd3 for filesystems ?

    From what you shared before

    mtd0 : 0x020000 ubl+header
    mtd1 : 0x320000 u-boot + header
    mtd2 : 0x3c0000 - params
    mtd3 : 0x400000 - kernel
    mtd4 : 0x800000 - filesystem
    mtd5 : 0xc00000 - filesystem2 

    Should it not be mtd4 or mtd5 for filesystems?

    #cat /proc/mtd (in the board)

  • Hi,

    I am not sure , becuase I program from u-boot as 0xc00000, but on kernel startup I see
    Creating 4 MTD partitions on "nand_davinci.0":
    0x00000000-0x003c0000 : "bootloader"
    0x003c0000-0x00400000 : "params"
    0x00400000-0x00800000 : "kernel"
    0x00800000-0x10000000 : "filesystem1"
    Myabe it is some error in kernel printing ?

    Anyway, I program from kernel as mtd3 , which seems to be correct:
    # cat /proc/mtd
    dev: size erasesize name
    mtd0: 003c0000 00020000 "bootloader"
    mtd1: 00040000 00020000 "params"
    mtd2: 00400000 00020000 "kernel"
    mtd3: 0f800000 00020000 "filesystem1"
    #
    Regards,
    Ran
  • Hi,

    The thing I mainly don't understand is how is it that ubl version can affect writing to nand in filesystem partition. That's weird.
    I don't think the ubl initialize nand, it just read the u-boot from nand partition, Right ?

    Regards,
    Ran
  • Hi Ran,

    If there is only one filesystems in the partition, is it not writing to oneself, if you try to extract in mtd3 ? Can you share your bootargs ? Are you flashing from a ramdisk image ?

    If so can you check if your kernel is having following set CONFIG_YAFFS_DISABLE_TAGS_ECC=y in the config file ? May I know why you are going with yaffs2 ant not ubifs ?
  • Hi Ran,

    It could because of the difference in UBL too, because UBL initializes DDR and NAND. Can you compare the 2 NAND drivers in the 2 UBL versions and see any obvious differences that it could cause ?
  • Hi,

    I am doing several phases programming . first from u-boot I write this partition with initrd (ramdisk) then from linux I write yaffs tarball.
    in details:

    1. from ccs5 with nanderase/nandwrite programs I do:

    1.1 nand erase flash

    1.2 nand write ubl + u-boot

    2. from u-boot I program:

    2.1 boot parameters

    2.2 kernel

    2.3 initrd filesystem

    3. from kernel I then do:

    3.1 flash_eraseall for filesystem partition

    3.2 mount filesystem partition as yaffs and extract filesystem tar into this partition

    As to the nand issue I really have no idea, what's going on with this errors. and why I get them:

    1. ubl 1.5 + u-boot 1.3.4 + kernel 2.6.18 - no error when extracting yaffs into partition
    2. ubl 1.65 + u-boot 2010.rc12 + kernel 2.6.32 - no errors when extracting yaffs into partition
    3. ubl 1.65 + u-boot 1.3.4 + kernel 2.6.18 - ERRORS when extracting yaffs into partition - why ????

    Regards,
    Ran
  • Hi Ran,

    Few more guesses :

    1. Tried mount -T yaffs2 ?

    2. Have you confirmed in cat /proc/mtd if the filesystems size is same in both kernel versions and is big enough to accommodate unzipped ramdisk.tar ?

  • Hi Dwarakesh R,

    Thank you for the advice.

    yes it is big, see:

    # cat /proc/mtd
    dev: size erasesize name
    mtd0: 003c0000 00020000 "bootloader"
    mtd1: 00040000 00020000 "params"
    mtd2: 00400000 00020000 "kernel"
    mtd3: 0f800000 00020000 "filesystem1"

    I just don't understand why ubl can influence the behaviour in filesystem partition ? It is not that I am writing to u-boot partition....
    If it is a driver issue then why I don't see this problem in the case number (2) below ?

    1. ubl 1.5 + u-boot 1.3.4 + kernel 2.6.18 - no error when extracting yaffs into partition
    2. ubl 1.65 + u-boot 2010.rc12 + kernel 2.6.32 - no errors when extracting yaffs into partition
    3. ubl 1.65 + u-boot 1.3.4 + kernel 2.6.18 - ERRORS when extracting yaffs into partition - why ????

    Regards,
    Ran
  • Hi Ran,

    Understood. Looks like 1) ubl 1.5 and kernel 2.6.18 2) ub 1.65 and kernel 2.6.32 are compatible. Need to check how and why ? Can you point me to the package and the ubl source that you are using ? Both versions. I will look into the code and come back.
  • Hi,

    I also forgot to mention that u-boot 2010.rc12 + kernel 2.6.32 were also patched according to ti wiki:
    processors.wiki.ti.com/.../DM365_Nand_ECC_layout

    u-boot 1.3.4 + kernel 2.6.18 - are part of dvsdk 2_10_01_18
    and boot 2010.rc12 + kernel 2.6.32 - belong to dvsdk 04_02_00_06 (with our additional patch of ti wiki's about ecc)



    Thanks,
    Ran

  • Hi Dwarakesh R,

    One more thing,
    I'm in a dillema about the following:
    We have product which are stuck from time to time in ubl because of nand.
    Our product (long time now) which is using the following (dvsdk 2_10_1_18):
    ubl 1.5
    u-boot 1.3.4
    kernel 2.6.18

    This thread talks about the fix in ubl ecc.
    Do you think it is suffecient to do this fix as described here in ubl or should I better update to the following (dvsdk 4.02):
    ubl 1.65
    u-boot 2010.rc12
    kernel 2.6.32

    As I read the kernel also contain some fix for ecc (kernel 2.6.32) , but I could not find it documented very well, so I'm not sure about its importance.

    Regards,
    Ran

  • Hi,
    I just wanted to update that I eventually made the fix in ubl 1.5 as written in this start of this thread.
    So I am using same u-boot, kernel
    ubl 1.5 + ecc fix
    u-boot 1.3.4
    kernel 2.6.18

    I still wander if I also better upgrade the u-boot and kernel becuase it seems that in the later version they made some fix related to ecc in these versions:
    kernel 2.6.32
    u-boot 2010.rc12

    Though I am not sure what exactly this fix is all about, can't find it documented anywhere.


    Thank you,
    Ran

  • Hi Ran,

    Let me check the TI git to see what changes/fixes related to NAND. Anyway it is better to go with kernel 2.6.32. We have used that combo in few of our projects.
  • Hi Dwarakesh,

    Thank you a lot for your assistance !

    Regards,
    Ran
  • Hi,

    I wanted to add that the following thread I got the idea that 2.6.32 has some ecc issue difference with regards to 2.6.18.

    Though I am still not sure how important it is,

    Regards,

    Ran

  • Hi,

    We have some log from one of the products as following:
    armon

    U-Boot 1.3.4 (Dec 28 2010 - 13:35:36)

    I2C: ready
    DRAM: 128 MB
    NAND: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron NAND 256MiB 3,3
    V 8-bit)
    Bad block table found at page 131008, version 0x01
    Bad block table found at page 130944, version 0x01
    256 MiB
    env1 size: 16380, crc32 61515057
    62 61 75 64 72 61 74 65 3D 31 31 35 32 30 30 0 62 6F 6F 74
    In: serial
    Out: serial
    Err: serial
    Ethernet PHY: GENERIC @ 0x00
    Compilation successful
    Hit any key to stop autoboot: 0

    Loading from NAND 256MiB 3,3V 8-bit, offset 0x400000
    Image Name: Linux-2.6.18_pro500-davinci_evm-
    Image Type: ARM Linux Kernel Image (uncompressed)
    Data Size: 1516308 Bytes = 1.4 MB
    Load Address: 80008000
    Entry Point: 80008000
    ## Booting kernel from Legacy Image at 80700000 ...
    Image Name: Linux-2.6.18_pro500-davinci_evm-
    Image Type: ARM Linux Kernel Image (uncompressed)
    Data Size: 1516308 Bytes = 1.4 MB
    Load Address: 80008000
    Entry Point: 80008000
    Loading Kernel Image ... OK
    OK

    Starting kernel ...

    Uncompressing Linux.............................................................
    .......................................... done, booting the kernel.
    nand_davinci nand_davinci.0: after scan
    PM: davinci_pm_probe
    ARMON starting...
    SW Version:Mar 11 2012
    BSP Version:Mar 5 2012
    Armon finished intialization
    1:01 not found
    route: SIOC[ADD|1:02 not found
    DEL]RT: No such 1:03 not found
    process
    1:04 not found
    1:05 not found
    1:06 not found
    1:07 not found
    1:08 not found
    1:09 not found
    1:0a not found
    1:0b not found
    1:0c not found
    1:0d not found
    1:0e not found
    1:0f not found
    1:10 not found
    1:11 not found
    1:12 not found
    1:13 not found
    1:14 not found
    1:15 not found
    1:16 not found
    1:17 not found
    1:18 not found
    1:19 not found
    1:1a not found
    1:1b not found
    1:1c not found
    1:1d not found
    1:1e not found
    1:1f not found
    Setting up networking ....
    Restarting internet superserver: inetd.
    /bin/ash: can't access tty; job control turned off
    #

    Do you think that this failure is related to nand flash ?

    I can't see any information about it anywhere.

    Thanks,
    Ran
  • Hello,

    I would like to ask about the fix in UBL 1.5 ecc:

    I've made the same fix in UBL 1.5, (and verified that the new binary is running) -  but we still get the error.

    Is it possible to get this error even though we made the fix ?

    Thanks,

    Ran