Thank you for your clarifying.
Could you please additionally check whether you first erased whole area (all sectors) where you write your data?
Idea:
Just for sure, could you please specify these values?
file_ptr->FLAGS & FLASHX_SECTOR_CACHE_ENABLED
file_ptr->FLAGS & FLASHX_FLASH_BUFFER_ENABLED
Did you call IO_IOCTL_FLUSH_OUTPUT or FLASH_IOCTL_FLUSH_BUFFER after you wrote to flash?
What I mean: When you want write into flash and this write will not occupied whole sector, flashX driver will hold these data in RAM until you add data to the rest of sector or you call IO_IOCTL_FLUSH_OUTPUT or FLASH_IOCTL_FLUSH_BUFFER. This technique is here for minimizing of write/erase cycle number.
If you will read flash by flashX driver it will return correct data which you wrote by flashX driver however it doesn’t mean that these data are already written into flash (it will read partially from RAM buffer).
If you are using simple data copy&paste (what I suppose), you will probably read 0xFF values inside last sector.
Please call IO_IOCTL_FLUSH_OUTPUT or FLASH_IOCTL_FLUSH_BUFFER for ensure that all data are written into the flash.