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/AM3352: How to enable 4-bit ECC for NAND

Part Number: AM3352

Tool/software: Linux

Hello,

I'm using the AM3352 on a custom board with Cypress NAND flash (S34ML01G200TF100). How do I go about enabling NAND ECC for booting (4-bit)? Sorry if this is a newbie question but I am new to using the ECC feature.

Thanks

  • The software team have been notified. They will respond here.
  • Is this for Linux?

    Steve K.

  • yes, this is for Linux

  • The boot ROM only supports 8-bit or 16-bit ECC for booting. Both u-boot and Linux support 8-bit (BCH8) or 16-bit (BCH16). I noticed in the data sheet for the part, it mentions 4-bit, but we looked at the NAND we use on our boards and they mention 4-bit, but we actually program them 8-bit (2k page) or 16-bit (4k page).

    Steve K.
  • Steve,

    Thanks for the follow-up. That seems strange to have a board with 4-bit ECC NAND but we program it for 8-bit and it works. Do you know if the ECC functionality has been tested with this setup? What specific board are you referring to? I check and the AM335x EVM has a schematic place-holder for a NAND but it's marked DNI and there is not part number. The AM335x Starter Kit has no NAND, and the BBB has eMMC managed NAND.

    Regardless, it sounds like we will not be able to use 4-bit ECC NAND since our boot ROM doesn't support it.

    Looks like the following wiki confirms your statement that 4-bit ECC is not supported in our boot rom.

    Thanks,

    -Brad

  • Brad, really the only restriction is the spare area formatting that the ROM code expects during boot (this is outlined in the Initialzation chapter of the TRM), which supports BCH8 or 16 as Steve mentioned.  On the AM335x GP EVM, there is a NAND on the GP daughtercard (there is a spot for another NAND on the main board which is not populated).  The GP daughtercard NAND has the requirement for 4-bit ECC at a minimum, but to satisfy the ROM requirement, the spare area should be formatted with ECC BCH8

    Regards,

    James

  • Thanks James.

    If I can live with out ECC during initial ROM boot but want to enable from within u-boot to be used during loading the kernel and filesystem, how do I go about enabling it?

    Thanks

  • You have to use ECC to boot, and the boot ROM only understands BCH8 and BCH16.

    In the u-boot source, look at include/configs/am335x_evm.h. That is where the NAND information is set. When you build u-boot, both MLO and u-boot will use the ECC algorithm selected. When you use u-boot to flash the NAND, it will be flashed with the ECC selected in the .h file. This NAND should work on AM335x.

    Steve K.

  • Thanks Steve.

    So I've been reading the TRM in great detail plus other reading and I beleive I have a grasp on this, at least from the HW capabilities and how our ROM code handles things. I agree that for our particular device, we should be okay using BCH 8-bit ECC.

    Our part is the S34ML01G200TF100. From it's datasheet...

    • x8, 1Gb: 2048+64 page size so 64 bytes spare area per page. That's enough spare area to hold the ECC code for all four 512byte sectors in each page
    • ONFI 1.0 compliant so it will provide the ONFI parameters page to get page size, block size, etc.

    We would just need to make sure SYSBOOT[9] is pulled low if we want to have the ROM code use ECC

    That leaves the question of how to enable ECC in software once MLO has been loaded by the ROM. I looked at the am335x_evm.h file you referred to, thanks for sharing that. I don't know what all the settings mean but to me they look reasonable as-is for our NAND device.

    Here's a dumb question though. In the am335x_evm.h file, looks like all the NAND settings depend on the preprocessor symbol CONFIG_NAND to be set. I didn't see it being set in the ti_am335x_common.h file. I'm not that familiar with customizing u-boot, I usually just build it from the top level SDK makefile. So where would I define CONFIG_NAND? Should I set it as a -d define on the make command line? Should I just define it in a header file? Just looking for the place where something like this is normally defined so I'm not doing anything stupid.

    Thanks

  • I did a grep from the top level u-boot folder and found the CONFIG_NAND in a file called u-boot.cfg. I see some other ECC related settings in there. Do I edit this file directly then rebuild u-boot? Not sure if this file was generated by something else or not.

    Thanks
  • That file gets generated. You want to modify include/configs/am335x_evm.h.

    CONFIG_NAND gets set in configs/am335x_evm_defconfig. Edit this file and you see
    CONFIG_SYS_EXTRA_OPTIONS="NAND"

    Which is how CONFIG_NAND gets set.

    Steve K.