One thing I did notice is that there is a Serial.print('\t'): which never prints in the output. I am not sure what that means but I suspect it is significant.
That's a tab character. Exactly what the receiver is supposed to do with it is not defined. To some, it means something. To others, it is meaningless.
Serial.write('h');
Serial.write('i');
Serial.write('\n');//debug
Why are you sending these characters as binary data?
Here is the output based on the code above.
I don't see hi...
i=0;
dflash.Buffer_Write_Byte(1, j+1, '\0'); //terminate the string in the buffer
Swap the order of these, and get rid of j.
dflash.Buffer_To_Page(1, lastpage); //write the buffer to the memory on page: lastpage
lastPage is not a buffer. So, what, exactly is this function call doing? Where, specifically, is it writing to on the page?
What is the first argument to both of the functions?
dflash.Page_To_Buffer(i, 1);//copy page i to the buffer
Since when is 1 a buffer?
It appears that you are writing data to the flash, and then dumping garbage over the top of it.
Then, the garbage trashes memory when you misuse the Page_To_Buffer() method. After that, you can't reasonably expect ANYTHING to work.