I use S29GL512S "buffer programming" every 256 bytes.
Now I have a problem.
Writing the first and second 256 bytes in the sector will success,but writing the third 256 bytes in the sector will fail.
Are you providing Program Buffer to Flash confirm command ( 29h) after all 256 bytes are written.
what is the word count you are providing. Is it 127 or 255 ? It should be 127 since you are programming 256 bytes.
The Write Buffer Programming Sequence will be Aborted under the following conditions:
1.Load a Word Count value greater than the buffer size (255).
2. Write an address that is outside the Line provided in the Write to Buffer command.
3. The Program Buffer to Flash command is not issued after the Write Word Count number of data words is loaded.
Please note that we recommend for the very best performance, programming should be done in full Lines of 512 bytes aligned on 512-byte boundaries.
Please double check the polling code. I see that you are trying to check DQ1 to see if there is a Write Buffer Abort error:
if (((*(vType_uHWord*)(auwDstAddr)) & 0x20) != 0)
0x20 is not correct. It should be 0x02 for DQ1.
Not sure if this is the cause of your issue but please correct that and re-test.