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: NAND write fails

Part Number: AM3352

Tool/software: Linux

Writing failures occur when using nandwrite instructions in MTD util tools

The NAND flash GPMC pinmux settings are as follows

When I erase and write Flash, I use an oscilloscope to measure the Wpn pin, which is always high level without write protection.

But after calling nandwrite to write flash, there are a lot of errors, as shown below.

So I added some test code to the driver of kernel, found that it was often considered to have write protection at the function nand_check_wp. What is the reason for this phenomenon?

  • Hello,

    Please refer to the following thread.

    Regards,
    Krunal

  • Hi Krunal,

    Thank you for your reply.

    I'm not the same as the above posts, and I checked the configuration, asynchronous reading and writing.

    Here's our schematic , pinmux settings , gpmc register value and dts settings.

    I found a phenomenon.

    The following code adds printk statement, using nandwrite everything is normal, if you turn off debugging information or do not add this sentence, there will be an exception before.

    static int nand_check_wp(struct mtd_info *mtd)
    {
    struct nand_chip *chip = mtd_to_nand(mtd);

    int val;

    /* Broken xD cards report WP despite being writable */
    if (chip->options & NAND_BROKEN_XD)
    return 0;

    /* Check the WP bit */
    chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);

    val=chip->read_byte(mtd) & NAND_STATUS_WP);
    printk(KERN_INFO"val=0x%02x\n",val);  ->When debugging information of serial port is opened, add this code, nandwrite is normal,or add mdelay(1),also is normal.
    return ( val? 0 : 1);

    }

  • Hello,

    I am wondering if you could please confirm the NAND datasheet to ensure write protect pin is configured correctly.

    Regards,
    Krunal