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.

Linux/PROCESSOR-SDK-OMAPL138: u-boot-2018.01: nand write failed with -5

Part Number: PROCESSOR-SDK-OMAPL138
Other Parts Discussed in Thread: OMAP-L138, OMAPL138, FLASHTOOL

Tool/software: Linux

From u-boot nand write command always failed on any partitions/offsets:

NAND write: device 0 offset 0x0, size 0x85b2c
NAND write to offset 0 failed -5
 0 bytes written: ERROR

From linux nand write/read works.

  • Hi,

    Which Processor SDK Linux is this?

    Best Regards,
    Yordan
  • Ok, and can you describe your use case? What are you trying to write in the nand? Do you have any error log and bootlog?

    The error comes from: nand_write_skip_bad() so it could be possible that the nand flash is bad. Is it possible to try on another board? or with different nand chip?

    Best Regards,
    Yordan
  • I start the board with u-boot, and do the following:

    Hit any key to stop autoboot: 0
    => mmc rescan
    => nand erase.part boot

    NAND erase.part: device 0 offset 0x0, size 0x100000
    Erasing at 0xe0000 -- 100% complete.
    OK
    => fatload mmc 0 0xc0700000 u-boot_ais_nand8.bin
    547628 bytes read in 578 ms (924.8 KiB/s)
    => nand write 0xc0700000 boot ${filesize}

    NAND write: device 0 offset 0x0, size 0x85b2c
    NAND write to offset 0 failed -5
    0 bytes written: ERROR
    =>

    This error occures on any partition, not only on first. But with the old u-boot on the same board nand writing is ok.
  • I try another board an result is the same.

    It fails on nand_do_read_ops() at line 1813 in nand_base.c: ecc_fail = true;

    Do you have any ideas?

  • Is it possible to test this on omap-l138 LCDK? If not please share your config file (include/configs/omapl138_lcdk.h), also the u-boot defconfig file & u-boot dts file.

    Best Regards,
    Yordan
  • I have no LCDK, can't test. I've shared the files. dts file is not modified by me.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/2337.files.7z

  • Upd: I use 8bit NAND buswidth
  • Hi,

    do you have any ideas? What should I try next?

  • Hi,

    Sorry, I couldn't find a time to review this and test on my side. I will do this today and update the thread.

    Best Regards,
    Yordan
  • Can you try different ECC scheme? Take a look at the following wiki:
    processors.wiki.ti.com/.../Raw_NAND_ECC

    At the moment you use #define CONFIG_SYS_NAND_4BIT_HW_ECC_OOBFIRST with
    #define CONFIG_SYS_NAND_ECCPOS { \
    6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \
    22, 23, 24, 25, 26, 27, 28, 29, 30, 31, \
    38, 39, 40, 41, 42, 43, 44, 45, 46, 47, \
    54, 55, 56, 57, 58, 59, 60, 61, 62, 63 }

    Verify that this comply with the actual ECC scheme supported by the part you use.

    Best Regards,
    Yordan
  • I think that is correct, because I use the same scheme on my old u-boot-2012.04.01 and it works (I applyed patch to old u-boot from wiki with this scheme).

  • Hi,

    Where did you get this old u-boot from? It would be a good idea to compare the differences in the omapl138_lcdk.h config files in this old u-boot and the latest one. Also in the davinci-nand.c driver. This should give a fair amount of info to pinpoint the rootcause for your error.

    Best Regards,
    Yordan
  • The old u-boot is from mcsdk_01_01_00_02 (with changes according to 8bit NAND instead of 16bit). CONFIG_SYS_NAND_xxx params in omapl138_lcdk.h files looks the same. There are minor differences in davinci_nand.c and a lot of differences in nand_bbt.c, nand_util.c, etc.

    NAND reads without a problem:

    NAND read: device 0 offset 0x120000, size 0x10000
     65536 bytes read: OK
    => nand read 0xc0700000 kernel 0x100000

    NAND read: device 0 offset 0x120000, size 0x100000
     1048576 bytes read: OK
    => nand write 0xc0700000 kernel 0x100000

    Write looks like it depends on size:

    => nand write 0xc0700000 kernel 0x480000

    NAND write: device 0 offset 0x120000, size 0x480000
     4718592 bytes written: OK
    => nand write 0xc0700000 kernel 0x48ba00

    NAND write: device 0 offset 0x120000, size 0x48ba00
    NAND write to offset 120000 failed -5
     0 bytes written: ERROR
    => nand write 0xc0700000 kernel 0x490000

    NAND write: device 0 offset 0x120000, size 0x490000
     4784128 bytes written: OK
    =>

    And sometimes write return OK, then the same write failed:

    NAND write: device 0 offset 0x120000, size 0x480000
     4718592 bytes written: OK
    =>
    => nand write 0xc0700000 kernel 0x47ab90

    NAND write: device 0 offset 0x120000, size 0x47ab90
    NAND write to offset 120000 failed -5
     0 bytes written: ERROR
    =>
    => nand erase.part kernel

    NAND erase.part: device 0 offset 0x120000, size 0x800000
    Erasing at 0x900000 -- 100% complete.
    OK
    => nand write 0xc0700000 kernel 0x47ab90

    NAND write: device 0 offset 0x120000, size 0x47ab90
    NAND write to offset 120000 failed -5
     0 bytes written: ERROR
    => nand write 0xc0700000 kernel 0x480000

    NAND write: device 0 offset 0x120000, size 0x480000
    NAND write to offset 120000 failed -5
     0 bytes written: ERROR
    => nand write 0xc0700000 kernel 0x480000

  • Could you please ensure that u-boot from sdk 05.01.00.11, builded from source, works with NAND on EVM?
  • I found EVM-like board with 16bit NAND, then I was build and run u-boot from latest sdk, but result is the same.. :(

  • Hi,

    Can you check this thread regarding nand ecc configuration:
    e2e.ti.com/.../667875

    Best Regards,
    Yordan

  • Hi, Yordan,

    I still don't know to do with u-boot, I checked ecc configuration several times, it's the same as need. But I read thread you mentioned, built flashtool and now I do boot partition update under linux, instead of from u-boot, as I done earlier. The final goal of system update works this manner. Thank you for your help.

  • Ok, thanks for the feedback. For now I am closing this thread. If you need further help please feel free to open another e2e thread.

    Best Regards,
    Yordan