Skip to main content
sheng yang
Senior
Mar 24, 2018 2:27 PM UTC
Solved

init nand flash mt39f8g08 in bank3(0X80000000) FAILED?

Posted on March 24, 2018 at 15:27

my register set around 0xa0000080 was below

0690X0000060AE2QAM.png

and fmc clock was enable

0690X00000609QNQAY.png

but i still couldn't reset nand flash and read a error nand id as below

0690X0000060ABTQA2.png

my reset nand code as below

#define READ_ID 0x90 #define NAND_RESET 0xFF #define NAND_READSTA 0x70 #define NAND_READY 0x40 static unsigned char reset_stm32nand(void) { volatile unsigned char data = 0; int ret = 0; debug(''iysheng nand reseting\n''); *(volatile unsigned char *)(0x80000000 | 1 << 16) = NAND_RESET; do { ret++; *(volatile unsigned char *)(0x80000000 | 1 << 16) = NAND_READSTA; udelay(100); data = *(volatile unsigned char *)(0x80000000); } while((data != NAND_READY) && (ret < 0x1ffff)); return data; }

and my dts file relate fmc nand control pin as below

0690X0000060AEMQA2.png

what's wrong maybe happen???besides these point,is there sth i couldn't get attention cause the problem???

    This topic has been closed for replies.
    sheng yang
    sheng yangBest answer
    Senior
    Mar 25, 2018 3:29 PM UTC
    Posted on March 25, 2018 at 15:29

    After I compare my code with some others code,I found it's maybe i didn't set mpu config relate nand flash (address 0x80000000:256Mbytes).And after i add mpu config code,then it maybe right now.my mpu config as below

    0690X0000060AEbQAM.png

    now i could get nand id right,

    0690X0000060A93QAE.png

    thanks for

    Turvey.Clive.002

    ‌

    2 replies

    Tesla DeLorean
    Guru
    Mar 24, 2018 2:40 PM UTC
    Posted on March 24, 2018 at 15:40

    NAND acts more like a mass storage device than a random access memory, so dumping content is not going to be a good plan. There are only a handful of address pins connected to the NAND device, you are basically reading out of a FIFO, every read to the memory range returns a different value from the array.

    If you wanted to dump out a sector you'd need to memcpy() the whole thing in one step to a buffer, and then dump the buffer.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    sheng yang
    sheng yangAuthorBest answer
    Senior
    Mar 25, 2018 3:29 PM UTC
    Posted on March 25, 2018 at 15:29

    After I compare my code with some others code,I found it's maybe i didn't set mpu config relate nand flash (address 0x80000000:256Mbytes).And after i add mpu config code,then it maybe right now.my mpu config as below

    0690X0000060AEbQAM.png

    now i could get nand id right,

    0690X0000060A93QAE.png

    thanks for

    Turvey.Clive.002

    ‌