Can you please let us know how many bytes you are writing and how man you are reading back. ?
Did you try writing different no of bytes and observe the same issue ?
Is it happening on multiple pages or only in one page.
Is it possible for you to send the images of the data which you are writing and the data you are reading ?
I am writing complete page data area (2048 bytes) with values 0x00 for all bytes. When I read the page data back I can see 1756th byte value as 0x02 and all remaining are 0x00. I thought the program page operation was success because read status register giving value 0xE0 after page program.
I found same issue for several blocks with different pages and offsets, but the page program operation was success.
Based on your description, it seems like the Bad Block happened on your flash. Bad Block is normal on NAND flash due to the physical character.
Please refer the following KBAs about how to recognize and mark the Bad Block and our Bad Block limit:
Writing page data area (2048 bytes) looked like that the NAND driver didn't consider writing calculated ECC data to the NAND spare area accordingly. Basically, S34ML01G2 NAND requires max 4 bits error correction per in every 512 bytes of page area, and the correction should be done by a NAND driver - programming operation will not return a failure status but could have 4 bit errors in every 512 bytes. That means, before programming, the NAND driver needs to calculated ECC data per 512 bytes and the should be programmed to spare area accordingly. When you read the page data for a programming verification, you need to read page data and ECC data together, and then check the page data integrity using the ECC data read. If an error number exceeds 4 (per 512 bytes), then the driver need to manage the block as a bad block generated.